From 506faa80896562f33507da54c1f6616075e7b26a Mon Sep 17 00:00:00 2001 From: Alan Feng Date: Fri, 27 May 2022 14:59:07 -0700 Subject: [PATCH 1/6] Added new Deleted Service command module --- .../command_modules/apim/_client_factory.py | 3 + .../azure/cli/command_modules/apim/_help.py | 32 + .../azure/cli/command_modules/apim/_params.py | 12 + .../cli/command_modules/apim/commands.py | 12 +- .../azure/cli/command_modules/apim/custom.py | 22 + .../recordings/test_apim_deletedservice.yaml | 1014 +++++++++++++++++ .../apim/tests/latest/test_apim_scenario.py | 63 + 7 files changed, 1157 insertions(+), 1 deletion(-) create mode 100644 src/azure-cli/azure/cli/command_modules/apim/tests/latest/recordings/test_apim_deletedservice.yaml diff --git a/src/azure-cli/azure/cli/command_modules/apim/_client_factory.py b/src/azure-cli/azure/cli/command_modules/apim/_client_factory.py index ea50fdfaf7d..043e8464888 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/_client_factory.py +++ b/src/azure-cli/azure/cli/command_modules/apim/_client_factory.py @@ -44,3 +44,6 @@ def cf_apiversionset(cli_ctx, *_): def cf_apischema(cli_ctx, *_): return cf_apim(cli_ctx).api_schema + +def cf_ds(cli_ctx, *_): + return cf_apim(cli_ctx).deleted_services \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/apim/_help.py b/src/azure-cli/azure/cli/command_modules/apim/_help.py index e5862abe6f0..b081f2439b9 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/_help.py +++ b/src/azure-cli/azure/cli/command_modules/apim/_help.py @@ -68,6 +68,11 @@ short-summary: Manage Azure API Management API Schema's. """ +helps['apim deletedservice'] = """ +type: group +short-summary: Manage soft-deleted Azure API Management services. +""" + helps['apim backup'] = """ type: command short-summary: Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. @@ -612,3 +617,30 @@ az apim api schema wait --created --api-id MyApi --name MyApim --schema-id schemaId -g MyResourceGroup crafted: true """ + +helps['apim deletedservice show'] = """ +type: command +short-summary: Get soft-deleted Api Management service instances available for undelete by name. +examples: + - name: Get a soft-deleted services with its name. + text: | + az apim deletedservice get --name MyApim -g MyResourceGroup +""" + +helps['apim deletedservice list'] = """ +type: command +short-summary: Lists all soft-deleted Api Management services instances available for undelete for the given subscription. +examples: + - name: List all soft-deleted services in a subscription. + text: | + az apim deletedservice list -g MyResourceGroup +""" + +helps['apim deletedservice purge'] = """ +type: command +short-summary: Purges soft-deleted Api Management service instance (deletes it with no option to undelete) +examples: + - name: Purge a soft-deleted serivce. + text: | + az apim deletedservice purge --name MyApim -g MyResourceGroup +""" \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/apim/_params.py b/src/azure-cli/azure/cli/command_modules/apim/_params.py index 851a4956da7..fcb89d3b8fb 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/_params.py +++ b/src/azure-cli/azure/cli/command_modules/apim/_params.py @@ -400,3 +400,15 @@ def load_arguments(self, _): 'version_header_name', help="Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`.") c.argument('if_match', help='ETag of the Entity.') + + with self.argument_context('apim deletedservice show') as c: + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('service_name', options_list=['--service-name', '-n'], + help="The name of the soft deleted API Management service instance.") + + with self.argument_context('apim deletedservice purge') as c: + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('service_name', options_list=['--service-name', '-n'], + help="The name of the soft deleted API Management service instance.") \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/apim/commands.py b/src/azure-cli/azure/cli/command_modules/apim/commands.py index 9e8a0cb9776..41f6e36164a 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/commands.py +++ b/src/azure-cli/azure/cli/command_modules/apim/commands.py @@ -10,7 +10,7 @@ from azure.cli.command_modules.apim._format import (service_output_format) from azure.cli.command_modules.apim._client_factory import (cf_service, cf_api, cf_product, cf_nv, cf_apiops, cf_apirelease, cf_apirevision, cf_apiversionset, - cf_apischema) + cf_apischema, cf_ds) def load_command_table(self, _): @@ -59,6 +59,11 @@ def load_command_table(self, _): client_factory=cf_apiversionset ) + apids_sdk = CliCommandType( + operations_tmpl='azure.mgmt.apimanagement.operations#DeletedServicesOperations.{}', + client_factory=cf_ds + ) + # pylint: disable=line-too-long with self.command_group('apim', service_sdk) as g: g.custom_command('create', 'apim_create', supports_no_wait=True, @@ -143,3 +148,8 @@ def load_command_table(self, _): g.custom_command('create', 'apim_api_vs_create') g.generic_update_command('update', custom_func_name='apim_api_vs_update') g.custom_command('delete', 'apim_api_vs_delete') + + with self.command_group('apim deletedservice', apids_sdk) as g: + g.custom_command('list', 'apim_ds_list') + g.custom_show_command('show', 'apim_ds_get') + g.custom_command('purge', 'apim_ds_purge') \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/apim/custom.py b/src/azure-cli/azure/cli/command_modules/apim/custom.py index 02963e4857e..90e42f865db 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/custom.py +++ b/src/azure-cli/azure/cli/command_modules/apim/custom.py @@ -899,3 +899,25 @@ def apim_api_vs_delete(client, resource_group_name, service_name, version_set_id service_name=service_name, version_set_id=version_set_id, if_match="*" if if_match is None else if_match) + + +def apim_ds_get(client, location, service_name): + """Get specific soft-deleted Api Management Service.""" + + return client.deleted_services.get_by_name(service_name, location) + + +def apim_ds_list(client): + """List soft-deleted Api Management Service.""" + + return client.deleted_services.list_by_subscription() + + +def apim_ds_purge(client, service_name, location, no_wait=False): + """Purge soft-deleted Api Management Service.""" + + return sdk_no_wait( + no_wait, + client.deleted_services.begin_purge, + service_name=service_name, + location=location) \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/apim/tests/latest/recordings/test_apim_deletedservice.yaml b/src/azure-cli/azure/cli/command_modules/apim/tests/latest/recordings/test_apim_deletedservice.yaml new file mode 100644 index 00000000000..2192fbba1d1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/apim/tests/latest/recordings/test_apim_deletedservice.yaml @@ -0,0 +1,1014 @@ +interactions: +- request: + body: '{"location": "westus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - group create + Connection: + - keep-alive + Content-Length: + - '22' + Content-Type: + - application/json + ParameterSetName: + - -l -n + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli-test-apim-deletedservice-rg000004?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004","name":"cli-test-apim-deletedservice-rg000004","type":"Microsoft.Resources/resourceGroups","location":"westus","properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '271' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 27 May 2022 20:30:08 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: '{"name": "cli-test-apim-deletedservice-000003"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apim check-name + Connection: + - keep-alive + Content-Length: + - '47' + Content-Type: + - application/json + ParameterSetName: + - -n -o + User-Agent: + - AZURECLI/2.35.0 azsdk-python-mgmt-apimanagement/3.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/checkNameAvailability?api-version=2021-08-01 + response: + body: + string: '{"nameAvailable":true,"reason":"Valid","message":""}' + headers: + cache-control: + - no-cache + content-length: + - '52' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 27 May 2022 20:30:08 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"sku": {"name": "Consumption", "capacity": 0}, "identity": {"type": "SystemAssigned"}, + "location": "westus", "properties": {"notificationSenderEmail": "publisher@contoso.com", + "disableGateway": false, "virtualNetworkType": "None", "restore": false, "publisherEmail": + "publisher@contoso.com", "publisherName": "Contoso"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apim create + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + ParameterSetName: + - --name -g -l --sku-name --publisher-email --publisher-name --enable-managed-identity + User-Agent: + - AZURECLI/2.35.0 azsdk-python-mgmt-apimanagement/3.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004/providers/Microsoft.ApiManagement/service/cli-test-apim-deletedservice-000003?api-version=2021-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004/providers/Microsoft.ApiManagement/service/cli-test-apim-deletedservice-000003","name":"cli-test-apim-deletedservice-000003","type":"Microsoft.ApiManagement/service","tags":{},"location":"West + US","etag":"AAAAAAAyixA=","properties":{"publisherEmail":"publisher@contoso.com","publisherName":"Contoso","notificationSenderEmail":"publisher@contoso.com","provisioningState":"Created","targetProvisioningState":"Activating","createdAtUtc":"2022-05-27T20:30:12.0054808Z","gatewayUrl":"https://cli-test-apim-deletedservice-000003.azure-api.net","gatewayRegionalUrl":null,"portalUrl":null,"developerPortalUrl":null,"managementApiUrl":null,"scmUrl":null,"hostnameConfigurations":[{"type":"Proxy","hostName":"cli-test-apim-deletedservice-000003.azure-api.net","encodedCertificate":null,"keyVaultId":null,"certificatePassword":null,"negotiateClientCertificate":false,"certificate":null,"defaultSslBinding":true,"identityClientId":null,"certificateSource":"BuiltIn","certificateStatus":null}],"publicIPAddresses":null,"privateIPAddresses":null,"additionalLocations":null,"virtualNetworkConfiguration":null,"customProperties":null,"virtualNetworkType":"None","certificates":null,"disableGateway":false,"apiVersionConstraint":{"minApiVersion":null},"publicIpAddressId":null,"publicNetworkAccess":"Enabled","privateEndpointConnections":null,"platformVersion":"mtv1"},"sku":{"name":"Consumption","capacity":0},"identity":{"type":"SystemAssigned","principalId":"e1aaa64f-45b0-496a-836c-65f1dbb73658","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47"},"zones":null,"systemData":{"createdBy":"alanfeng@microsoft.com","createdByType":"User","createdAt":"2022-05-27T20:30:11.2356969Z","lastModifiedBy":"alanfeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-27T20:30:11.2356969Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1894' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 27 May 2022 20:30:15 GMT + etag: + - '"AAAAAAAyixA="' + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004/providers/Microsoft.ApiManagement/service/cli-test-apim-deletedservice-000003/operationresults/d2VzdHVzOmNsaS10ZXN0LWFwaW0tZGVsZXRlZHNlcnZpY2UteWNqbzQ0X0FjdF84NzZhNmNhYg==?api-version=2021-08-01 + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - apim create + Connection: + - keep-alive + ParameterSetName: + - --name -g -l --sku-name --publisher-email --publisher-name --enable-managed-identity + User-Agent: + - AZURECLI/2.35.0 azsdk-python-mgmt-apimanagement/3.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004/providers/Microsoft.ApiManagement/service/cli-test-apim-deletedservice-000003/operationresults/d2VzdHVzOmNsaS10ZXN0LWFwaW0tZGVsZXRlZHNlcnZpY2UteWNqbzQ0X0FjdF84NzZhNmNhYg==?api-version=2021-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004/providers/Microsoft.ApiManagement/service/cli-test-apim-deletedservice-000003","name":"cli-test-apim-deletedservice-000003","type":"Microsoft.ApiManagement/service","tags":{},"location":"West + US","etag":"AAAAAAAyixU=","properties":{"publisherEmail":"publisher@contoso.com","publisherName":"Contoso","notificationSenderEmail":"publisher@contoso.com","provisioningState":"Succeeded","targetProvisioningState":"","createdAtUtc":"2022-05-27T20:30:12.0054808Z","gatewayUrl":"https://cli-test-apim-deletedservice-000003.azure-api.net","gatewayRegionalUrl":null,"portalUrl":null,"developerPortalUrl":null,"managementApiUrl":null,"scmUrl":null,"hostnameConfigurations":[{"type":"Proxy","hostName":"cli-test-apim-deletedservice-000003.azure-api.net","encodedCertificate":null,"keyVaultId":null,"certificatePassword":null,"negotiateClientCertificate":false,"certificate":null,"defaultSslBinding":true,"identityClientId":null,"certificateSource":"BuiltIn","certificateStatus":null}],"publicIPAddresses":null,"privateIPAddresses":null,"additionalLocations":null,"virtualNetworkConfiguration":null,"customProperties":{"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10":"False","Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11":"False","Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10":"False","Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11":"False","Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30":"False","Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2":"False"},"virtualNetworkType":"None","certificates":null,"disableGateway":false,"apiVersionConstraint":{"minApiVersion":null},"publicIpAddressId":null,"publicNetworkAccess":"Enabled","privateEndpointConnections":null,"platformVersion":"mtv1"},"sku":{"name":"Consumption","capacity":0},"identity":{"type":"SystemAssigned","principalId":"e1aaa64f-45b0-496a-836c-65f1dbb73658","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47"},"zones":null,"systemData":{"createdBy":"alanfeng@microsoft.com","createdByType":"User","createdAt":"2022-05-27T20:30:11.2356969Z","lastModifiedBy":"alanfeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-27T20:30:11.2356969Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '2385' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 27 May 2022 20:31:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"name": "cli-test-apim-deletedservice-000003"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apim check-name + Connection: + - keep-alive + Content-Length: + - '47' + Content-Type: + - application/json + ParameterSetName: + - -n + User-Agent: + - AZURECLI/2.35.0 azsdk-python-mgmt-apimanagement/3.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/checkNameAvailability?api-version=2021-08-01 + response: + body: + string: '{"nameAvailable":false,"reason":"AlreadyExists","message":"cli-test-apim-deletedservice-000003 + is already in use. Please select a different name."}' + headers: + cache-control: + - no-cache + content-length: + - '147' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 27 May 2022 20:31:16 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apim wait + Connection: + - keep-alive + ParameterSetName: + - -g -n --created + User-Agent: + - AZURECLI/2.35.0 azsdk-python-mgmt-apimanagement/3.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004/providers/Microsoft.ApiManagement/service/cli-test-apim-deletedservice-000003?api-version=2021-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004/providers/Microsoft.ApiManagement/service/cli-test-apim-deletedservice-000003","name":"cli-test-apim-deletedservice-000003","type":"Microsoft.ApiManagement/service","tags":{},"location":"West + US","etag":"AAAAAAAyixU=","properties":{"publisherEmail":"publisher@contoso.com","publisherName":"Contoso","notificationSenderEmail":"publisher@contoso.com","provisioningState":"Succeeded","targetProvisioningState":"","createdAtUtc":"2022-05-27T20:30:12.0054808Z","gatewayUrl":"https://cli-test-apim-deletedservice-000003.azure-api.net","gatewayRegionalUrl":null,"portalUrl":null,"developerPortalUrl":null,"managementApiUrl":null,"scmUrl":null,"hostnameConfigurations":[{"type":"Proxy","hostName":"cli-test-apim-deletedservice-000003.azure-api.net","encodedCertificate":null,"keyVaultId":null,"certificatePassword":null,"negotiateClientCertificate":false,"certificate":null,"defaultSslBinding":true,"identityClientId":null,"certificateSource":"BuiltIn","certificateStatus":null}],"publicIPAddresses":null,"privateIPAddresses":null,"additionalLocations":null,"virtualNetworkConfiguration":null,"customProperties":{"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10":"False","Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11":"False","Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10":"False","Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11":"False","Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30":"False","Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2":"False"},"virtualNetworkType":"None","certificates":null,"disableGateway":false,"apiVersionConstraint":{"minApiVersion":null},"publicIpAddressId":null,"publicNetworkAccess":"Enabled","privateEndpointConnections":null,"platformVersion":"mtv1"},"sku":{"name":"Consumption","capacity":0},"identity":{"type":"SystemAssigned","principalId":"e1aaa64f-45b0-496a-836c-65f1dbb73658","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47"},"zones":null,"systemData":{"createdBy":"alanfeng@microsoft.com","createdByType":"User","createdAt":"2022-05-27T20:30:11.2356969Z","lastModifiedBy":"alanfeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-27T20:30:11.2356969Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '2385' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 27 May 2022 20:31:16 GMT + etag: + - '"AAAAAAAyixU="' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - group delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g -y + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli-test-apim-deletedservice-rg000004?api-version=2021-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:31:19 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - group delete + Connection: + - keep-alive + ParameterSetName: + - -g -y + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:31:34 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - group delete + Connection: + - keep-alive + ParameterSetName: + - -g -y + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:31:49 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - group delete + Connection: + - keep-alive + ParameterSetName: + - -g -y + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:32:04 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - group delete + Connection: + - keep-alive + ParameterSetName: + - -g -y + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:32:19 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - group delete + Connection: + - keep-alive + ParameterSetName: + - -g -y + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:32:34 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - group delete + Connection: + - keep-alive + ParameterSetName: + - -g -y + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:32:49 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - group delete + Connection: + - keep-alive + ParameterSetName: + - -g -y + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:33:04 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - group delete + Connection: + - keep-alive + ParameterSetName: + - -g -y + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:33:19 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - group delete + Connection: + - keep-alive + ParameterSetName: + - -g -y + User-Agent: + - AZURECLI/2.35.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6MkRURVNUOjJEQVBJTToyRERFTEVURURTRVJWSUNFOjJEUkdXVk5KLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2021-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:33:34 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apim deletedservice list + Connection: + - keep-alive + User-Agent: + - AZURECLI/2.35.0 azsdk-python-mgmt-apimanagement/3.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/deletedservices?api-version=2021-08-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/locations/westus/deletedservices/cli-test-apim-deletedservice-000003","name":"cli-test-apim-deletedservice-000003","type":"Microsoft.ApiManagement/deletedservices","location":"West + US","properties":{"serviceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004/providers/Microsoft.ApiManagement/service/cli-test-apim-deletedservice-000003","scheduledPurgeDate":"2022-05-29T20:31:26.1975508Z","deletionDate":"2022-05-27T20:31:59.024237Z"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/locations/eastus2euap/deletedservices/kjoshieuapeus2","name":"kjoshieuapeus2","type":"Microsoft.ApiManagement/deletedservices","location":"East + US 2 EUAP","properties":{"serviceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/kjoshitest/providers/Microsoft.ApiManagement/service/kjoshieuapeus2","scheduledPurgeDate":"2022-05-28T22:01:36.8486322Z","deletionDate":"2022-05-26T22:02:09.1702502Z"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1110' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 27 May 2022 20:33:36 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + - d450b700-b9a1-4f8f-8c6b-cccf75974dbe + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apim deletedservice show + Connection: + - keep-alive + ParameterSetName: + - -l -n + User-Agent: + - AZURECLI/2.35.0 azsdk-python-mgmt-apimanagement/3.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/locations/westus/deletedservices/cli-test-apim-deletedservice-000003?api-version=2021-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/locations/westus/deletedservices/cli-test-apim-deletedservice-000003","name":"cli-test-apim-deletedservice-000003","type":"Microsoft.ApiManagement/deletedservices","location":"West + US","properties":{"serviceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004/providers/Microsoft.ApiManagement/service/cli-test-apim-deletedservice-000003","scheduledPurgeDate":"2022-05-29T20:31:26.1975508Z","deletionDate":"2022-05-27T20:31:59.024237Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '587' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 27 May 2022 20:33:36 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apim deletedservice purge + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -l -n + User-Agent: + - AZURECLI/2.35.0 azsdk-python-mgmt-apimanagement/3.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/locations/westus/deletedservices/cli-test-apim-deletedservice-000003?api-version=2021-08-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/locations/westus/deletedservices/cli-test-apim-deletedservice-000003","name":"cli-test-apim-deletedservice-000003","type":"Microsoft.ApiManagement/deletedservices","location":"West + US","properties":{"serviceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli-test-apim-deletedservice-rg000004/providers/Microsoft.ApiManagement/service/cli-test-apim-deletedservice-000003","scheduledPurgeDate":"2022-05-27T20:33:38.2076281Z","deletionDate":"2022-05-27T20:31:59.024237Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '587' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 27 May 2022 20:33:59 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/locations/westus/deletedservices/cli-test-apim-deletedservice-000003/operationresults/d2VzdHVzOmNsaS10ZXN0LWFwaW0tZGVsZXRlZHNlcnZpY2UteWNqbzQ0X1Rlcm1fZDRmZjRkNTY=?api-version=2021-08-01 + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - apim deletedservice purge + Connection: + - keep-alive + ParameterSetName: + - -l -n + User-Agent: + - AZURECLI/2.35.0 azsdk-python-mgmt-apimanagement/3.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/locations/westus/deletedservices/cli-test-apim-deletedservice-000003/operationresults/d2VzdHVzOmNsaS10ZXN0LWFwaW0tZGVsZXRlZHNlcnZpY2UteWNqbzQ0X1Rlcm1fZDRmZjRkNTY=?api-version=2021-08-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 27 May 2022 20:35:00 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apim deletedservice list + Connection: + - keep-alive + User-Agent: + - AZURECLI/2.35.0 azsdk-python-mgmt-apimanagement/3.0.0 Python/3.10.4 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/deletedservices?api-version=2021-08-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ApiManagement/locations/eastus2euap/deletedservices/kjoshieuapeus2","name":"kjoshieuapeus2","type":"Microsoft.ApiManagement/deletedservices","location":"East + US 2 EUAP","properties":{"serviceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/kjoshitest/providers/Microsoft.ApiManagement/service/kjoshieuapeus2","scheduledPurgeDate":"2022-05-28T22:01:36.8486322Z","deletionDate":"2022-05-26T22:02:09.1702502Z"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '522' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 27 May 2022 20:35:02 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + - de5e47d9-1b37-497e-bf06-2ae03af7defc + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/apim/tests/latest/test_apim_scenario.py b/src/azure-cli/azure/cli/command_modules/apim/tests/latest/test_apim_scenario.py index 4847893481a..11a4ae49755 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/tests/latest/test_apim_scenario.py +++ b/src/azure-cli/azure/cli/command_modules/apim/tests/latest/test_apim_scenario.py @@ -480,8 +480,71 @@ def test_apim_core_service(self, resource_group, resource_group_location, storag final_count = len(self.cmd('apim list').get_output_in_json()) self.assertEqual(final_count, count - 1) + @ResourceGroupPreparer(name_prefix='cli_test_apim_deletedservice-', parameter_name_for_location='resource_group_location') + @StorageAccountPreparer(parameter_name='storage_account_for_backup') + @AllowLargeResponse() + def test_apim_deletedservice(self, resource_group, resource_group_location, storage_account_for_backup): + service_name = self.create_random_name('cli-test-apim-deletedservice-', 35) + resource_group = self.create_random_name('cli-test-apim-deletedservice-rg', 35) + + # try to use the injected location, but if the location is not known + # fall back to west us, otherwise we can't validate since the sdk returns displayName + if resource_group_location not in KNOWN_LOCS.keys(): + resource_group_location = 'westus' + + self.kwargs.update({ + 'service_name': service_name, + 'rg': resource_group, + 'rg_loc': resource_group_location, + 'rg_loc_displayName': KNOWN_LOCS.get(resource_group_location), + 'notification_sender_email': 'notifications@contoso.com', + 'publisher_email': 'publisher@contoso.com', + 'publisher_name': 'Contoso', + 'sku_name': 'Consumption', + 'skucapacity': 1, + 'enable_managed_identity': True, + 'tag': "foo=boo" + }) + + self.cmd('group create -l {rg_loc} -n {rg}') + + self.cmd('apim check-name -n {service_name} -o json', + checks=[self.check('nameAvailable', True)]) + + self.cmd('apim create --name {service_name} -g {rg} -l {rg_loc} --sku-name {sku_name} --publisher-email {publisher_email} --publisher-name {publisher_name} --enable-managed-identity {enable_managed_identity}', + checks=[self.check('name', '{service_name}'), + self.check('location', '{rg_loc_displayName}'), + self.check('sku.name', '{sku_name}'), + self.check('provisioningState', 'Succeeded'), + self.check('identity.type', 'SystemAssigned'), + self.check('publisherName', '{publisher_name}'), + self.check('publisherEmail', '{publisher_email}')]) + + self.cmd('apim check-name -n {service_name}', + checks=[self.check('nameAvailable', False), + self.check('reason', 'AlreadyExists')]) + + # wait for creation + self.cmd('apim wait -g {rg} -n {service_name} --created', checks=[self.is_empty()]) + + # delete rg and get apim into soft-deleted state + self.cmd('group delete -g {rg} -y', checks=[self.is_empty()]) + + # list deleted service + deletedservices = self.cmd('apim deletedservice list').get_output_in_json() + self.assertTrue(any(service['name'] == service_name for service in deletedservices)) + + # show deleted service + self.cmd('apim deletedservice show -l {rg_loc} -n {service_name}', + checks=[self.check('name', '{service_name}'), + self.check('location', '{rg_loc_displayName}'), + self.check('type', 'Microsoft.ApiManagement/deletedservices')]) + # purge deleted service + self.cmd('apim deletedservice purge -l {rg_loc} -n {service_name}', checks=[self.is_empty()]) + deletedservices = self.cmd('apim deletedservice list').get_output_in_json() + self.assertFalse(any(service['name'] == service_name for service in deletedservices)) KNOWN_LOCS = {'eastasia': 'East Asia', 'southeastasia': 'Southeast Asia', From 516f47a65dbc28c21493a45f4493b438b0c1b0a1 Mon Sep 17 00:00:00 2001 From: Alan Feng Date: Tue, 7 Jun 2022 11:27:18 -0700 Subject: [PATCH 2/6] fixed style issues --- .../azure/cli/command_modules/apim/_client_factory.py | 3 ++- src/azure-cli/azure/cli/command_modules/apim/_help.py | 8 ++++---- .../azure/cli/command_modules/apim/_params.py | 11 +++++------ .../azure/cli/command_modules/apim/commands.py | 2 +- .../azure/cli/command_modules/apim/custom.py | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/apim/_client_factory.py b/src/azure-cli/azure/cli/command_modules/apim/_client_factory.py index 043e8464888..a54dc68deec 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/_client_factory.py +++ b/src/azure-cli/azure/cli/command_modules/apim/_client_factory.py @@ -45,5 +45,6 @@ def cf_apiversionset(cli_ctx, *_): def cf_apischema(cli_ctx, *_): return cf_apim(cli_ctx).api_schema + def cf_ds(cli_ctx, *_): - return cf_apim(cli_ctx).deleted_services \ No newline at end of file + return cf_apim(cli_ctx).deleted_services diff --git a/src/azure-cli/azure/cli/command_modules/apim/_help.py b/src/azure-cli/azure/cli/command_modules/apim/_help.py index b081f2439b9..95ed3989bc0 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/_help.py +++ b/src/azure-cli/azure/cli/command_modules/apim/_help.py @@ -624,7 +624,7 @@ examples: - name: Get a soft-deleted services with its name. text: | - az apim deletedservice get --name MyApim -g MyResourceGroup + az apim deletedservice get --name MyApim -g MyResourceGroup """ helps['apim deletedservice list'] = """ @@ -633,7 +633,7 @@ examples: - name: List all soft-deleted services in a subscription. text: | - az apim deletedservice list -g MyResourceGroup + az apim deletedservice list -g MyResourceGroup """ helps['apim deletedservice purge'] = """ @@ -642,5 +642,5 @@ examples: - name: Purge a soft-deleted serivce. text: | - az apim deletedservice purge --name MyApim -g MyResourceGroup -""" \ No newline at end of file + az apim deletedservice purge --name MyApim -g MyResourceGroup +""" diff --git a/src/azure-cli/azure/cli/command_modules/apim/_params.py b/src/azure-cli/azure/cli/command_modules/apim/_params.py index fcb89d3b8fb..7f81d71cfd9 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/_params.py +++ b/src/azure-cli/azure/cli/command_modules/apim/_params.py @@ -402,13 +402,12 @@ def load_arguments(self, _): c.argument('if_match', help='ETag of the Entity.') with self.argument_context('apim deletedservice show') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), - validator=get_default_location_from_resource_group) + c.argument('location', arg_type=get_location_type(self.cli_ctx)) c.argument('service_name', options_list=['--service-name', '-n'], help="The name of the soft deleted API Management service instance.") with self.argument_context('apim deletedservice purge') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), - validator=get_default_location_from_resource_group) - c.argument('service_name', options_list=['--service-name', '-n'], - help="The name of the soft deleted API Management service instance.") \ No newline at end of file + c.argument('location', arg_type=get_location_type(self.cli_ctx)) + c.argument( + 'service_name', options_list=['--service-name', '-n'], + help="The name of the soft deleted API Management service instance.") diff --git a/src/azure-cli/azure/cli/command_modules/apim/commands.py b/src/azure-cli/azure/cli/command_modules/apim/commands.py index 41f6e36164a..94c9f1b72af 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/commands.py +++ b/src/azure-cli/azure/cli/command_modules/apim/commands.py @@ -152,4 +152,4 @@ def load_command_table(self, _): with self.command_group('apim deletedservice', apids_sdk) as g: g.custom_command('list', 'apim_ds_list') g.custom_show_command('show', 'apim_ds_get') - g.custom_command('purge', 'apim_ds_purge') \ No newline at end of file + g.custom_command('purge', 'apim_ds_purge') diff --git a/src/azure-cli/azure/cli/command_modules/apim/custom.py b/src/azure-cli/azure/cli/command_modules/apim/custom.py index 90e42f865db..58f32ea5618 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/custom.py +++ b/src/azure-cli/azure/cli/command_modules/apim/custom.py @@ -920,4 +920,4 @@ def apim_ds_purge(client, service_name, location, no_wait=False): no_wait, client.deleted_services.begin_purge, service_name=service_name, - location=location) \ No newline at end of file + location=location) From 9b4b5ff6e1f06a58030b05e2453e86fb58cd0ba0 Mon Sep 17 00:00:00 2001 From: Alan Feng Date: Tue, 14 Jun 2022 11:29:34 -0700 Subject: [PATCH 3/6] Addressed linter error --- src/azure-cli/azure/cli/command_modules/apim/commands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/azure-cli/azure/cli/command_modules/apim/commands.py b/src/azure-cli/azure/cli/command_modules/apim/commands.py index 94c9f1b72af..0a0b34583db 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/commands.py +++ b/src/azure-cli/azure/cli/command_modules/apim/commands.py @@ -123,6 +123,7 @@ def load_command_table(self, _): g.custom_command('delete', 'apim_nv_delete', confirmation=True) g.custom_command('show-secret', 'apim_nv_show_secret') g.generic_update_command('update', setter_name='begin_create_or_update', custom_func_name='apim_nv_update') + g.wait_command('wait') with self.command_group('apim api operation', apiops_sdk) as g: g.custom_command('list', 'apim_api_operation_list') From 1ee54ae4604b58a3518212e43b9dbcfdc815e513 Mon Sep 17 00:00:00 2001 From: Alan Feng Date: Thu, 16 Jun 2022 12:13:52 -0700 Subject: [PATCH 4/6] fixed linter errors --- .../azure/cli/command_modules/apim/_help.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/apim/_help.py b/src/azure-cli/azure/cli/command_modules/apim/_help.py index 95ed3989bc0..397b440848c 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/_help.py +++ b/src/azure-cli/azure/cli/command_modules/apim/_help.py @@ -378,6 +378,16 @@ az apim nv update --service-name MyApim -g MyResourceGroup --named-value-id MyNamedValue --value foo """ +helps['apim nv wait'] = """ +type: command +short-summary: Place the CLI in a waiting state until a condition of an apim named value is met. +examples: + - name: Place the CLI in a waiting state until a condition of a apim api is met. (autogenerated) + text: | + az apim nv wait --created --service-name MyApim -g MyResourceGroup --named-value-id MyNamedValue --resource-group MyResourceGroup + crafted: true +""" + helps['apim api operation list'] = """ type: command short-summary: List a collection of the operations for the specified API. @@ -624,7 +634,7 @@ examples: - name: Get a soft-deleted services with its name. text: | - az apim deletedservice get --name MyApim -g MyResourceGroup + az apim deletedservice show --service-name MyApim --location westus """ helps['apim deletedservice list'] = """ @@ -633,7 +643,7 @@ examples: - name: List all soft-deleted services in a subscription. text: | - az apim deletedservice list -g MyResourceGroup + az apim deletedservice list """ helps['apim deletedservice purge'] = """ @@ -642,5 +652,5 @@ examples: - name: Purge a soft-deleted serivce. text: | - az apim deletedservice purge --name MyApim -g MyResourceGroup + az apim deletedservice purge --service-name MyApim --location westus """ From 14ec6f344a7c8460b6339f1eae2edbf558d0e88d Mon Sep 17 00:00:00 2001 From: Alan Feng Date: Tue, 21 Jun 2022 10:42:12 -0700 Subject: [PATCH 5/6] fixed linter error --- src/azure-cli/azure/cli/command_modules/apim/_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/apim/_help.py b/src/azure-cli/azure/cli/command_modules/apim/_help.py index 397b440848c..5c0bc562133 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/_help.py +++ b/src/azure-cli/azure/cli/command_modules/apim/_help.py @@ -643,7 +643,7 @@ examples: - name: List all soft-deleted services in a subscription. text: | - az apim deletedservice list + az apim deletedservice list """ helps['apim deletedservice purge'] = """ From 60f8e901d5b24c87d306e1e7e24d1c21af52e9e7 Mon Sep 17 00:00:00 2001 From: Alan Feng Date: Wed, 29 Jun 2022 15:07:39 -0700 Subject: [PATCH 6/6] comments addressed --- src/azure-cli/azure/cli/command_modules/apim/_help.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/apim/_help.py b/src/azure-cli/azure/cli/command_modules/apim/_help.py index 5c0bc562133..a2aee965352 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/_help.py +++ b/src/azure-cli/azure/cli/command_modules/apim/_help.py @@ -382,10 +382,9 @@ type: command short-summary: Place the CLI in a waiting state until a condition of an apim named value is met. examples: - - name: Place the CLI in a waiting state until a condition of a apim api is met. (autogenerated) + - name: Place the CLI in a waiting state until a condition of a apim api is met. text: | az apim nv wait --created --service-name MyApim -g MyResourceGroup --named-value-id MyNamedValue --resource-group MyResourceGroup - crafted: true """ helps['apim api operation list'] = """ @@ -639,7 +638,7 @@ helps['apim deletedservice list'] = """ type: command -short-summary: Lists all soft-deleted Api Management services instances available for undelete for the given subscription. +short-summary: List all soft-deleted Api Management services instances available for undelete for the given subscription. examples: - name: List all soft-deleted services in a subscription. text: | @@ -648,7 +647,7 @@ helps['apim deletedservice purge'] = """ type: command -short-summary: Purges soft-deleted Api Management service instance (deletes it with no option to undelete) +short-summary: Purge soft-deleted Api Management service instance (deletes it with no option to undelete) examples: - name: Purge a soft-deleted serivce. text: |