From 95fe34fb3ecc48cda1497941842b295fa905211a Mon Sep 17 00:00:00 2001 From: Vishwanath Hiremath Date: Fri, 16 Feb 2024 14:11:57 -0800 Subject: [PATCH] fix update api Signed-off-by: Vishwanath Hiremath --- .../v20231001preview/zz_generated_models.go | 15 ++-------- .../zz_generated_models_serde.go | 29 ++----------------- .../preview/2023-10-01-preview/openapi.json | 26 +++-------------- typespec/Applications.Core/applications.tsp | 2 +- 4 files changed, 11 insertions(+), 61 deletions(-) diff --git a/pkg/corerp/api/v20231001preview/zz_generated_models.go b/pkg/corerp/api/v20231001preview/zz_generated_models.go index 73b3f0a979..0170d202ac 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_models.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_models.go @@ -117,20 +117,11 @@ type ApplicationResourceUpdate struct { // ApplicationResourceUpdateProperties - The updatable properties of the ApplicationResource. type ApplicationResourceUpdateProperties struct { - // The compute resource used by application environment. - Compute EnvironmentComputeUpdateClassification + // Fully qualified resource ID for the environment that the application is linked to + Environment *string - // The environment extension. + // The application extension. Extensions []ExtensionClassification - - // Cloud providers configuration for the environment. - Providers *ProvidersUpdate - - // Specifies Recipes linked to the Environment. - Recipes map[string]map[string]RecipePropertiesUpdateClassification - - // Simulated environment. - Simulated *bool } // AzureKeyVaultVolumeProperties - Represents Azure Key Vault Volume properties diff --git a/pkg/corerp/api/v20231001preview/zz_generated_models_serde.go b/pkg/corerp/api/v20231001preview/zz_generated_models_serde.go index 6446564248..c1b39b8004 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_models_serde.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_models_serde.go @@ -309,11 +309,8 @@ func (a *ApplicationResourceUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ApplicationResourceUpdateProperties. func (a ApplicationResourceUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "compute", a.Compute) + populate(objectMap, "environment", a.Environment) populate(objectMap, "extensions", a.Extensions) - populate(objectMap, "providers", a.Providers) - populate(objectMap, "recipes", a.Recipes) - populate(objectMap, "simulated", a.Simulated) return json.Marshal(objectMap) } @@ -326,32 +323,12 @@ func (a *ApplicationResourceUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "compute": - a.Compute, err = unmarshalEnvironmentComputeUpdateClassification(val) + case "environment": + err = unpopulate(val, "Environment", &a.Environment) delete(rawMsg, key) case "extensions": a.Extensions, err = unmarshalExtensionClassificationArray(val) delete(rawMsg, key) - case "providers": - err = unpopulate(val, "Providers", &a.Providers) - delete(rawMsg, key) - case "recipes": - var recipesRaw map[string]json.RawMessage - if err = json.Unmarshal(val, &recipesRaw); err != nil { - return err - } - recipes := map[string]map[string]RecipePropertiesUpdateClassification{} - for k1, v1 := range recipesRaw { - recipes[k1], err = unmarshalRecipePropertiesUpdateClassificationMap(v1) - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - a.Recipes = recipes - delete(rawMsg, key) - case "simulated": - err = unpopulate(val, "Simulated", &a.Simulated) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) diff --git a/swagger/specification/applications/resource-manager/Applications.Core/preview/2023-10-01-preview/openapi.json b/swagger/specification/applications/resource-manager/Applications.Core/preview/2023-10-01-preview/openapi.json index b251b023ec..e3bd250f4e 100644 --- a/swagger/specification/applications/resource-manager/Applications.Core/preview/2023-10-01-preview/openapi.json +++ b/swagger/specification/applications/resource-manager/Applications.Core/preview/2023-10-01-preview/openapi.json @@ -2723,31 +2723,13 @@ "type": "object", "description": "The updatable properties of the ApplicationResource.", "properties": { - "compute": { - "$ref": "#/definitions/EnvironmentComputeUpdate", - "description": "The compute resource used by application environment." - }, - "providers": { - "$ref": "#/definitions/ProvidersUpdate", - "description": "Cloud providers configuration for the environment." - }, - "simulated": { - "type": "boolean", - "description": "Simulated environment." - }, - "recipes": { - "type": "object", - "description": "Specifies Recipes linked to the Environment.", - "additionalProperties": { - "additionalProperties": { - "$ref": "#/definitions/RecipePropertiesUpdate" - }, - "type": "object" - } + "environment": { + "type": "string", + "description": "Fully qualified resource ID for the environment that the application is linked to" }, "extensions": { "type": "array", - "description": "The environment extension.", + "description": "The application extension.", "items": { "$ref": "#/definitions/Extension" }, diff --git a/typespec/Applications.Core/applications.tsp b/typespec/Applications.Core/applications.tsp index f3ac9a2462..da13698204 100644 --- a/typespec/Applications.Core/applications.tsp +++ b/typespec/Applications.Core/applications.tsp @@ -142,7 +142,7 @@ interface Applications { update is ArmResourcePatchSync< ApplicationResource, - EnvironmentProperties, + ApplicationProperties, UCPBaseParameters >;