From e0d76aee934fcb28a8c33f31ed7e79a126b9e5ab Mon Sep 17 00:00:00 2001 From: jing-song <37168047+Jing-song@users.noreply.github.com> Date: Wed, 23 Aug 2023 16:56:31 +0800 Subject: [PATCH 1/2] ppg type --- .../azure/cli/command_modules/vm/_params.py | 2 +- .../azure/cli/command_modules/vm/custom.py | 13 +- .../test_proximity_placement_group.yaml | 370 ++++++++++-------- .../vm/tests/latest/test_vm_commands.py | 9 +- 4 files changed, 227 insertions(+), 167 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/vm/_params.py b/src/azure-cli/azure/cli/command_modules/vm/_params.py index f97896afe7c..3fd2bd98df3 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/_params.py +++ b/src/azure-cli/azure/cli/command_modules/vm/_params.py @@ -1454,12 +1454,12 @@ def load_arguments(self, _): c.argument('proximity_placement_group_name', arg_type=name_arg_type, help="The name of the proximity placement group.") with self.argument_context('ppg create') as c: - c.argument('ppg_type', options_list=['--type', '-t'], min_api='2018-04-01', help="The type of the proximity placement group. Allowed values: Standard.") c.argument('tags', tags_type, min_api='2018-04-01') c.argument('zone', zone_type, min_api='2021-11-01') for scope in ['ppg create', 'ppg update']: with self.argument_context(scope) as c: + c.argument('ppg_type', options_list=['--type', '-t'], arg_type=get_enum_type(self.get_models('ProximityPlacementGroupType')), min_api='2018-04-01', help="The type of the proximity placement group.") c.argument('intent_vm_sizes', nargs='*', min_api='2021-11-01', help="Specify possible sizes of virtual machines that can be created in the proximity placement group.") for scope, item in [('vm create', 'VM'), ('vmss create', 'VMSS'), diff --git a/src/azure-cli/azure/cli/command_modules/vm/custom.py b/src/azure-cli/azure/cli/command_modules/vm/custom.py index ab83adf066b..9970d057223 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/custom.py +++ b/src/azure-cli/azure/cli/command_modules/vm/custom.py @@ -4944,16 +4944,9 @@ def update_image_version(cmd, resource_group_name, gallery_name, gallery_image_n # region proximity placement groups def create_proximity_placement_group(cmd, client, proximity_placement_group_name, resource_group_name, ppg_type=None, location=None, tags=None, zone=None, intent_vm_sizes=None): - from knack.arguments import CaseInsensitiveList location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name) - - ProximityPlacementGroup, PPGType = cmd.get_models('ProximityPlacementGroup', 'ProximityPlacementGroupType') - choices = CaseInsensitiveList([x.value for x in PPGType]) - - if ppg_type and ppg_type not in choices: - logger.info("Valid choices: %s", str(choices)) - raise CLIError("Usage error: invalid value for --type/-t") + ProximityPlacementGroup = cmd.get_models('ProximityPlacementGroup') ppg_params = ProximityPlacementGroup(name=proximity_placement_group_name, proximity_placement_group_type=ppg_type, location=location, tags=(tags or {}), zones=zone) @@ -4967,11 +4960,13 @@ def create_proximity_placement_group(cmd, client, proximity_placement_group_name proximity_placement_group_name=proximity_placement_group_name, parameters=ppg_params) -def update_ppg(cmd, instance, intent_vm_sizes=None): +def update_ppg(cmd, instance, intent_vm_sizes=None, ppg_type=None): if intent_vm_sizes: Intent = cmd.get_models('ProximityPlacementGroupPropertiesIntent') intent = Intent(vm_sizes=intent_vm_sizes) instance.intent = intent + if ppg_type: + instance.proximity_placement_group_type = ppg_type return instance diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_proximity_placement_group.yaml b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_proximity_placement_group.yaml index 0ac47cf6fcb..8bf4a2110c9 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_proximity_placement_group.yaml +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_proximity_placement_group.yaml @@ -1,47 +1,4 @@ interactions: -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - ppg create - Connection: - - keep-alive - ParameterSetName: - - -n -g -t - User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_ppg_cmds_000001?api-version=2022-09-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001","name":"cli_test_ppg_cmds_000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2023-05-25T22:23:14Z"},"properties":{"provisioningState":"Succeeded"}}' - headers: - cache-control: - - no-cache - content-length: - - '326' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 25 May 2023 22:23:14 GMT - expires: - - '-1' - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK - request: body: null headers: @@ -56,22 +13,21 @@ interactions: ParameterSetName: - -n -t -g User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_ppg_cmds_000001?api-version=2022-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001","name":"cli_test_ppg_cmds_000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2023-05-25T22:23:14Z"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001","name":"cli_test_ppg_cmds_000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","test":"test_proximity_placement_group","date":"2023-08-23T08:48:51Z","module":"vm"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '326' + - '380' content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:15 GMT + - Wed, 23 Aug 2023 08:48:52 GMT expires: - '-1' pragma: @@ -87,7 +43,7 @@ interactions: message: OK - request: body: '{"location": "westus", "tags": {}, "properties": {"proximityPlacementGroupType": - "StandarD"}}' + "Standard"}}' headers: Accept: - application/json @@ -104,16 +60,15 @@ interactions: ParameterSetName: - -n -t -g User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-compute/29.1.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-compute/30.0.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_1?api-version=2022-11-01 response: body: - string: "{\r\n \"name\": \"my_ppg_1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_1\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\": - \"Standard\"\r\n }\r\n}" + string: "{\r\n \"name\": \"my_ppg_1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_1\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\"\ + : \"Standard\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -122,7 +77,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:20 GMT + - Wed, 23 Aug 2023 08:48:58 GMT expires: - '-1' pragma: @@ -135,9 +90,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/PutDeletePPG3Min;97,Microsoft.Compute/PutDeletePPG30Min;495 + - Microsoft.Compute/PutDeletePPG3Min;97,Microsoft.Compute/PutDeletePPG30Min;491 x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 201 message: Created @@ -155,20 +110,19 @@ interactions: ParameterSetName: - -g -n --include-colocation-status User-Agent: - - AZURECLI/2.47.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_1?includeColocationStatus=True&api-version=2022-11-01 response: body: - string: "{\r\n \"name\": \"my_ppg_1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_1\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\": - \"Standard\",\r\n \"virtualMachines\": [],\r\n \"virtualMachineScaleSets\": - [],\r\n \"availabilitySets\": [],\r\n \"colocationStatus\": {\r\n \"code\": - \"ColocationStatus/Aligned\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": - \"Aligned\",\r\n \"message\": \"All resources in the proximity placement - group are aligned.\"\r\n }\r\n }\r\n}" + string: "{\r\n \"name\": \"my_ppg_1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_1\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\"\ + : \"Standard\",\r\n \"virtualMachines\": [],\r\n \"virtualMachineScaleSets\"\ + : [],\r\n \"availabilitySets\": [],\r\n \"colocationStatus\": {\r\n\ + \ \"code\": \"ColocationStatus/Aligned\",\r\n \"level\": \"Info\"\ + ,\r\n \"displayStatus\": \"Aligned\",\r\n \"message\": \"All resources\ + \ in the proximity placement group are aligned.\"\r\n }\r\n }\r\n}" headers: cache-control: - no-cache @@ -177,7 +131,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:20 GMT + - Wed, 23 Aug 2023 08:48:59 GMT expires: - '-1' pragma: @@ -194,7 +148,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/HighCostGet3Min;134,Microsoft.Compute/HighCostGet30Min;691 + - Microsoft.Compute/HighCostGet3Min;137,Microsoft.Compute/HighCostGet30Min;694 status: code: 200 message: OK @@ -212,22 +166,21 @@ interactions: ParameterSetName: - -n -t -g User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_ppg_cmds_000001?api-version=2022-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001","name":"cli_test_ppg_cmds_000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2023-05-25T22:23:14Z"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001","name":"cli_test_ppg_cmds_000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","test":"test_proximity_placement_group","date":"2023-08-23T08:48:51Z","module":"vm"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '326' + - '380' content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:20 GMT + - Wed, 23 Aug 2023 08:49:00 GMT expires: - '-1' pragma: @@ -260,16 +213,15 @@ interactions: ParameterSetName: - -n -t -g User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-compute/29.1.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-compute/30.0.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_2?api-version=2022-11-01 response: body: - string: "{\r\n \"name\": \"my_ppg_2\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_2\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\": - \"Standard\"\r\n }\r\n}" + string: "{\r\n \"name\": \"my_ppg_2\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_2\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\"\ + : \"Standard\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -278,7 +230,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:21 GMT + - Wed, 23 Aug 2023 08:49:07 GMT expires: - '-1' pragma: @@ -291,9 +243,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/PutDeletePPG3Min;95,Microsoft.Compute/PutDeletePPG30Min;493 + - Microsoft.Compute/PutDeletePPG3Min;96,Microsoft.Compute/PutDeletePPG30Min;490 x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1199' status: code: 201 message: Created @@ -311,22 +263,21 @@ interactions: ParameterSetName: - -n -g User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_ppg_cmds_000001?api-version=2022-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001","name":"cli_test_ppg_cmds_000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2023-05-25T22:23:14Z"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001","name":"cli_test_ppg_cmds_000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","test":"test_proximity_placement_group","date":"2023-08-23T08:48:51Z","module":"vm"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '326' + - '380' content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:22 GMT + - Wed, 23 Aug 2023 08:49:06 GMT expires: - '-1' pragma: @@ -358,16 +309,15 @@ interactions: ParameterSetName: - -n -g User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-compute/29.1.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-compute/30.0.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3?api-version=2022-11-01 response: body: - string: "{\r\n \"name\": \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\": - \"Standard\"\r\n }\r\n}" + string: "{\r\n \"name\": \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\"\ + : \"Standard\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -376,7 +326,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:24 GMT + - Wed, 23 Aug 2023 08:49:12 GMT expires: - '-1' pragma: @@ -389,12 +339,124 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/PutDeletePPG3Min;94,Microsoft.Compute/PutDeletePPG30Min;492 + - Microsoft.Compute/PutDeletePPG3Min;95,Microsoft.Compute/PutDeletePPG30Min;489 x-ms-ratelimit-remaining-subscription-writes: - '1199' status: code: 201 message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - ppg update + Connection: + - keep-alive + ParameterSetName: + - -n -g -t + User-Agent: + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-compute/30.0.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3?api-version=2022-11-01 + response: + body: + string: "{\r\n \"name\": \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\"\ + : \"Standard\",\r\n \"virtualMachines\": [],\r\n \"virtualMachineScaleSets\"\ + : [],\r\n \"availabilitySets\": []\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '454' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 08:49:13 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/HighCostGet3Min;136,Microsoft.Compute/HighCostGet30Min;693 + status: + code: 200 + message: OK +- request: + body: '{"location": "westus", "tags": {}, "properties": {"proximityPlacementGroupType": + "Standard"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - ppg update + Connection: + - keep-alive + Content-Length: + - '93' + Content-Type: + - application/json + ParameterSetName: + - -n -g -t + User-Agent: + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-compute/30.0.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3?api-version=2022-11-01 + response: + body: + string: "{\r\n \"name\": \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\"\ + : \"Standard\"\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '361' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 08:49:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/PutDeletePPG3Min;94,Microsoft.Compute/PutDeletePPG30Min;488 + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK - request: body: null headers: @@ -409,28 +471,30 @@ interactions: ParameterSetName: - -g User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-compute/29.1.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-compute/30.0.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups?api-version=2022-11-01 response: body: - string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"my_ppg_1\",\r\n \"id\": - \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_1\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\": - \"Standard\",\r\n \"virtualMachines\": [],\r\n \"virtualMachineScaleSets\": - [],\r\n \"availabilitySets\": []\r\n }\r\n },\r\n {\r\n - \ \"name\": \"my_ppg_2\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_2\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\": - \"Standard\",\r\n \"virtualMachines\": [],\r\n \"virtualMachineScaleSets\": - [],\r\n \"availabilitySets\": []\r\n }\r\n },\r\n {\r\n - \ \"name\": \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\": - \"Standard\",\r\n \"virtualMachines\": [],\r\n \"virtualMachineScaleSets\": - [],\r\n \"availabilitySets\": []\r\n }\r\n }\r\n ]\r\n}" + string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"my_ppg_1\",\r\n \ + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_1\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \ + \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\"\ + : {\r\n \"proximityPlacementGroupType\": \"Standard\",\r\n \"\ + virtualMachines\": [],\r\n \"virtualMachineScaleSets\": [],\r\n \ + \ \"availabilitySets\": []\r\n }\r\n },\r\n {\r\n \"name\"\ + : \"my_ppg_2\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_2\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \ + \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\"\ + : {\r\n \"proximityPlacementGroupType\": \"Standard\",\r\n \"\ + virtualMachines\": [],\r\n \"virtualMachineScaleSets\": [],\r\n \ + \ \"availabilitySets\": []\r\n }\r\n },\r\n {\r\n \"name\"\ + : \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \ + \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\"\ + : {\r\n \"proximityPlacementGroupType\": \"Standard\",\r\n \"\ + virtualMachines\": [],\r\n \"virtualMachineScaleSets\": [],\r\n \ + \ \"availabilitySets\": []\r\n }\r\n }\r\n ]\r\n}" headers: cache-control: - no-cache @@ -439,7 +503,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:25 GMT + - Wed, 23 Aug 2023 08:49:17 GMT expires: - '-1' pragma: @@ -456,7 +520,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3987,Microsoft.Compute/LowCostGet30Min;31979 + - Microsoft.Compute/LowCostGet3Min;3999,Microsoft.Compute/LowCostGet30Min;31997 status: code: 200 message: OK @@ -476,8 +540,7 @@ interactions: ParameterSetName: - -n -g User-Agent: - - AZURECLI/2.47.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_1?api-version=2022-11-01 response: @@ -489,7 +552,7 @@ interactions: content-length: - '0' date: - - Thu, 25 May 2023 22:23:26 GMT + - Wed, 23 Aug 2023 08:49:22 GMT expires: - '-1' pragma: @@ -502,7 +565,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/PutDeletePPG3Min;93,Microsoft.Compute/PutDeletePPG30Min;491 + - Microsoft.Compute/PutDeletePPG3Min;93,Microsoft.Compute/PutDeletePPG30Min;487 x-ms-ratelimit-remaining-subscription-deletes: - '14999' status: @@ -522,23 +585,24 @@ interactions: ParameterSetName: - -g User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-compute/29.1.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-compute/30.0.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups?api-version=2022-11-01 response: body: - string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"my_ppg_2\",\r\n \"id\": - \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_2\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\": - \"Standard\",\r\n \"virtualMachines\": [],\r\n \"virtualMachineScaleSets\": - [],\r\n \"availabilitySets\": []\r\n }\r\n },\r\n {\r\n - \ \"name\": \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\": - \"Standard\",\r\n \"virtualMachines\": [],\r\n \"virtualMachineScaleSets\": - [],\r\n \"availabilitySets\": []\r\n }\r\n }\r\n ]\r\n}" + string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"my_ppg_2\",\r\n \ + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_2\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \ + \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\"\ + : {\r\n \"proximityPlacementGroupType\": \"Standard\",\r\n \"\ + virtualMachines\": [],\r\n \"virtualMachineScaleSets\": [],\r\n \ + \ \"availabilitySets\": []\r\n }\r\n },\r\n {\r\n \"name\"\ + : \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \ + \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\"\ + : {\r\n \"proximityPlacementGroupType\": \"Standard\",\r\n \"\ + virtualMachines\": [],\r\n \"virtualMachineScaleSets\": [],\r\n \ + \ \"availabilitySets\": []\r\n }\r\n }\r\n ]\r\n}" headers: cache-control: - no-cache @@ -547,7 +611,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:26 GMT + - Wed, 23 Aug 2023 08:49:24 GMT expires: - '-1' pragma: @@ -564,7 +628,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3986,Microsoft.Compute/LowCostGet30Min;31978 + - Microsoft.Compute/LowCostGet3Min;3998,Microsoft.Compute/LowCostGet30Min;31996 status: code: 200 message: OK @@ -582,17 +646,16 @@ interactions: ParameterSetName: - -n -g --set User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-compute/29.1.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-compute/30.0.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3?api-version=2022-11-01 response: body: - string: "{\r\n \"name\": \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\": - \"Standard\",\r\n \"virtualMachines\": [],\r\n \"virtualMachineScaleSets\": - [],\r\n \"availabilitySets\": []\r\n }\r\n}" + string: "{\r\n \"name\": \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"proximityPlacementGroupType\"\ + : \"Standard\",\r\n \"virtualMachines\": [],\r\n \"virtualMachineScaleSets\"\ + : [],\r\n \"availabilitySets\": []\r\n }\r\n}" headers: cache-control: - no-cache @@ -601,7 +664,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:26 GMT + - Wed, 23 Aug 2023 08:49:26 GMT expires: - '-1' pragma: @@ -618,7 +681,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/HighCostGet3Min;133,Microsoft.Compute/HighCostGet30Min;690 + - Microsoft.Compute/HighCostGet3Min;135,Microsoft.Compute/HighCostGet30Min;692 status: code: 200 message: OK @@ -641,16 +704,15 @@ interactions: ParameterSetName: - -n -g --set User-Agent: - - AZURECLI/2.47.0 azsdk-python-azure-mgmt-compute/29.1.0 Python/3.10.11 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.31) - VSTS_7b238909-6802-4b65-b90d-184bca47f458_build_220_0 + - AZURECLI/2.51.0 azsdk-python-azure-mgmt-compute/30.0.0 Python/3.10.9 (Windows-10-10.0.22621-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3?api-version=2022-11-01 response: body: - string: "{\r\n \"name\": \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\",\r\n - \ \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\": - \"westus\",\r\n \"tags\": {\r\n \"foo\": \"bar\"\r\n },\r\n \"properties\": - {\r\n \"proximityPlacementGroupType\": \"Standard\"\r\n }\r\n}" + string: "{\r\n \"name\": \"my_ppg_3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_ppg_cmds_000001/providers/Microsoft.Compute/proximityPlacementGroups/my_ppg_3\"\ + ,\r\n \"type\": \"Microsoft.Compute/proximityPlacementGroups\",\r\n \"location\"\ + : \"westus\",\r\n \"tags\": {\r\n \"foo\": \"bar\"\r\n },\r\n \"properties\"\ + : {\r\n \"proximityPlacementGroupType\": \"Standard\"\r\n }\r\n}" headers: cache-control: - no-cache @@ -659,7 +721,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 25 May 2023 22:23:28 GMT + - Wed, 23 Aug 2023 08:49:29 GMT expires: - '-1' pragma: @@ -676,9 +738,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/PutDeletePPG3Min;92,Microsoft.Compute/PutDeletePPG30Min;490 + - Microsoft.Compute/PutDeletePPG3Min;92,Microsoft.Compute/PutDeletePPG30Min;486 x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 200 message: OK diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py index d47a99deb4c..61b6dceb38f 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py @@ -6721,9 +6721,6 @@ def test_proximity_placement_group(self, resource_group, resource_group_location 'loc': resource_group_location }) - # fails because not a valid type - self.cmd('ppg create -n fail_ppg -g {rg} -t notAvalidType', expect_failure=True) - self.cmd('ppg create -n {ppg1} -t StandarD -g {rg}', checks=[ self.check('name', '{ppg1}'), self.check('location', '{loc}'), @@ -6748,6 +6745,12 @@ def test_proximity_placement_group(self, resource_group, resource_group_location self.check('location', '{loc}'), ]) + self.cmd('ppg update -n {ppg3} -g {rg} -t Standard', checks=[ + self.check('name', '{ppg3}'), + self.check('location', '{loc}'), + self.check('proximityPlacementGroupType', 'Standard') + ]) + self.cmd('ppg list -g {rg}', checks=[ self.check('length(@)', 3) ]) From aee583e940490a0cd8d50639feda18b455f03d08 Mon Sep 17 00:00:00 2001 From: jing-song <37168047+Jing-song@users.noreply.github.com> Date: Wed, 23 Aug 2023 18:02:30 +0800 Subject: [PATCH 2/2] Update test_vm_commands.py --- .../vm/tests/hybrid_2020_09_01/test_vm_commands.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/test_vm_commands.py b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/test_vm_commands.py index 40f7fbf8959..31419c89c2f 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/test_vm_commands.py +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/test_vm_commands.py @@ -2065,9 +2065,6 @@ def test_proximity_placement_group(self, resource_group, resource_group_location 'loc': resource_group_location }) - # fails because not a valid type - self.cmd('ppg create -n fail_ppg -g {rg} -t notAvalidType', expect_failure=True) - self.cmd('ppg create -n {ppg1} -t StandarD -g {rg}', checks=[ self.check('name', '{ppg1}'), self.check('location', '{loc}'),