From 3519c80fe510a268f6e59a29ccac8a53fdec15b6 Mon Sep 17 00:00:00 2001 From: Arthur Ma Date: Wed, 11 Sep 2024 07:23:15 +0800 Subject: [PATCH] Add client tsp for StandybyPool (#30488) --- .../StandbyPool.Management/client.tsp | 58 ++++++++++++ .../standbyContainerGroupPool.tsp | 1 + .../StandbyPool.Management/standbyVM.tsp | 2 +- .../StandbyPool.Management/standbyVMPool.tsp | 1 + .../StandbyPool.Management/tspconfig.yaml | 5 ++ .../2023-12-01-preview/standbypool.json | 82 ++--------------- .../2024-03-01-preview/standbypool.json | 89 ++----------------- .../stable/2024-03-01/standbypool.json | 89 ++----------------- 8 files changed, 90 insertions(+), 237 deletions(-) create mode 100644 specification/standbypool/StandbyPool.Management/client.tsp diff --git a/specification/standbypool/StandbyPool.Management/client.tsp b/specification/standbypool/StandbyPool.Management/client.tsp new file mode 100644 index 000000000000..b713a3d6a5fc --- /dev/null +++ b/specification/standbypool/StandbyPool.Management/client.tsp @@ -0,0 +1,58 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; +using Azure.ResourceManager.CommonTypes; +using Microsoft.StandbyPool; + +@@access(Operations.list, Access.internal, "csharp"); + +@@clientName(StandbyContainerGroupPoolResource, + "StandbyContainerGroupPool", + "csharp" +); +@@clientName(StandbyContainerGroupPoolResourceProperties, + "StandbyContainerGroupPoolProperties", + "csharp" +); +@@clientName(StandbyVirtualMachinePoolResource, + "StandbyVirtualMachinePool", + "csharp" +); +@@clientName(StandbyVirtualMachinePoolResourceProperties, + "StandbyVirtualMachinePoolProperties", + "csharp" +); +@@clientName(StandbyVirtualMachineResource, "StandbyVirtualMachine", "csharp"); +@@clientName(StandbyVirtualMachineResourceProperties, + "StandbyVirtualMachineProperties", + "csharp" +); +@@clientName(VirtualMachineState, "StandbyVirtualMachineState", "csharp"); +@@clientName(ContainerGroupProfile, "StandbyContainerGroupProfile", "csharp"); +@@clientName(ContainerGroupProperties, + "StandbyContainerGroupProperties", + "csharp" +); +@@clientName(StandbyContainerGroupPoolRuntimeViewResource, + "StandbyContainerGroupPoolRuntimeView", + "csharp" +); +@@clientName(StandbyContainerGroupPoolRuntimeViewResourceProperties, + "StandbyContainerGroupPoolRuntimeViewProperties", + "csharp" +); +@@clientName(StandbyVirtualMachinePoolRuntimeViewResource, + "StandbyVirtualMachinePoolRuntimeView", + "csharp" +); +@@clientName(StandbyVirtualMachinePoolRuntimeViewResourceProperties, + "StandbyVirtualMachinePoolRuntimeViewProperties", + "csharp" +); +@@clientName(VirtualMachineInstanceCountSummary, + "StandbyVirtualMachineInstanceCountSummary", + "csharp" +); +@@clientName(ProvisioningState, "StandbyProvisioningState", "csharp"); +@@clientName(RefillPolicy, "StandbyRefillPolicy", "csharp"); diff --git a/specification/standbypool/StandbyPool.Management/standbyContainerGroupPool.tsp b/specification/standbypool/StandbyPool.Management/standbyContainerGroupPool.tsp index c816fe4e0188..1974d21be724 100644 --- a/specification/standbypool/StandbyPool.Management/standbyContainerGroupPool.tsp +++ b/specification/standbypool/StandbyPool.Management/standbyContainerGroupPool.tsp @@ -113,6 +113,7 @@ interface StandbyContainerGroupPools { LroHeaders = Azure.Core.Foundations.RetryAfterHeader >; delete is ArmResourceDeleteWithoutOkAsync; + @parameterVisibility update is ArmCustomPatchSync< StandbyContainerGroupPoolResource, Azure.ResourceManager.Foundations.ResourceUpdateModel< diff --git a/specification/standbypool/StandbyPool.Management/standbyVM.tsp b/specification/standbypool/StandbyPool.Management/standbyVM.tsp index e36d61163002..00b7728b145b 100644 --- a/specification/standbypool/StandbyPool.Management/standbyVM.tsp +++ b/specification/standbypool/StandbyPool.Management/standbyVM.tsp @@ -35,7 +35,7 @@ model StandbyVirtualMachineResource @doc("Details of the StandbyVirtualMachine.") model StandbyVirtualMachineResourceProperties { @doc("Resource id of the virtual machine.") - virtualMachineResourceId: string; + virtualMachineResourceId: Azure.Core.armResourceIdentifier<[]>; @doc("The status of the last operation.") @visibility("read") diff --git a/specification/standbypool/StandbyPool.Management/standbyVMPool.tsp b/specification/standbypool/StandbyPool.Management/standbyVMPool.tsp index 7c11e5621381..1f2199b265a8 100644 --- a/specification/standbypool/StandbyPool.Management/standbyVMPool.tsp +++ b/specification/standbypool/StandbyPool.Management/standbyVMPool.tsp @@ -90,6 +90,7 @@ interface StandbyVirtualMachinePools { LroHeaders = Azure.Core.Foundations.RetryAfterHeader >; delete is ArmResourceDeleteWithoutOkAsync; + @parameterVisibility update is ArmCustomPatchSync< StandbyVirtualMachinePoolResource, Azure.ResourceManager.Foundations.ResourceUpdateModel< diff --git a/specification/standbypool/StandbyPool.Management/tspconfig.yaml b/specification/standbypool/StandbyPool.Management/tspconfig.yaml index c7906c08be93..99b16d298b7d 100644 --- a/specification/standbypool/StandbyPool.Management/tspconfig.yaml +++ b/specification/standbypool/StandbyPool.Management/tspconfig.yaml @@ -25,3 +25,8 @@ options: namespace: "com.azure.resourcemanager.standbypool" service-name: "Standby Pool" examples-directory: "{project-root}/examples" + "@azure-tools/typespec-csharp": + package-dir: "Azure.ResourceManager.StandbyPool" + flavor: azure + clear-output-folder: true + namespace: "{package-dir}" diff --git a/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/standbypool.json b/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/standbypool.json index 3af5c525dd59..4badaff23a33 100644 --- a/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/standbypool.json +++ b/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/standbypool.json @@ -847,29 +847,6 @@ "id" ] }, - "ContainerGroupProfileUpdate": { - "type": "object", - "description": "Details of the ContainerGroupProfile.", - "properties": { - "id": { - "type": "string", - "format": "arm-id", - "description": "Specifies container group profile id of standby container groups.", - "x-ms-arm-id-details": { - "allowedResources": [ - { - "type": "Microsoft.ContainerInstance/containerGroupProfiles" - } - ] - } - }, - "revision": { - "type": "integer", - "format": "int64", - "description": "Specifies revision of container group profile." - } - } - }, "ContainerGroupProperties": { "type": "object", "description": "Details of the ContainerGroupProperties.", @@ -890,23 +867,6 @@ "containerGroupProfile" ] }, - "ContainerGroupPropertiesUpdate": { - "type": "object", - "description": "Details of the ContainerGroupProperties.", - "properties": { - "containerGroupProfile": { - "$ref": "#/definitions/ContainerGroupProfileUpdate", - "description": "Specifies container group profile of standby container groups." - }, - "subnetIds": { - "type": "array", - "description": "Specifies subnet Ids for container group.", - "items": { - "$ref": "#/definitions/Subnet" - } - } - } - }, "ProvisioningState": { "type": "string", "description": "Provisioning state", @@ -982,23 +942,6 @@ "maxReadyCapacity" ] }, - "StandbyContainerGroupPoolElasticityProfileUpdate": { - "type": "object", - "description": "Specifies the elasticity profile of the standby container group pools.", - "properties": { - "maxReadyCapacity": { - "type": "integer", - "format": "int64", - "description": "Specifies maximum number of standby container groups in the standby pool.", - "minimum": 0, - "maximum": 2000 - }, - "refillPolicy": { - "$ref": "#/definitions/RefillPolicy", - "description": "Specifies refill policy of the pool." - } - } - }, "StandbyContainerGroupPoolResource": { "type": "object", "description": "A StandbyContainerGroupPoolResource.", @@ -1082,11 +1025,11 @@ "description": "The updatable properties of the StandbyContainerGroupPoolResource.", "properties": { "elasticityProfile": { - "$ref": "#/definitions/StandbyContainerGroupPoolElasticityProfileUpdate", + "$ref": "#/definitions/StandbyContainerGroupPoolElasticityProfile", "description": "Specifies elasticity profile of standby container group pools." }, "containerGroupProperties": { - "$ref": "#/definitions/ContainerGroupPropertiesUpdate", + "$ref": "#/definitions/ContainerGroupProperties", "description": "Specifies container group properties of standby container group pools." } } @@ -1107,19 +1050,6 @@ "maxReadyCapacity" ] }, - "StandbyVirtualMachinePoolElasticityProfileUpdate": { - "type": "object", - "description": "Details of the elasticity profile.", - "properties": { - "maxReadyCapacity": { - "type": "integer", - "format": "int64", - "description": "Specifies the maximum number of virtual machines in the standby virtual machine pool.", - "minimum": 0, - "maximum": 2000 - } - } - }, "StandbyVirtualMachinePoolResource": { "type": "object", "description": "A StandbyVirtualMachinePoolResource.", @@ -1217,7 +1147,7 @@ "description": "The updatable properties of the StandbyVirtualMachinePoolResource.", "properties": { "elasticityProfile": { - "$ref": "#/definitions/StandbyVirtualMachinePoolElasticityProfileUpdate", + "$ref": "#/definitions/StandbyVirtualMachinePoolElasticityProfile", "description": "Specifies the elasticity profile of the standby virtual machine pools." }, "virtualMachineState": { @@ -1284,7 +1214,11 @@ "properties": { "virtualMachineResourceId": { "type": "string", - "description": "Resource id of the virtual machine." + "format": "arm-id", + "description": "Resource id of the virtual machine.", + "x-ms-arm-id-details": { + "allowedResources": [] + } }, "provisioningState": { "$ref": "#/definitions/ProvisioningState", diff --git a/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2024-03-01-preview/standbypool.json b/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2024-03-01-preview/standbypool.json index f7887cdea6bd..2541265e1c57 100644 --- a/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2024-03-01-preview/standbypool.json +++ b/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2024-03-01-preview/standbypool.json @@ -1082,29 +1082,6 @@ "id" ] }, - "ContainerGroupProfileUpdate": { - "type": "object", - "description": "Details of the ContainerGroupProfile.", - "properties": { - "id": { - "type": "string", - "format": "arm-id", - "description": "Specifies container group profile id of standby container groups.", - "x-ms-arm-id-details": { - "allowedResources": [ - { - "type": "Microsoft.ContainerInstance/containerGroupProfiles" - } - ] - } - }, - "revision": { - "type": "integer", - "format": "int64", - "description": "Specifies revision of container group profile." - } - } - }, "ContainerGroupProperties": { "type": "object", "description": "Details of the ContainerGroupProperties.", @@ -1125,23 +1102,6 @@ "containerGroupProfile" ] }, - "ContainerGroupPropertiesUpdate": { - "type": "object", - "description": "Details of the ContainerGroupProperties.", - "properties": { - "containerGroupProfile": { - "$ref": "#/definitions/ContainerGroupProfileUpdate", - "description": "Specifies container group profile of standby container groups." - }, - "subnetIds": { - "type": "array", - "description": "Specifies subnet Ids for container group.", - "items": { - "$ref": "#/definitions/Subnet" - } - } - } - }, "PoolResourceStateCount": { "type": "object", "description": "Displays the counts of pooled resources in each state, as known by the StandbyPool resource provider.", @@ -1236,23 +1196,6 @@ "maxReadyCapacity" ] }, - "StandbyContainerGroupPoolElasticityProfileUpdate": { - "type": "object", - "description": "Specifies the elasticity profile of the standby container group pools.", - "properties": { - "maxReadyCapacity": { - "type": "integer", - "format": "int64", - "description": "Specifies maximum number of standby container groups in the standby pool.", - "minimum": 0, - "maximum": 2000 - }, - "refillPolicy": { - "$ref": "#/definitions/RefillPolicy", - "description": "Specifies refill policy of the pool." - } - } - }, "StandbyContainerGroupPoolResource": { "type": "object", "description": "A StandbyContainerGroupPoolResource.", @@ -1336,11 +1279,11 @@ "description": "The updatable properties of the StandbyContainerGroupPoolResource.", "properties": { "elasticityProfile": { - "$ref": "#/definitions/StandbyContainerGroupPoolElasticityProfileUpdate", + "$ref": "#/definitions/StandbyContainerGroupPoolElasticityProfile", "description": "Specifies elasticity profile of standby container group pools." }, "containerGroupProperties": { - "$ref": "#/definitions/ContainerGroupPropertiesUpdate", + "$ref": "#/definitions/ContainerGroupProperties", "description": "Specifies container group properties of standby container group pools." } } @@ -1428,26 +1371,6 @@ "maxReadyCapacity" ] }, - "StandbyVirtualMachinePoolElasticityProfileUpdate": { - "type": "object", - "description": "Details of the elasticity profile.", - "properties": { - "maxReadyCapacity": { - "type": "integer", - "format": "int64", - "description": "Specifies the maximum number of virtual machines in the standby virtual machine pool.", - "minimum": 0, - "maximum": 2000 - }, - "minReadyCapacity": { - "type": "integer", - "format": "int64", - "description": "Specifies the desired minimum number of virtual machines in the standby virtual machine pool. MinReadyCapacity cannot exceed MaxReadyCapacity.", - "minimum": 0, - "maximum": 2000 - } - } - }, "StandbyVirtualMachinePoolResource": { "type": "object", "description": "A StandbyVirtualMachinePoolResource.", @@ -1545,7 +1468,7 @@ "description": "The updatable properties of the StandbyVirtualMachinePoolResource.", "properties": { "elasticityProfile": { - "$ref": "#/definitions/StandbyVirtualMachinePoolElasticityProfileUpdate", + "$ref": "#/definitions/StandbyVirtualMachinePoolElasticityProfile", "description": "Specifies the elasticity profile of the standby virtual machine pools." }, "virtualMachineState": { @@ -1672,7 +1595,11 @@ "properties": { "virtualMachineResourceId": { "type": "string", - "description": "Resource id of the virtual machine." + "format": "arm-id", + "description": "Resource id of the virtual machine.", + "x-ms-arm-id-details": { + "allowedResources": [] + } }, "provisioningState": { "$ref": "#/definitions/ProvisioningState", diff --git a/specification/standbypool/resource-manager/Microsoft.StandbyPool/stable/2024-03-01/standbypool.json b/specification/standbypool/resource-manager/Microsoft.StandbyPool/stable/2024-03-01/standbypool.json index 98614b242ead..298062f9bd15 100644 --- a/specification/standbypool/resource-manager/Microsoft.StandbyPool/stable/2024-03-01/standbypool.json +++ b/specification/standbypool/resource-manager/Microsoft.StandbyPool/stable/2024-03-01/standbypool.json @@ -1082,29 +1082,6 @@ "id" ] }, - "ContainerGroupProfileUpdate": { - "type": "object", - "description": "Details of the ContainerGroupProfile.", - "properties": { - "id": { - "type": "string", - "format": "arm-id", - "description": "Specifies container group profile id of standby container groups.", - "x-ms-arm-id-details": { - "allowedResources": [ - { - "type": "Microsoft.ContainerInstance/containerGroupProfiles" - } - ] - } - }, - "revision": { - "type": "integer", - "format": "int64", - "description": "Specifies revision of container group profile." - } - } - }, "ContainerGroupProperties": { "type": "object", "description": "Details of the ContainerGroupProperties.", @@ -1125,23 +1102,6 @@ "containerGroupProfile" ] }, - "ContainerGroupPropertiesUpdate": { - "type": "object", - "description": "Details of the ContainerGroupProperties.", - "properties": { - "containerGroupProfile": { - "$ref": "#/definitions/ContainerGroupProfileUpdate", - "description": "Specifies container group profile of standby container groups." - }, - "subnetIds": { - "type": "array", - "description": "Specifies subnet Ids for container group.", - "items": { - "$ref": "#/definitions/Subnet" - } - } - } - }, "PoolResourceStateCount": { "type": "object", "description": "Displays the counts of pooled resources in each state, as known by the StandbyPool resource provider.", @@ -1236,23 +1196,6 @@ "maxReadyCapacity" ] }, - "StandbyContainerGroupPoolElasticityProfileUpdate": { - "type": "object", - "description": "Specifies the elasticity profile of the standby container group pools.", - "properties": { - "maxReadyCapacity": { - "type": "integer", - "format": "int64", - "description": "Specifies maximum number of standby container groups in the standby pool.", - "minimum": 0, - "maximum": 2000 - }, - "refillPolicy": { - "$ref": "#/definitions/RefillPolicy", - "description": "Specifies refill policy of the pool." - } - } - }, "StandbyContainerGroupPoolResource": { "type": "object", "description": "A StandbyContainerGroupPoolResource.", @@ -1336,11 +1279,11 @@ "description": "The updatable properties of the StandbyContainerGroupPoolResource.", "properties": { "elasticityProfile": { - "$ref": "#/definitions/StandbyContainerGroupPoolElasticityProfileUpdate", + "$ref": "#/definitions/StandbyContainerGroupPoolElasticityProfile", "description": "Specifies elasticity profile of standby container group pools." }, "containerGroupProperties": { - "$ref": "#/definitions/ContainerGroupPropertiesUpdate", + "$ref": "#/definitions/ContainerGroupProperties", "description": "Specifies container group properties of standby container group pools." } } @@ -1428,26 +1371,6 @@ "maxReadyCapacity" ] }, - "StandbyVirtualMachinePoolElasticityProfileUpdate": { - "type": "object", - "description": "Details of the elasticity profile.", - "properties": { - "maxReadyCapacity": { - "type": "integer", - "format": "int64", - "description": "Specifies the maximum number of virtual machines in the standby virtual machine pool.", - "minimum": 0, - "maximum": 2000 - }, - "minReadyCapacity": { - "type": "integer", - "format": "int64", - "description": "Specifies the desired minimum number of virtual machines in the standby virtual machine pool. MinReadyCapacity cannot exceed MaxReadyCapacity.", - "minimum": 0, - "maximum": 2000 - } - } - }, "StandbyVirtualMachinePoolResource": { "type": "object", "description": "A StandbyVirtualMachinePoolResource.", @@ -1545,7 +1468,7 @@ "description": "The updatable properties of the StandbyVirtualMachinePoolResource.", "properties": { "elasticityProfile": { - "$ref": "#/definitions/StandbyVirtualMachinePoolElasticityProfileUpdate", + "$ref": "#/definitions/StandbyVirtualMachinePoolElasticityProfile", "description": "Specifies the elasticity profile of the standby virtual machine pools." }, "virtualMachineState": { @@ -1672,7 +1595,11 @@ "properties": { "virtualMachineResourceId": { "type": "string", - "description": "Resource id of the virtual machine." + "format": "arm-id", + "description": "Resource id of the virtual machine.", + "x-ms-arm-id-details": { + "allowedResources": [] + } }, "provisioningState": { "$ref": "#/definitions/ProvisioningState",