From 289d910d913666bd3f4169b4b213e124aba94317 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Mon, 21 Jun 2021 08:23:13 -0600 Subject: [PATCH 1/5] Add `az vmware global-reach-connection` command group --- src/vmware/CHANGELOG.md | 1 + src/vmware/azext_vmware/_help.py | 25 + src/vmware/azext_vmware/_params.py | 3 + src/vmware/azext_vmware/commands.py | 6 + src/vmware/azext_vmware/custom.py | 16 + .../test_vmware_global_reach_connection.yaml | 1375 +++++++++++++++++ .../test_global_reach_connection_scenario.py | 43 + 7 files changed, 1469 insertions(+) create mode 100644 src/vmware/azext_vmware/tests/latest/recordings/test_vmware_global_reach_connection.yaml create mode 100644 src/vmware/azext_vmware/tests/latest/test_global_reach_connection_scenario.py diff --git a/src/vmware/CHANGELOG.md b/src/vmware/CHANGELOG.md index afacacd5707..f78a788dfb5 100644 --- a/src/vmware/CHANGELOG.md +++ b/src/vmware/CHANGELOG.md @@ -11,6 +11,7 @@ Other changes: - Add `az vmware addon hcx` command group to manage a HCX addon - Add `az vmware addon srm` command group to manage a Site Recovery Manager (SRM) addon - Add `az vmware addon vr` command group to manage a vSphere Replication (VR) addon +- Add `az vmware global-reach-connection` command group to manage Global Reach Connections ## 2.0.1 (2021-02) - Update the minimum az cli version to 2.11.0 [#3045](https://github.com/Azure/azure-cli-extensions/issues/3045) diff --git a/src/vmware/azext_vmware/_help.py b/src/vmware/azext_vmware/_help.py index ecda202e798..b379c51302e 100644 --- a/src/vmware/azext_vmware/_help.py +++ b/src/vmware/azext_vmware/_help.py @@ -351,3 +351,28 @@ - name: Delete a Site Recovery Manager (SRM) addon. text: az vmware addon srm delete --resource-group MyResourceGroup --private-cloud MyPrivateCloud """ + +helps['vmware global-reach-connection'] = """ + type: group + short-summary: Commands to manage global reach connections in a private cloud. +""" + +helps['vmware global-reach-connection create'] = """ + type: command + short-summary: Create a global reach connection in a private cloud. +""" + +helps['vmware global-reach-connection list'] = """ + type: command + short-summary: List global reach connections in a private cloud. +""" + +helps['vmware global-reach-connection show'] = """ + type: command + short-summary: Show details of a global reach connection in a private cloud. +""" + +helps['vmware global-reach-connection delete'] = """ + type: command + short-summary: Delete a global reach connection in a private cloud. +""" \ No newline at end of file diff --git a/src/vmware/azext_vmware/_params.py b/src/vmware/azext_vmware/_params.py index c0119f22bef..8aba8ebc577 100644 --- a/src/vmware/azext_vmware/_params.py +++ b/src/vmware/azext_vmware/_params.py @@ -100,3 +100,6 @@ def load_arguments(self, _): with self.argument_context('vmware addon srm') as c: c.argument('license_key', help='The Site Recovery Manager (SRM) license.') + + with self.argument_context('vmware global-reach-connection') as c: + c.argument('name', options_list=['--name', '-n'], help='Name of the global reach connection.') diff --git a/src/vmware/azext_vmware/commands.py b/src/vmware/azext_vmware/commands.py index e47c3516b27..2d18e6a6ddf 100644 --- a/src/vmware/azext_vmware/commands.py +++ b/src/vmware/azext_vmware/commands.py @@ -80,3 +80,9 @@ def load_command_table(self, _): g.custom_show_command('show', 'addon_srm_show') g.custom_command('update', 'addon_srm_update') g.custom_command('delete', 'addon_srm_delete') + + with self.command_group('vmware global-reach-connection', vmware_sdk, client_factory=cf_vmware) as g: + g.custom_command('create', 'globalreachconnection_create') + g.custom_command('list', 'globalreachconnection_list') + g.custom_command('delete', 'globalreachconnection_delete') + g.custom_show_command('show', 'globalreachconnection_show') diff --git a/src/vmware/azext_vmware/custom.py b/src/vmware/azext_vmware/custom.py index 6b9e61100ea..e35b0926e1f 100644 --- a/src/vmware/azext_vmware/custom.py +++ b/src/vmware/azext_vmware/custom.py @@ -259,3 +259,19 @@ def addon_hcx_delete(cmd, client: AVSClient, resource_group_name, private_cloud) def addon_srm_delete(cmd, client: AVSClient, resource_group_name, private_cloud): return client.addons.begin_delete(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="srm") + + +def globalreachconnection_create(cmd, client: AVSClient, resource_group_name, private_cloud, name, authorization_key=None, peer_express_route_circuit=None): + return client.global_reach_connections.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, global_reach_connection_name=name, authorization_key=authorization_key, peer_express_route_circuit=peer_express_route_circuit) + + +def globalreachconnection_list(cmd, client: AVSClient, resource_group_name, private_cloud): + return client.global_reach_connections.list(resource_group_name=resource_group_name, private_cloud_name=private_cloud) + + +def globalreachconnection_show(cmd, client: AVSClient, resource_group_name, private_cloud, name): + return client.global_reach_connections.get(resource_group_name=resource_group_name, private_cloud_name=private_cloud, global_reach_connection_name=name) + + +def globalreachconnection_delete(cmd, client: AVSClient, resource_group_name, private_cloud, name): + return client.global_reach_connections.begin_delete(resource_group_name=resource_group_name, private_cloud_name=private_cloud, global_reach_connection_name=name) diff --git a/src/vmware/azext_vmware/tests/latest/recordings/test_vmware_global_reach_connection.yaml b/src/vmware/azext_vmware/tests/latest/recordings/test_vmware_global_reach_connection.yaml new file mode 100644 index 00000000000..bcb4b930092 --- /dev/null +++ b/src/vmware/azext_vmware/tests/latest/recordings/test_vmware_global_reach_connection.yaml @@ -0,0 +1,1375 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://localhost:8866/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff686d426-8d16-42db-81b7-ab578e110ccd%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f686d426-8d16-42db-81b7-ab578e110ccd/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:30:59 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AggNfcJuW3tOiJxsBRpkSYI; expires=Fri, 16-Jul-2021 18:30:59 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevriAnXvQ6vUu3Ms5jQYOeu8h_t65xEb_4IMH73ZPCXAiMdIhrBF7EbXq-fx433AolA-khFE1oscCXCDeumXk2HsRK7tSkXg2Um-plbzNdcFiHMK4TT2dZ27aztoIFPzB3YWy0HpDBUo6TwtG4PFIKuyXRuJ-ZxCSLjeMnJz-kmRwwgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11787.15 - EUS ProdSlices + status: + code: 200 + message: OK +- request: + body: '{"location": "westcentralus", "tags": {}, "sku": {"name": "av20"}, "properties": + {"managementCluster": {"clusterSize": 4}, "internet": "Disabled", "networkBlock": + "192.168.48.0/22", "vcenterPassword": "UpfBXae9ZquZSDXk(", "nsxtPassword": "5rqdLj4GF3cePUe6("}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + Content-Length: + - '259' + Content-Type: + - application/json + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1","location":"westcentralus","name":"cloud1","properties":{"endpoints":{"hcxCloudManager":"https://192.168.48.9/","nsxtManager":"https://192.168.48.3/","vcsa":"https://192.168.48.2/"},"externalCloudLinks":[],"identitySources":[],"internet":"Disabled","managementCluster":{"clusterId":1,"clusterSize":4,"hosts":["gp-fakehost32.mp01.mock01.vmcp.vs.management","gp-fakehost31.mp01.mock01.vmcp.vs.management","gp-fakehost35.mp01.mock01.vmcp.vs.management","gp-fakehost33.mp01.mock01.vmcp.vs.management"],"provisioningState":"Building"},"managementNetwork":"192.168.48.0/26","networkBlock":"192.168.48.0/22","provisioningNetwork":"192.168.50.0/25","provisioningState":"Building","vmotionNetwork":"192.168.49.128/25"},"sku":{"name":"av20"},"tags":{},"type":"Microsoft.AVS/privateClouds"}' + headers: + azure-asyncoperation: + - https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + cache-control: + - no-cache + content-length: + - '975' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:31:07 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-msedge-ref: + - 'Ref A: A48C421106D744FDBA74C2B83DA1AE66 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:31:02Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":0,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '385' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:31:17 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: A7F5055826E848CC89D63DABF7F730C5 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:31:18Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":0,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '385' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:31:28 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 5A2DF10B42C44F6195236E3A4DCC1C90 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:31:28Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":88.75,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '389' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:31:39 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 9A71AB1BF5C2492ABDBB0348E5FFD5E0 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:31:38Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":88.75,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '389' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:31:49 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: D513923D84424D05B0032411BB6ABC88 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:31:50Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":88.75,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '389' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:31:59 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: B8A1E952D01D49879789145F75E0C129 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:32:00Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":100,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '387' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:32:10 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 84C4A64855EC474186ABCD0875CC2273 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:32:10Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":100,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '387' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:32:20 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 2E594EDAC923487EB2E5C9EE3C86A857 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:32:21Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":100,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '387' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:32:30 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: D90EC2FF56D54E90A18D63F39E316C94 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:32:31Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":100,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '387' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:32:41 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 8701EDBA01F04A3BA737D1F08B3FD6C0 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:32:41Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":100,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '387' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:32:51 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 01C3BB0A447B4E549629883EDFCBB3FC Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:32:52Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":100,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '387' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:01 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: A9115CA3A4F14E3AB91D85EDAC99C0BC Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:33:02Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":100,"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Building"}' + headers: + cache-control: + - no-cache + content-length: + - '387' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:11 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: DDD84377BB76445F8AAC3A2CA47F6CB5 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:33:12Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef?api-version=2021-06-01 + response: + body: + string: '{"endTime":"2021-06-16T18:33:17.6247815+00:00","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/operationstatuses/a3970561-6113-45e9-80d3-36c4f8b70cef","name":"a3970561-6113-45e9-80d3-36c4f8b70cef","percentComplete":100,"properties":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1","location":"westcentralus","name":"cloud1","properties":{"circuit":{"expressRouteID":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt38-cust-mp01-mock01/providers/Microsoft.Network/expressRouteCircuits/tnt38-cust-mp01-mock01-er","expressRoutePrivatePeeringID":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt38-cust-mp01-mock01/providers/Microsoft.Network/expressRouteCircuits/tnt38-cust-mp01-mock01-er/peerings/AzurePrivatePeering","primarySubnet":"192.168.48.232/30","secondarySubnet":"192.168.48.236/30"},"endpoints":{"hcxCloudManager":"https://192.168.48.9/","nsxtManager":"https://192.168.48.3/","vcsa":"https://192.168.48.2/"},"externalCloudLinks":[],"identitySources":[],"internet":"Disabled","managementCluster":{"clusterId":1,"clusterSize":4,"hosts":["gp-fakehost32.mp01.mock01.vmcp.vs.management","gp-fakehost31.mp01.mock01.vmcp.vs.management","gp-fakehost35.mp01.mock01.vmcp.vs.management","gp-fakehost33.mp01.mock01.vmcp.vs.management"],"provisioningState":"Succeeded"},"managementNetwork":"192.168.48.0/26","networkBlock":"192.168.48.0/22","nsxtCertificateThumbprint":"B9A9474616752565A3FAF23E0A013ECE3DC8B8FF","provisioningNetwork":"192.168.50.0/25","provisioningState":"Succeeded","vcenterCertificateThumbprint":"BE8EA855AA13D9662A115571636B9B1925C6DB68","vmotionNetwork":"192.168.49.128/25"},"sku":{"name":"av20"},"tags":{},"type":"Microsoft.AVS/privateClouds"},"startTime":"2021-06-16T18:31:04.9031706+00:00","status":"Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '2067' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:22 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 7C13D211D3BB40F9A4308A9136E7723A Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:33:22Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware private-cloud create + Connection: + - keep-alive + ParameterSetName: + - -g -n --location --sku --cluster-size --network-block --nsxt-password --vcenter-password + --accept-eula + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1","location":"westcentralus","name":"cloud1","properties":{"circuit":{"expressRouteID":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt38-cust-mp01-mock01/providers/Microsoft.Network/expressRouteCircuits/tnt38-cust-mp01-mock01-er","expressRoutePrivatePeeringID":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt38-cust-mp01-mock01/providers/Microsoft.Network/expressRouteCircuits/tnt38-cust-mp01-mock01-er/peerings/AzurePrivatePeering","primarySubnet":"192.168.48.232/30","secondarySubnet":"192.168.48.236/30"},"endpoints":{"hcxCloudManager":"https://192.168.48.9/","nsxtManager":"https://192.168.48.3/","vcsa":"https://192.168.48.2/"},"externalCloudLinks":[],"identitySources":[],"internet":"Disabled","managementCluster":{"clusterId":1,"clusterSize":4,"hosts":["gp-fakehost32.mp01.mock01.vmcp.vs.management","gp-fakehost31.mp01.mock01.vmcp.vs.management","gp-fakehost35.mp01.mock01.vmcp.vs.management","gp-fakehost33.mp01.mock01.vmcp.vs.management"],"provisioningState":"Succeeded"},"managementNetwork":"192.168.48.0/26","networkBlock":"192.168.48.0/22","nsxtCertificateThumbprint":"B9A9474616752565A3FAF23E0A013ECE3DC8B8FF","provisioningNetwork":"192.168.50.0/25","provisioningState":"Succeeded","vcenterCertificateThumbprint":"BE8EA855AA13D9662A115571636B9B1925C6DB68","vmotionNetwork":"192.168.49.128/25"},"sku":{"name":"av20"},"tags":{},"type":"Microsoft.AVS/privateClouds"}' + headers: + cache-control: + - no-cache + content-length: + - '1619' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:22 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 22021F46B3334A2BAA1AF96537D01351 Ref B: LAXEDGE1414 Ref C: 2021-06-16T18:33:23Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://localhost:8866/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff686d426-8d16-42db-81b7-ab578e110ccd%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f686d426-8d16-42db-81b7-ab578e110ccd/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:25 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=An35iydOw-1LloiYBalnmAI; expires=Fri, 16-Jul-2021 18:33:26 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr_vrnxMBtaeFjr-Ht_9jFZ6pHW2I4qCmotPnAfjGN6CrgJCTM2U5UTRPI1sEdSuCWi_jN6tae2uRLgkZGDrWiW28T96Ee57oXA5ZimwXlvI3xJ9F_bxRQIip8Jr2fkwnypXXWKwfE5gq-rcCy1TnQpRpZ7DnmP2_jPGLDE5sKjQogAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11829.4 - WUS2 ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware global-reach-connection list + Connection: + - keep-alive + ParameterSetName: + - -g -c + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections?api-version=2021-06-01 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:29 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 5DD6EED41276432FA4C7ED7B9A4BA1A5 Ref B: LAXEDGE1313 Ref C: 2021-06-16T18:33:29Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://localhost:8866/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff686d426-8d16-42db-81b7-ab578e110ccd%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f686d426-8d16-42db-81b7-ab578e110ccd/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:32 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=Av0lksS2butIkMfRSiyWHtY; expires=Fri, 16-Jul-2021 18:33:32 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevryDCxNBU4JwAYX2vzxpCFH5mTR5SA6XPJnx9mTKUKzzPpjP684jOue7hkpZI9yRptZfBE9yKCq3hLAS3eXofry7b-Q974Vtjh7HLrc9CF5VeSEfQjUVqtyr1f0K6g2clUMFe4GX5Lj4zTHiwLSfRStYaP4QiAFQyXqx8Eciwc7ysgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11787.15 - SCUS ProdSlices + status: + code: 200 + message: OK +- request: + body: '{"properties": {"authorizationKey": "01010101-0101-0101-0101-010101010101", + "peerExpressRouteCircuit": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware global-reach-connection create + Connection: + - keep-alive + Content-Length: + - '237' + Content-Type: + - application/json + ParameterSetName: + - -g -c -n --peer-express-route-circuit --authorization-key + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections/connection1?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections/connection1","name":"connection1","properties":{"addressPrefix":"192.168.48.128/29","authorizationKey":"01010101-0101-0101-0101-010101010101","circuitConnectionStatus":"Connected","peerExpressRouteCircuit":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer","provisioningState":"Succeeded"},"type":"Microsoft.AVS/privateClouds/globalReachConnections"}' + headers: + cache-control: + - no-cache + content-length: + - '650' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:37 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-msedge-ref: + - 'Ref A: A3B484C50C994CEB9C8F1102B2CB5B8B Ref B: LAX311000110045 Ref C: 2021-06-16T18:33:34Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://localhost:8866/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff686d426-8d16-42db-81b7-ab578e110ccd%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f686d426-8d16-42db-81b7-ab578e110ccd/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:40 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AoD69EGLOwdAkNMeXxYy8yY; expires=Fri, 16-Jul-2021 18:33:41 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrPDz5PcwspIuNlYuBaKH_CXEuTn3wPEruQ413C1dgmrsBHupq9jK5JnNdAYsgeiiSeTic7gU3Inizx1rN4r8DF_DzQMNVuIflShlJTchSmVEVUvjJAxRnIIjzz28nzxsdhl9nmOtt35IQ2p3qlZPQNt5TgX9rvh-AX67Nlpy9jNkgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11829.4 - SCUS ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware global-reach-connection list + Connection: + - keep-alive + ParameterSetName: + - -g -c + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections?api-version=2021-06-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections/connection1","name":"connection1","properties":{"addressPrefix":"192.168.48.128/29","authorizationKey":"01010101-0101-0101-0101-010101010101","circuitConnectionStatus":"Connected","peerExpressRouteCircuit":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer","provisioningState":"Succeeded"},"type":"Microsoft.AVS/privateClouds/globalReachConnections"}]}' + headers: + cache-control: + - no-cache + content-length: + - '662' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:43 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 23D03EA98A8D40B1AED7DAB0753462A2 Ref B: LAXEDGE1507 Ref C: 2021-06-16T18:33:43Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://localhost:8866/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff686d426-8d16-42db-81b7-ab578e110ccd%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f686d426-8d16-42db-81b7-ab578e110ccd/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:46 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AiufH1Q4TlhGjS0FnHO-ZYg; expires=Fri, 16-Jul-2021 18:33:46 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrrcsJRZTy3qrlfoGI45CMppcI0X-HiDZMpuaf4Xz65N8g3a3ufFwQnK2aDVK7UTmApxHr7UJ1o3TuswUVS1L__hGidZztrUvTWLxLtK-BV8zanyZ0WadU14lUF2g3lVXng3-vbMkvNJwHfh6kV9wjxd9wHlgGx2sxHvFeWObpIHkgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11829.4 - WUS2 ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware global-reach-connection show + Connection: + - keep-alive + ParameterSetName: + - -g -c -n + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections/connection1?api-version=2021-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections/connection1","name":"connection1","properties":{"addressPrefix":"192.168.48.128/29","authorizationKey":"01010101-0101-0101-0101-010101010101","circuitConnectionStatus":"Connected","peerExpressRouteCircuit":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer","provisioningState":"Succeeded"},"type":"Microsoft.AVS/privateClouds/globalReachConnections"}' + headers: + cache-control: + - no-cache + content-length: + - '650' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:49 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: D4382A82F88C4CF690BD79E31A74BE92 Ref B: LAXEDGE0908 Ref C: 2021-06-16T18:33:49Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://localhost:8866/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff686d426-8d16-42db-81b7-ab578e110ccd%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f686d426-8d16-42db-81b7-ab578e110ccd/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:51 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AnPvMCpPyopNuILmsAR3bQ4; expires=Fri, 16-Jul-2021 18:33:52 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrKaaUnwWkEc_kvfbR7irS4PMZ--7SSeXfsREXazVM4LW7C6BxZvS34Enqabo0TZQcH0Lm58D5ZGRxXY8ODyIu4k_6jrj-YKNVjlO9L5CLYGPb_UVbE1ABmXja93pT6TaNsPuPzEkzRSsAOpTyeNf1kJSNqihYa3GLPMNtXL_gGE8gAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11829.4 - EUS ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware global-reach-connection delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g -c -n + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections/connection1?api-version=2021-06-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + content-type: + - text/html + date: + - Wed, 16 Jun 2021 18:33:55 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + x-msedge-ref: + - 'Ref A: 254CEE8C24944AADA685055E1D02BA56 Ref B: LAXEDGE0807 Ref C: 2021-06-16T18:33:54Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://localhost:8866/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff686d426-8d16-42db-81b7-ab578e110ccd%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f686d426-8d16-42db-81b7-ab578e110ccd/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:33:57 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=Al3x0vN6soBLgLdZYlT2wYw; expires=Fri, 16-Jul-2021 18:33:58 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevruiQILcR_l77Wj1FFIY-FMZjZRaoyXdqCyglZrmjaIqbqSqfuTcoiKP-ojtUdwIELgU__q8AyMNOehp-8WIn_mX2OCeQKH2_lBkM13IWTKQYeRnbGh167mWjx9r8GxtxAdcvH4JkHuTsSdmyQI5OJa5ktd_jKgvji1rD1k5QxRGsgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11787.15 - WUS2 ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vmware global-reach-connection list + Connection: + - keep-alive + ParameterSetName: + - -g -c + User-Agent: + - AZURECLI/2.18.0 azsdk-python-mgmt-avs/0.1.0 Python/3.8.7 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://localhost:8866/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmware_hcx000001/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections?api-version=2021-06-01 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 16 Jun 2021 18:34:00 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 1E82997E90B7412AA76545F261D77742 Ref B: LAXEDGE0810 Ref C: 2021-06-16T18:34:00Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/vmware/azext_vmware/tests/latest/test_global_reach_connection_scenario.py b/src/vmware/azext_vmware/tests/latest/test_global_reach_connection_scenario.py new file mode 100644 index 00000000000..6f2f94e77ca --- /dev/null +++ b/src/vmware/azext_vmware/tests/latest/test_global_reach_connection_scenario.py @@ -0,0 +1,43 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +import unittest + +from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer) + + +class VmwareGlobalReachConnectionScenarioTest(ScenarioTest): + def setUp(self): + # https://vcrpy.readthedocs.io/en/latest/configuration.html#request-matching + self.vcr.match_on = ['scheme', 'method', 'path', 'query'] # not 'host', 'port' + super(VmwareGlobalReachConnectionScenarioTest, self).setUp() + + @ResourceGroupPreparer(name_prefix='cli_test_vmware_hcx') + def test_vmware_global_reach_connection(self): + self.kwargs.update({ + 'loc': 'westcentralus', + 'privatecloud': 'cloud1', + 'global_reach_connection': 'connection1', + 'peer_express_route_circuit': '/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer', + 'authorization_key': '01010101-0101-0101-0101-010101010101' + }) + + self.cmd('az vmware private-cloud create -g {rg} -n {privatecloud} --location {loc} --sku av20 --cluster-size 4 --network-block 192.168.48.0/22 --nsxt-password 5rqdLj4GF3cePUe6( --vcenter-password UpfBXae9ZquZSDXk( --accept-eula') + + count = len(self.cmd('az vmware global-reach-connection list -g {rg} -c {privatecloud}').get_output_in_json()) + self.assertEqual(count, 0, 'count expected to be 0') + + self.cmd('az vmware global-reach-connection create -g {rg} -c {privatecloud} -n {global_reach_connection} --peer-express-route-circuit {peer_express_route_circuit} --authorization-key {authorization_key}') + + count = len(self.cmd('az vmware global-reach-connection list -g {rg} -c {privatecloud}').get_output_in_json()) + self.assertEqual(count, 1, 'count expected to be 1') + + self.cmd('vmware global-reach-connection show -g {rg} -c {privatecloud} -n {global_reach_connection}') + + self.cmd('vmware global-reach-connection delete -g {rg} -c {privatecloud} -n {global_reach_connection}') + + count = len(self.cmd('az vmware global-reach-connection list -g {rg} -c {privatecloud}').get_output_in_json()) + self.assertEqual(count, 0, 'count expected to be 0') From 66ae97d6c2021a0da0c464a5eb049f0dcd4a35ed Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Mon, 21 Jun 2021 10:12:15 -0600 Subject: [PATCH 2/5] linter fix - add blank line --- src/vmware/azext_vmware/_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vmware/azext_vmware/_help.py b/src/vmware/azext_vmware/_help.py index b379c51302e..9a30569d37f 100644 --- a/src/vmware/azext_vmware/_help.py +++ b/src/vmware/azext_vmware/_help.py @@ -375,4 +375,4 @@ helps['vmware global-reach-connection delete'] = """ type: command short-summary: Delete a global reach connection in a private cloud. -""" \ No newline at end of file +""" From 95d9f055e405a956a365f64347dfdf8680d37f36 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Mon, 21 Jun 2021 11:24:40 -0600 Subject: [PATCH 3/5] fix linter errors & warnings --- src/vmware/DEVELOPMENT.md | 5 + src/vmware/azext_vmware/__init__.py | 3 +- src/vmware/azext_vmware/_params.py | 7 +- src/vmware/azext_vmware/_validators.py | 2 +- src/vmware/azext_vmware/commands.py | 1 + src/vmware/azext_vmware/custom.py | 121 ++++++++++++------------- src/vmware/linter_exclusions.yml | 5 + 7 files changed, 77 insertions(+), 67 deletions(-) create mode 100644 src/vmware/linter_exclusions.yml diff --git a/src/vmware/DEVELOPMENT.md b/src/vmware/DEVELOPMENT.md index 2866426b5ba..f586b27bf62 100644 --- a/src/vmware/DEVELOPMENT.md +++ b/src/vmware/DEVELOPMENT.md @@ -6,3 +6,8 @@ rm ..\azure-cli-extensions\src\vmware\azext_vmware\vendored_sdks -Recurse autorest --python --output-folder=..\azure-cli-extensions\src\vmware\azext_vmware\vendored_sdks --use=@autorest/python@5.8.0 --tag=package-2021-06-01 --azure-arm=true --namespace=avs_client --override-client-name=AVSClient specification\vmware\resource-manager\readme.md ``` It was run from a git clone of [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). + +## Linter +Use [azdev](https://github.com/Azure/azure-cli-dev-tools) to check for linter errors and warnings. +- `azdev style vmware` +- `azdev linter --include-whl-extensions vmware` diff --git a/src/vmware/azext_vmware/__init__.py b/src/vmware/azext_vmware/__init__.py index 872d9e285d5..5cdf51e3df0 100644 --- a/src/vmware/azext_vmware/__init__.py +++ b/src/vmware/azext_vmware/__init__.py @@ -15,8 +15,7 @@ def __init__(self, cli_ctx=None): vmware_custom = CliCommandType( operations_tmpl='azext_vmware.custom#{}', client_factory=cf_vmware) - super(VmwareCommandsLoader, self).__init__(cli_ctx=cli_ctx, - custom_command_type=vmware_custom) + super(VmwareCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=vmware_custom) # pylint: disable=super-with-arguments def load_command_table(self, args): from azext_vmware.commands import load_command_table diff --git a/src/vmware/azext_vmware/_params.py b/src/vmware/azext_vmware/_params.py index 8aba8ebc577..022c72692f6 100644 --- a/src/vmware/azext_vmware/_params.py +++ b/src/vmware/azext_vmware/_params.py @@ -2,8 +2,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -# pylint: disable=line-too-long - +# pylint: disable=line-too-long,too-many-statements def load_arguments(self, _): @@ -103,3 +102,7 @@ def load_arguments(self, _): with self.argument_context('vmware global-reach-connection') as c: c.argument('name', options_list=['--name', '-n'], help='Name of the global reach connection.') + + with self.argument_context('vmware global-reach-connection create') as c: + c.argument('peer_express_route_circuit', help='Identifier of the ExpressRoute Circuit to peer with.') + c.argument('authorization_key', help='Authorization key from the peer express route.') diff --git a/src/vmware/azext_vmware/_validators.py b/src/vmware/azext_vmware/_validators.py index d36dc1a8ff4..1913c58b342 100644 --- a/src/vmware/azext_vmware/_validators.py +++ b/src/vmware/azext_vmware/_validators.py @@ -2,7 +2,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- - +# pylint: disable=line-too-long def example_name_or_id_validator(cmd, namespace): # Example of a storage account name or ID validator. diff --git a/src/vmware/azext_vmware/commands.py b/src/vmware/azext_vmware/commands.py index 2d18e6a6ddf..af09172e119 100644 --- a/src/vmware/azext_vmware/commands.py +++ b/src/vmware/azext_vmware/commands.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long,too-many-statements from azure.cli.core.commands import CliCommandType from azext_vmware._client_factory import cf_vmware diff --git a/src/vmware/azext_vmware/custom.py b/src/vmware/azext_vmware/custom.py index e35b0926e1f..81b9e287830 100644 --- a/src/vmware/azext_vmware/custom.py +++ b/src/vmware/azext_vmware/custom.py @@ -2,8 +2,8 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long -from knack.util import CLIError from azext_vmware.vendored_sdks.avs_client import AVSClient LEGAL_TERMS = ''' @@ -21,24 +21,23 @@ ''' -def privatecloud_list(cmd, client: AVSClient, resource_group_name=None): +def privatecloud_list(client: AVSClient, resource_group_name=None): if resource_group_name is None: return client.private_clouds.list_in_subscription() - else: - return client.private_clouds.list(resource_group_name) + return client.private_clouds.list(resource_group_name) -def privatecloud_show(cmd, client: AVSClient, resource_group_name, name): +def privatecloud_show(client: AVSClient, resource_group_name, name): return client.private_clouds.get(resource_group_name, name) -def privatecloud_create(cmd, client: AVSClient, resource_group_name, name, location, sku, cluster_size, network_block, circuit_primary_subnet=None, circuit_secondary_subnet=None, internet=None, vcenter_password=None, nsxt_password=None, tags=[], accept_eula=False): +def privatecloud_create(client: AVSClient, resource_group_name, name, location, sku, cluster_size, network_block, circuit_primary_subnet=None, circuit_secondary_subnet=None, internet=None, vcenter_password=None, nsxt_password=None, tags=None, accept_eula=False): from knack.prompting import prompt_y_n if not accept_eula: print(LEGAL_TERMS) msg = 'Do you agree to the above additional terms for AVS?' if not prompt_y_n(msg, default="n"): - return + return None from azext_vmware.vendored_sdks.avs_client.models import PrivateCloud, Circuit, ManagementCluster, Sku if circuit_primary_subnet is not None or circuit_secondary_subnet is not None: @@ -56,7 +55,7 @@ def privatecloud_create(cmd, client: AVSClient, resource_group_name, name, locat return client.private_clouds.begin_create_or_update(resource_group_name, name, cloud) -def privatecloud_update(cmd, client: AVSClient, resource_group_name, name, cluster_size=None, internet=None): +def privatecloud_update(client: AVSClient, resource_group_name, name, cluster_size=None, internet=None): from azext_vmware.vendored_sdks.avs_client.models import PrivateCloudUpdate, ManagementCluster private_cloud_update = PrivateCloudUpdate() if cluster_size is not None: @@ -66,19 +65,19 @@ def privatecloud_update(cmd, client: AVSClient, resource_group_name, name, clust return client.private_clouds.begin_update(resource_group_name, name, private_cloud_update) -def privatecloud_delete(cmd, client: AVSClient, resource_group_name, name, yes=False): +def privatecloud_delete(client: AVSClient, resource_group_name, name, yes=False): from knack.prompting import prompt_y_n msg = 'This will delete the private cloud. Are you sure?' if not yes and not prompt_y_n(msg, default="n"): - return + return None return client.private_clouds.begin_delete(resource_group_name, name) -def privatecloud_listadmincredentials(cmd, client: AVSClient, resource_group_name, private_cloud): +def privatecloud_listadmincredentials(client: AVSClient, resource_group_name, private_cloud): return client.private_clouds.list_admin_credentials(resource_group_name=resource_group_name, private_cloud_name=private_cloud) -def privatecloud_addidentitysource(cmd, client: AVSClient, resource_group_name, name, private_cloud, alias, domain, base_user_dn, base_group_dn, primary_server, username, password, secondary_server=None, ssl="Disabled"): +def privatecloud_addidentitysource(client: AVSClient, resource_group_name, name, private_cloud, alias, domain, base_user_dn, base_group_dn, primary_server, username, password, secondary_server=None, ssl="Disabled"): from azext_vmware.vendored_sdks.avs_client.models import IdentitySource pc = client.private_clouds.get(resource_group_name, private_cloud) identitysource = IdentitySource(name=name, alias=alias, domain=domain, base_user_dn=base_user_dn, base_group_dn=base_group_dn, primary_server=primary_server, ssl=ssl, username=username, password=password) @@ -88,190 +87,188 @@ def privatecloud_addidentitysource(cmd, client: AVSClient, resource_group_name, return client.private_clouds.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, private_cloud=pc) -def privatecloud_deleteidentitysource(cmd, client: AVSClient, resource_group_name, name, private_cloud, alias, domain): - from azext_vmware.vendored_sdks.avs_client.models import IdentitySource +def privatecloud_deleteidentitysource(client: AVSClient, resource_group_name, name, private_cloud, alias, domain): pc = client.private_clouds.get(resource_group_name, private_cloud) found = next((ids for ids in pc.identity_sources if ids.name == name and ids.alias == alias and ids.domain == domain), None) if found: pc.identity_sources.remove(found) return client.private_clouds.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, private_cloud=pc) - else: - return pc + return pc -def privatecloud_rotate_vcenter_password(cmd, client: AVSClient, resource_group_name, private_cloud): +def privatecloud_rotate_vcenter_password(client: AVSClient, resource_group_name, private_cloud): return client.private_clouds.begin_rotate_vcenter_password(resource_group_name=resource_group_name, private_cloud_name=private_cloud) -def privatecloud_rotate_nsxt_password(cmd, client: AVSClient, resource_group_name, private_cloud): +def privatecloud_rotate_nsxt_password(client: AVSClient, resource_group_name, private_cloud): return client.private_clouds.begin_rotate_nsxt_password(resource_group_name=resource_group_name, private_cloud_name=private_cloud) -def cluster_create(cmd, client: AVSClient, resource_group_name, name, sku, private_cloud, size, tags=[]): +def cluster_create(client: AVSClient, resource_group_name, name, sku, private_cloud, size): from azext_vmware.vendored_sdks.avs_client.models import Sku return client.clusters.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, cluster_name=name, sku=Sku(name=sku), cluster_size=size) -def cluster_update(cmd, client: AVSClient, resource_group_name, name, private_cloud, size, tags=[]): +def cluster_update(client: AVSClient, resource_group_name, name, private_cloud, size): return client.clusters.begin_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, cluster_name=name, cluster_size=size) -def cluster_list(cmd, client: AVSClient, resource_group_name, private_cloud): +def cluster_list(client: AVSClient, resource_group_name, private_cloud): return client.clusters.list(resource_group_name=resource_group_name, private_cloud_name=private_cloud) -def cluster_show(cmd, client: AVSClient, resource_group_name, private_cloud, name): +def cluster_show(client: AVSClient, resource_group_name, private_cloud, name): return client.clusters.get(resource_group_name=resource_group_name, private_cloud_name=private_cloud, cluster_name=name) -def cluster_delete(cmd, client: AVSClient, resource_group_name, private_cloud, name): +def cluster_delete(client: AVSClient, resource_group_name, private_cloud, name): return client.clusters.begin_delete(resource_group_name=resource_group_name, private_cloud_name=private_cloud, cluster_name=name) -def check_quota_availability(cmd, client: AVSClient, location): +def check_quota_availability(client: AVSClient, location): return client.locations.check_quota_availability(location) -def check_trial_availability(cmd, client: AVSClient, location): +def check_trial_availability(client: AVSClient, location): return client.locations.check_trial_availability(location) -def authorization_create(cmd, client: AVSClient, resource_group_name, private_cloud, name): +def authorization_create(client: AVSClient, resource_group_name, private_cloud, name): return client.authorizations.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, authorization_name=name) -def authorization_list(cmd, client: AVSClient, resource_group_name, private_cloud): +def authorization_list(client: AVSClient, resource_group_name, private_cloud): return client.authorizations.list(resource_group_name=resource_group_name, private_cloud_name=private_cloud) -def authorization_show(cmd, client: AVSClient, resource_group_name, private_cloud, name): +def authorization_show(client: AVSClient, resource_group_name, private_cloud, name): return client.authorizations.get(resource_group_name=resource_group_name, private_cloud_name=private_cloud, authorization_name=name) -def authorization_delete(cmd, client: AVSClient, resource_group_name, private_cloud, name): +def authorization_delete(client: AVSClient, resource_group_name, private_cloud, name): return client.authorizations.begin_delete(resource_group_name=resource_group_name, private_cloud_name=private_cloud, authorization_name=name) -def hcxenterprisesite_create(cmd, client: AVSClient, resource_group_name, private_cloud, name): +def hcxenterprisesite_create(client: AVSClient, resource_group_name, private_cloud, name): return client.hcx_enterprise_sites.create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, hcx_enterprise_site_name=name) -def hcxenterprisesite_list(cmd, client: AVSClient, resource_group_name, private_cloud): +def hcxenterprisesite_list(client: AVSClient, resource_group_name, private_cloud): return client.hcx_enterprise_sites.list(resource_group_name=resource_group_name, private_cloud_name=private_cloud) -def hcxenterprisesite_show(cmd, client: AVSClient, resource_group_name, private_cloud, name): +def hcxenterprisesite_show(client: AVSClient, resource_group_name, private_cloud, name): return client.hcx_enterprise_sites.get(resource_group_name=resource_group_name, private_cloud_name=private_cloud, hcx_enterprise_site_name=name) -def hcxenterprisesite_delete(cmd, client: AVSClient, resource_group_name, private_cloud, name): +def hcxenterprisesite_delete(client: AVSClient, resource_group_name, private_cloud, name): return client.hcx_enterprise_sites.delete(resource_group_name=resource_group_name, private_cloud_name=private_cloud, hcx_enterprise_site_name=name) -def datastore_create(cmd, client: AVSClient, resource_group_name, private_cloud, cluster, name, nfs_provider_ip=None, nfs_file_path=None, endpoints=[], lun_name=None): +def datastore_create(): print('Please use "az vmware datastore netapp-volume create" or "az vmware datastore disk-pool-volume create" instead.') -def datastore_netappvolume_create(cmd, client: AVSClient, resource_group_name, private_cloud, cluster, name, volume_id): +def datastore_netappvolume_create(client: AVSClient, resource_group_name, private_cloud, cluster, name, volume_id): from azext_vmware.vendored_sdks.avs_client.models import NetAppVolume net_app_volume = NetAppVolume(id=volume_id) return client.datastores.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, cluster_name=cluster, datastore_name=name, net_app_volume=net_app_volume, disk_pool_volume=None) -def datastore_diskpoolvolume_create(cmd, client: AVSClient, resource_group_name, private_cloud, cluster, name, target_id, lun_name, mount_option="MOUNT", path=None): +def datastore_diskpoolvolume_create(client: AVSClient, resource_group_name, private_cloud, cluster, name, target_id, lun_name, mount_option="MOUNT", path=None): from azext_vmware.vendored_sdks.avs_client.models import DiskPoolVolume disk_pool_volume = DiskPoolVolume(target_id=target_id, lun_name=lun_name, mount_option=mount_option, path=path) return client.datastores.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, cluster_name=cluster, datastore_name=name, net_app_volume=None, disk_pool_volume=disk_pool_volume) -def datastore_list(cmd, client: AVSClient, resource_group_name, private_cloud, cluster): +def datastore_list(client: AVSClient, resource_group_name, private_cloud, cluster): return client.datastores.list(resource_group_name=resource_group_name, private_cloud_name=private_cloud, cluster_name=cluster) -def datastore_show(cmd, client: AVSClient, resource_group_name, private_cloud, cluster, name): +def datastore_show(client: AVSClient, resource_group_name, private_cloud, cluster, name): return client.datastores.get(resource_group_name=resource_group_name, private_cloud_name=private_cloud, cluster_name=cluster, datastore_name=name) -def datastore_delete(cmd, client: AVSClient, resource_group_name, private_cloud, cluster, name): +def datastore_delete(client: AVSClient, resource_group_name, private_cloud, cluster, name): return client.datastores.begin_delete(resource_group_name=resource_group_name, private_cloud_name=private_cloud, cluster_name=cluster, datastore_name=name) -def addon_list(cmd, client: AVSClient, resource_group_name, private_cloud): +def addon_list(client: AVSClient, resource_group_name, private_cloud): return client.addons.list(resource_group_name=resource_group_name, private_cloud_name=private_cloud) -def addon_vr_create(cmd, client: AVSClient, resource_group_name, private_cloud, vrs_count: int): - from azext_vmware.vendored_sdks.avs_client.models import Addon, AddonVrProperties +def addon_vr_create(client: AVSClient, resource_group_name, private_cloud, vrs_count: int): + from azext_vmware.vendored_sdks.avs_client.models import AddonVrProperties properties = AddonVrProperties(vrs_count=vrs_count) return client.addons.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="vr", properties=properties) -def addon_hcx_create(cmd, client: AVSClient, resource_group_name, private_cloud, offer: str): - from azext_vmware.vendored_sdks.avs_client.models import Addon, AddonHcxProperties +def addon_hcx_create(client: AVSClient, resource_group_name, private_cloud, offer: str): + from azext_vmware.vendored_sdks.avs_client.models import AddonHcxProperties properties = AddonHcxProperties(offer=offer) return client.addons.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="hcx", properties=properties) -def addon_srm_create(cmd, client: AVSClient, resource_group_name, private_cloud, license_key: str): - from azext_vmware.vendored_sdks.avs_client.models import Addon, AddonSrmProperties +def addon_srm_create(client: AVSClient, resource_group_name, private_cloud, license_key: str): + from azext_vmware.vendored_sdks.avs_client.models import AddonSrmProperties properties = AddonSrmProperties(license_key=license_key) return client.addons.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="srm", properties=properties) -def addon_vr_show(cmd, client: AVSClient, resource_group_name, private_cloud): +def addon_vr_show(client: AVSClient, resource_group_name, private_cloud): return client.addons.get(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="vr") -def addon_hcx_show(cmd, client: AVSClient, resource_group_name, private_cloud): +def addon_hcx_show(client: AVSClient, resource_group_name, private_cloud): return client.addons.get(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="hcx") -def addon_srm_show(cmd, client: AVSClient, resource_group_name, private_cloud): +def addon_srm_show(client: AVSClient, resource_group_name, private_cloud): return client.addons.get(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="srm") -def addon_vr_update(cmd, client: AVSClient, resource_group_name, private_cloud, vrs_count: int): - from azext_vmware.vendored_sdks.avs_client.models import Addon, AddonVrProperties +def addon_vr_update(client: AVSClient, resource_group_name, private_cloud, vrs_count: int): + from azext_vmware.vendored_sdks.avs_client.models import AddonVrProperties properties = AddonVrProperties(vrs_count=vrs_count) return client.addons.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="vr", properties=properties) -def addon_hcx_update(cmd, client: AVSClient, resource_group_name, private_cloud, offer: str): - from azext_vmware.vendored_sdks.avs_client.models import Addon, AddonHcxProperties +def addon_hcx_update(client: AVSClient, resource_group_name, private_cloud, offer: str): + from azext_vmware.vendored_sdks.avs_client.models import AddonHcxProperties properties = AddonHcxProperties(offer=offer) return client.addons.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="hcx", properties=properties) -def addon_srm_update(cmd, client: AVSClient, resource_group_name, private_cloud, license_key: str): - from azext_vmware.vendored_sdks.avs_client.models import Addon, AddonSrmProperties +def addon_srm_update(client: AVSClient, resource_group_name, private_cloud, license_key: str): + from azext_vmware.vendored_sdks.avs_client.models import AddonSrmProperties properties = AddonSrmProperties(license_key=license_key) return client.addons.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="srm", properties=properties) -def addon_vr_delete(cmd, client: AVSClient, resource_group_name, private_cloud): +def addon_vr_delete(client: AVSClient, resource_group_name, private_cloud): return client.addons.begin_delete(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="vr") -def addon_hcx_delete(cmd, client: AVSClient, resource_group_name, private_cloud): +def addon_hcx_delete(client: AVSClient, resource_group_name, private_cloud): return client.addons.begin_delete(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="hcx") -def addon_srm_delete(cmd, client: AVSClient, resource_group_name, private_cloud): +def addon_srm_delete(client: AVSClient, resource_group_name, private_cloud): return client.addons.begin_delete(resource_group_name=resource_group_name, private_cloud_name=private_cloud, addon_name="srm") -def globalreachconnection_create(cmd, client: AVSClient, resource_group_name, private_cloud, name, authorization_key=None, peer_express_route_circuit=None): +def globalreachconnection_create(client: AVSClient, resource_group_name, private_cloud, name, authorization_key=None, peer_express_route_circuit=None): return client.global_reach_connections.begin_create_or_update(resource_group_name=resource_group_name, private_cloud_name=private_cloud, global_reach_connection_name=name, authorization_key=authorization_key, peer_express_route_circuit=peer_express_route_circuit) -def globalreachconnection_list(cmd, client: AVSClient, resource_group_name, private_cloud): +def globalreachconnection_list(client: AVSClient, resource_group_name, private_cloud): return client.global_reach_connections.list(resource_group_name=resource_group_name, private_cloud_name=private_cloud) -def globalreachconnection_show(cmd, client: AVSClient, resource_group_name, private_cloud, name): +def globalreachconnection_show(client: AVSClient, resource_group_name, private_cloud, name): return client.global_reach_connections.get(resource_group_name=resource_group_name, private_cloud_name=private_cloud, global_reach_connection_name=name) -def globalreachconnection_delete(cmd, client: AVSClient, resource_group_name, private_cloud, name): +def globalreachconnection_delete(client: AVSClient, resource_group_name, private_cloud, name): return client.global_reach_connections.begin_delete(resource_group_name=resource_group_name, private_cloud_name=private_cloud, global_reach_connection_name=name) diff --git a/src/vmware/linter_exclusions.yml b/src/vmware/linter_exclusions.yml new file mode 100644 index 00000000000..60984f9fde5 --- /dev/null +++ b/src/vmware/linter_exclusions.yml @@ -0,0 +1,5 @@ +vmware global-reach-connection create: + parameters: + peer_express_route_circuit: + rule_exclusions: + - option_length_too_long From 185952bf256b19538bad7226d2875e9d319a35af Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Mon, 21 Jun 2021 11:39:22 -0600 Subject: [PATCH 4/5] linter: 2 blank lines --- src/vmware/azext_vmware/_params.py | 1 + src/vmware/azext_vmware/_validators.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/vmware/azext_vmware/_params.py b/src/vmware/azext_vmware/_params.py index 022c72692f6..a86b0c6d532 100644 --- a/src/vmware/azext_vmware/_params.py +++ b/src/vmware/azext_vmware/_params.py @@ -4,6 +4,7 @@ # -------------------------------------------------------------------------------------------- # pylint: disable=line-too-long,too-many-statements + def load_arguments(self, _): from azure.cli.core.commands.parameters import tags_type diff --git a/src/vmware/azext_vmware/_validators.py b/src/vmware/azext_vmware/_validators.py index 1913c58b342..b2aedfa0a4f 100644 --- a/src/vmware/azext_vmware/_validators.py +++ b/src/vmware/azext_vmware/_validators.py @@ -4,6 +4,7 @@ # -------------------------------------------------------------------------------------------- # pylint: disable=line-too-long + def example_name_or_id_validator(cmd, namespace): # Example of a storage account name or ID validator. # See: https://github.com/Azure/azure-cli/blob/dev/doc/authoring_command_modules/authoring_commands.md#supporting-name-or-id-parameters From 81888bc146662e1ed0b2609c9aaf47cd50a2358b Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Thu, 24 Jun 2021 16:03:27 -0600 Subject: [PATCH 5/5] add asserts --- .../latest/test_global_reach_connection_scenario.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/vmware/azext_vmware/tests/latest/test_global_reach_connection_scenario.py b/src/vmware/azext_vmware/tests/latest/test_global_reach_connection_scenario.py index 6f2f94e77ca..35a29bc4e9e 100644 --- a/src/vmware/azext_vmware/tests/latest/test_global_reach_connection_scenario.py +++ b/src/vmware/azext_vmware/tests/latest/test_global_reach_connection_scenario.py @@ -30,14 +30,19 @@ def test_vmware_global_reach_connection(self): count = len(self.cmd('az vmware global-reach-connection list -g {rg} -c {privatecloud}').get_output_in_json()) self.assertEqual(count, 0, 'count expected to be 0') - self.cmd('az vmware global-reach-connection create -g {rg} -c {privatecloud} -n {global_reach_connection} --peer-express-route-circuit {peer_express_route_circuit} --authorization-key {authorization_key}') + rsp = self.cmd('az vmware global-reach-connection create -g {rg} -c {privatecloud} -n {global_reach_connection} --peer-express-route-circuit {peer_express_route_circuit} --authorization-key {authorization_key}').get_output_in_json() + self.assertEqual(rsp['type'], 'Microsoft.AVS/privateClouds/globalReachConnections') + self.assertEqual(rsp['name'], self.kwargs.get('global_reach_connection')) count = len(self.cmd('az vmware global-reach-connection list -g {rg} -c {privatecloud}').get_output_in_json()) self.assertEqual(count, 1, 'count expected to be 1') - self.cmd('vmware global-reach-connection show -g {rg} -c {privatecloud} -n {global_reach_connection}') + self.cmd('vmware global-reach-connection show -g {rg} -c {privatecloud} -n {global_reach_connection}').get_output_in_json() + self.assertEqual(rsp['type'], 'Microsoft.AVS/privateClouds/globalReachConnections') + self.assertEqual(rsp['name'], self.kwargs.get('global_reach_connection')) - self.cmd('vmware global-reach-connection delete -g {rg} -c {privatecloud} -n {global_reach_connection}') + rsp = self.cmd('vmware global-reach-connection delete -g {rg} -c {privatecloud} -n {global_reach_connection}').output + self.assertEqual(len(rsp), 0) count = len(self.cmd('az vmware global-reach-connection list -g {rg} -c {privatecloud}').get_output_in_json()) self.assertEqual(count, 0, 'count expected to be 0')