diff --git a/src/azure-cli/azure/cli/command_modules/storage/_client_factory.py b/src/azure-cli/azure/cli/command_modules/storage/_client_factory.py index 89f43a94849..291216d4bfa 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_client_factory.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_client_factory.py @@ -267,3 +267,27 @@ def cf_adls_file(cli_ctx, kwargs): def cf_or_policy(cli_ctx, _): return storage_client_factory(cli_ctx).object_replication_policies + + +def cf_queue_service(cli_ctx, kwargs): + from knack.util import CLIError + t_queue_service = get_sdk(cli_ctx, ResourceType.DATA_STORAGE_QUEUE, '_queue_service_client#QueueServiceClient') + connection_string = kwargs.pop('connection_string', None) + account_name = kwargs.pop('account_name', None) + account_key = kwargs.pop('account_key', None) + token_credential = kwargs.pop('token_credential', None) + sas_token = kwargs.pop('sas_token', None) + if connection_string: + return t_queue_service.from_connection_string(conn_str=connection_string) + + account_url = get_account_url(cli_ctx, account_name=account_name, service='queue') + credential = account_key or sas_token or token_credential + + if account_url and credential: + return t_queue_service(account_url=account_url, credential=credential) + raise CLIError("Please provide valid connection string, or account name with account key, " + "sas token or login auth mode.") + + +def cf_queue_client(cli_ctx, kwargs): + return cf_queue_service(cli_ctx, kwargs).get_queue_client(queue=kwargs.pop('queue_name')) diff --git a/src/azure-cli/azure/cli/command_modules/storage/_help.py b/src/azure-cli/azure/cli/command_modules/storage/_help.py index 1e6bc4f703e..49a6415d6af 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_help.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_help.py @@ -2028,6 +2028,9 @@ helps['storage queue list'] = """ type: command short-summary: List queues in a storage account. +examples: + - name: List queues whose names begin with 'myprefix' under the storage account 'mystorageaccount'(account name) + text: az storage queue list --prefix myprefix --account-name mystorageaccount """ helps['storage queue metadata'] = """ @@ -2247,12 +2250,3 @@ type: group short-summary: Manage shared access policies of a storage table. """ - -helps['storage queue'] = """ -type: group -short-summary: Manage shared access policies of a storage table. -long-summary: > - Please specify one of the following authentication parameters for your commands: --auth-mode, --account-key, - --connection-string, --sas-token. You also can use corresponding environment variables to store your authentication - credentials, e.g. AZURE_STORAGE_KEY, AZURE_STORAGE_CONNECTION_STRING and AZURE_STORAGE_SAS_TOKEN. -""" diff --git a/src/azure-cli/azure/cli/command_modules/storage/_params.py b/src/azure-cli/azure/cli/command_modules/storage/_params.py index a443a915635..ffa442fa399 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_params.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_params.py @@ -1341,6 +1341,16 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem with self.argument_context('storage queue') as c: c.argument('queue_name', queue_name_type, options_list=('--name', '-n')) + with self.argument_context('storage queue list') as c: + c.argument('include_metadata', help='Specify that queue metadata be returned in the response.') + c.argument('marker', arg_type=marker_type) + c.argument('num_results', arg_type=num_results_type) + c.argument('prefix', help='Filter the results to return only queues whose names ' + 'begin with the specified prefix.') + c.argument('show_next_marker', action='store_true', + help='Show nextMarker in result when specified.') + c.extra('timeout', help='Request timeout in seconds. Apply to each call to the service.', type=int) + with self.argument_context('storage queue create') as c: c.argument('queue_name', queue_name_type, options_list=('--name', '-n'), completer=None) diff --git a/src/azure-cli/azure/cli/command_modules/storage/commands.py b/src/azure-cli/azure/cli/command_modules/storage/commands.py index 77e9c549445..008483ab610 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/commands.py +++ b/src/azure-cli/azure/cli/command_modules/storage/commands.py @@ -16,7 +16,8 @@ cf_adls_file_system, cf_adls_directory, cf_adls_file, cf_adls_service, cf_blob_client, cf_blob_lease_client, - cf_or_policy, cf_container_client) + cf_or_policy, cf_container_client, + cf_queue_service) from azure.cli.command_modules.storage.sdkutil import cosmosdb_table_exists from azure.cli.core.commands import CliCommandType @@ -605,8 +606,6 @@ def get_custom_sdk(custom_module, client_factory, resource_type=ResourceType.DAT from ._format import transform_boolean_for_table from ._transformers import create_boolean_result_output_transformer - g.storage_command_oauth('list', 'list_queues', - transform=transform_storage_list_output) g.storage_command_oauth('create', 'create_queue', transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_command_oauth('delete', 'delete_queue', transform=create_boolean_result_output_transformer('deleted'), @@ -646,6 +645,16 @@ def get_custom_sdk(custom_module, client_factory, resource_type=ResourceType.DAT g.storage_command_oauth('clear', 'clear_messages') g.storage_command_oauth('update', 'update_message') + queue_service_sdk = CliCommandType( + operations_tmpl='azure.multiapi.storagev2.queue._queue_service_client#QueueServiceClient.{}', + client_factory=cf_queue_service, resource_type=ResourceType.DATA_STORAGE_QUEUE) + + with self.command_group('storage queue', queue_service_sdk, + resource_type=ResourceType.DATA_STORAGE_QUEUE, min_api='2018-03-28', + custom_command_type=get_custom_sdk('queue', client_factory=cf_queue_service, + resource_type=ResourceType.DATA_STORAGE_QUEUE)) as g: + g.storage_custom_command_oauth('list', 'list_queues', transform=transform_storage_list_output) + if cosmosdb_table_exists(self.cli_ctx): table_sdk = CliCommandType(operations_tmpl='azure.multiapi.cosmosdb.table.tableservice#TableService.{}', client_factory=table_data_service_factory, diff --git a/src/azure-cli/azure/cli/command_modules/storage/operations/queue.py b/src/azure-cli/azure/cli/command_modules/storage/operations/queue.py new file mode 100644 index 00000000000..c17d75beb39 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/operations/queue.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from knack.log import get_logger + +logger = get_logger(__name__) + + +def list_queues(client, include_metadata=False, marker=None, num_results=None, + prefix=None, show_next_marker=None, **kwargs): + from ..track2_util import list_generator + generator = client.list_queues(name_starts_with=prefix, include_metadata=include_metadata, + results_per_page=num_results, **kwargs) + pages = generator.by_page(continuation_token=marker) + result = list_generator(pages=pages, num_results=num_results) + + if show_next_marker: + next_marker = {"nextMarker": pages.continuation_token} + result.append(next_marker) + else: + if pages.continuation_token: + logger.warning('Next Marker:') + logger.warning(pages.continuation_token) + + return result diff --git a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_general_scenario.yaml b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_general_scenario.yaml index 6f040ab4400..7cd5c7adf53 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_general_scenario.yaml +++ b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_general_scenario.yaml @@ -15,8 +15,8 @@ interactions: ParameterSetName: - -n -g --query -o User-Agent: - - python/3.7.7 (Windows-10-10.0.18362-SP0) msrest/0.6.13 msrest_azure/0.6.3 - azure-mgmt-storage/9.0.0 Azure-SDK-For-Python AZURECLI/2.7.0 + - python/3.7.9 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 + azure-mgmt-storage/11.2.0 Azure-SDK-For-Python AZURECLI/2.13.0 accept-language: - en-US method: POST @@ -32,7 +32,60 @@ interactions: content-type: - application/json date: - - Tue, 16 Jun 2020 02:30:44 GMT + - Wed, 14 Oct 2020 02:03:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage account show-connection-string + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g --query -o + User-Agent: + - python/3.7.9 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 + azure-mgmt-storage/11.2.0 Azure-SDK-For-Python AZURECLI/2.13.0 + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000002/listKeys?api-version=2019-06-01 + response: + body: + string: '{"keys":[{"keyName":"key1","value":"veryFakedStorageAccountKey==","permissions":"FULL"},{"keyName":"key2","value":"veryFakedStorageAccountKey==","permissions":"FULL"}]}' + headers: + cache-control: + - no-cache + content-length: + - '288' + content-type: + - application/json + date: + - Wed, 14 Oct 2020 02:04:00 GMT expires: - '-1' pragma: @@ -60,9 +113,9 @@ interactions: Content-Length: - '0' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:30:45 GMT + - Wed, 14 Oct 2020 02:04:00 GMT x-ms-meta-a: - b x-ms-meta-c: @@ -78,7 +131,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:30:46 GMT + - Wed, 14 Oct 2020 02:04:01 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -92,9 +145,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:30:46 GMT + - Wed, 14 Oct 2020 02:04:01 GMT x-ms-version: - '2018-03-28' method: GET @@ -108,7 +161,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:30:47 GMT + - Wed, 14 Oct 2020 02:04:02 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-approximate-messages-count: @@ -125,20 +178,62 @@ interactions: - request: body: null headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-queue/12.1.2 Python/3.7.9 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 14 Oct 2020 02:04:03 GMT + x-ms-version: + - '2018-03-28' + method: GET + uri: https://clitest000002.queue.core.windows.net/?maxresults=5000&comp=list + response: + body: + string: "\uFEFF5000queue000003" + headers: + cache-control: + - no-cache + content-type: + - application/xml + date: + - Wed, 14 Oct 2020 02:04:03 GMT + server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2018-03-28' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - azsdk-python-storage-queue/12.1.2 Python/3.7.9 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 16 Jun 2020 02:30:48 GMT + - Wed, 14 Oct 2020 02:04:04 GMT x-ms-version: - '2018-03-28' method: GET - uri: https://clitest000002.queue.core.windows.net/?comp=list + uri: https://clitest000002.queue.core.windows.net/?maxresults=5000&comp=list response: body: string: "\uFEFFqueue0000035000queue000003" headers: cache-control: @@ -146,7 +241,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:30:48 GMT + - Wed, 14 Oct 2020 02:04:04 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -162,9 +257,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:30:49 GMT + - Wed, 14 Oct 2020 02:04:05 GMT x-ms-version: - '2018-03-28' method: GET @@ -178,7 +273,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:30:50 GMT + - Wed, 14 Oct 2020 02:04:05 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-approximate-messages-count: @@ -200,9 +295,9 @@ interactions: Content-Length: - '0' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:30:51 GMT + - Wed, 14 Oct 2020 02:04:06 GMT x-ms-meta-e: - f x-ms-meta-g: @@ -218,7 +313,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:30:51 GMT + - Wed, 14 Oct 2020 02:04:06 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -232,9 +327,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:30:52 GMT + - Wed, 14 Oct 2020 02:04:07 GMT x-ms-version: - '2018-03-28' method: GET @@ -248,7 +343,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:30:53 GMT + - Wed, 14 Oct 2020 02:04:07 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-approximate-messages-count: @@ -268,9 +363,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:30:54 GMT + - Wed, 14 Oct 2020 02:04:08 GMT x-ms-version: - '2018-03-28' method: GET @@ -285,7 +380,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:30:54 GMT + - Wed, 14 Oct 2020 02:04:08 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -301,9 +396,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:30:55 GMT + - Wed, 14 Oct 2020 02:04:09 GMT x-ms-version: - '2018-03-28' method: GET @@ -318,7 +413,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:30:56 GMT + - Wed, 14 Oct 2020 02:04:09 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -338,9 +433,9 @@ interactions: Content-Length: - '264' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:30:56 GMT + - Wed, 14 Oct 2020 02:04:10 GMT x-ms-version: - '2018-03-28' method: PUT @@ -352,7 +447,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:30:57 GMT + - Wed, 14 Oct 2020 02:04:10 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -366,9 +461,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:30:57 GMT + - Wed, 14 Oct 2020 02:04:10 GMT x-ms-version: - '2018-03-28' method: GET @@ -382,7 +477,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:30:58 GMT + - Wed, 14 Oct 2020 02:04:11 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -398,9 +493,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:30:59 GMT + - Wed, 14 Oct 2020 02:04:11 GMT x-ms-version: - '2018-03-28' method: GET @@ -414,7 +509,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:30:59 GMT + - Wed, 14 Oct 2020 02:04:12 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -430,9 +525,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:00 GMT + - Wed, 14 Oct 2020 02:04:12 GMT x-ms-version: - '2018-03-28' method: GET @@ -446,7 +541,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:01 GMT + - Wed, 14 Oct 2020 02:04:12 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -466,9 +561,9 @@ interactions: Content-Length: - '268' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:01 GMT + - Wed, 14 Oct 2020 02:04:13 GMT x-ms-version: - '2018-03-28' method: PUT @@ -480,7 +575,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:31:02 GMT + - Wed, 14 Oct 2020 02:04:13 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -494,9 +589,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:02 GMT + - Wed, 14 Oct 2020 02:04:13 GMT x-ms-version: - '2018-03-28' method: GET @@ -510,7 +605,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:03 GMT + - Wed, 14 Oct 2020 02:04:14 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -526,9 +621,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:04 GMT + - Wed, 14 Oct 2020 02:04:14 GMT x-ms-version: - '2018-03-28' method: GET @@ -542,7 +637,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:04 GMT + - Wed, 14 Oct 2020 02:04:15 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -562,9 +657,9 @@ interactions: Content-Length: - '60' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:05 GMT + - Wed, 14 Oct 2020 02:04:15 GMT x-ms-version: - '2018-03-28' method: PUT @@ -576,7 +671,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:31:05 GMT + - Wed, 14 Oct 2020 02:04:15 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -590,9 +685,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:06 GMT + - Wed, 14 Oct 2020 02:04:16 GMT x-ms-version: - '2018-03-28' method: GET @@ -607,7 +702,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:07 GMT + - Wed, 14 Oct 2020 02:04:16 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -627,24 +722,24 @@ interactions: Content-Length: - '107' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:08 GMT + - Wed, 14 Oct 2020 02:04:17 GMT x-ms-version: - '2018-03-28' method: POST uri: https://clitest000002.queue.core.windows.net/queue000003/messages response: body: - string: "\uFEFF06848e6a-5eed-4888-afcd-a87cf106eaa9Tue, - 16 Jun 2020 02:31:09 GMTTue, 23 Jun 2020 02:31:09 - GMTAgAAAAMAAAAAAAAAKaGyMYZD1gE=Tue, - 16 Jun 2020 02:31:09 GMT" + string: "\uFEFFe5aef63d-9b46-49eb-b412-e4f097acc467Wed, + 14 Oct 2020 02:04:18 GMTWed, 21 Oct 2020 02:04:18 + GMTAgAAAAMAAAAAAAAAmVz3Us6h1gE=Wed, + 14 Oct 2020 02:04:18 GMT" headers: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:08 GMT + - Wed, 14 Oct 2020 02:04:17 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -660,17 +755,17 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:09 GMT + - Wed, 14 Oct 2020 02:04:18 GMT x-ms-version: - '2018-03-28' method: GET uri: https://clitest000002.queue.core.windows.net/queue000003/messages?peekonly=true response: body: - string: "\uFEFF06848e6a-5eed-4888-afcd-a87cf106eaa9Tue, - 16 Jun 2020 02:31:09 GMTTue, 23 Jun 2020 02:31:09 + string: "\uFEFFe5aef63d-9b46-49eb-b412-e4f097acc467Wed, + 14 Oct 2020 02:04:18 GMTWed, 21 Oct 2020 02:04:18 GMT0test message" headers: cache-control: @@ -678,7 +773,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:09 GMT + - Wed, 14 Oct 2020 02:04:18 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -694,19 +789,19 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:11 GMT + - Wed, 14 Oct 2020 02:04:19 GMT x-ms-version: - '2018-03-28' method: GET uri: https://clitest000002.queue.core.windows.net/queue000003/messages response: body: - string: "\uFEFF06848e6a-5eed-4888-afcd-a87cf106eaa9Tue, - 16 Jun 2020 02:31:09 GMTTue, 23 Jun 2020 02:31:09 - GMTAgAAAAMAAAAAAAAAvDhRRYZD1gE=Tue, - 16 Jun 2020 02:31:42 GMT1test + string: "\uFEFFe5aef63d-9b46-49eb-b412-e4f097acc467Wed, + 14 Oct 2020 02:04:18 GMTWed, 21 Oct 2020 02:04:18 + GMTAgAAAAMAAAAAAAAA1AIUZs6h1gE=Wed, + 14 Oct 2020 02:04:50 GMT1test message" headers: cache-control: @@ -714,7 +809,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:11 GMT + - Wed, 14 Oct 2020 02:04:20 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -734,13 +829,13 @@ interactions: Content-Length: - '107' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:12 GMT + - Wed, 14 Oct 2020 02:04:20 GMT x-ms-version: - '2018-03-28' method: PUT - uri: https://clitest000002.queue.core.windows.net/queue000003/messages/06848e6a-5eed-4888-afcd-a87cf106eaa9?popreceipt=AgAAAAMAAAAAAAAAvDhRRYZD1gE%3D&visibilitytimeout=1 + uri: https://clitest000002.queue.core.windows.net/queue000003/messages/e5aef63d-9b46-49eb-b412-e4f097acc467?popreceipt=AgAAAAMAAAAAAAAA1AIUZs6h1gE%3D&visibilitytimeout=1 response: body: string: '' @@ -748,13 +843,13 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:31:13 GMT + - Wed, 14 Oct 2020 02:04:21 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-popreceipt: - - AwAAAAMAAAAAAAAAqhL2NIZD1gEBAAAA + - AwAAAAMAAAAAAAAAV49mVc6h1gEBAAAA x-ms-time-next-visible: - - Tue, 16 Jun 2020 02:31:14 GMT + - Wed, 14 Oct 2020 02:04:22 GMT x-ms-version: - '2018-03-28' status: @@ -766,17 +861,17 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:16 GMT + - Wed, 14 Oct 2020 02:04:23 GMT x-ms-version: - '2018-03-28' method: GET uri: https://clitest000002.queue.core.windows.net/queue000003/messages?peekonly=true response: body: - string: "\uFEFF06848e6a-5eed-4888-afcd-a87cf106eaa9Tue, - 16 Jun 2020 02:31:09 GMTTue, 23 Jun 2020 02:31:09 + string: "\uFEFFe5aef63d-9b46-49eb-b412-e4f097acc467Wed, + 14 Oct 2020 02:04:18 GMTWed, 21 Oct 2020 02:04:18 GMT1new message!" headers: cache-control: @@ -784,7 +879,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:16 GMT + - Wed, 14 Oct 2020 02:04:23 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -804,24 +899,24 @@ interactions: Content-Length: - '109' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:17 GMT + - Wed, 14 Oct 2020 02:04:24 GMT x-ms-version: - '2018-03-28' method: POST uri: https://clitest000002.queue.core.windows.net/queue000003/messages response: body: - string: "\uFEFFf89a8a38-4281-4b04-89af-107a7993cb65Tue, - 16 Jun 2020 02:31:18 GMTTue, 23 Jun 2020 02:31:18 - GMTAgAAAAMAAAAAAAAAoNxHN4ZD1gE=Tue, - 16 Jun 2020 02:31:18 GMT" + string: "\uFEFFb49b403a-9685-48a2-8af7-75592d9fc5e8Wed, + 14 Oct 2020 02:04:25 GMTWed, 21 Oct 2020 02:04:25 + GMTAgAAAAMAAAAAAAAAoS81V86h1gE=Wed, + 14 Oct 2020 02:04:25 GMT" headers: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:18 GMT + - Wed, 14 Oct 2020 02:04:24 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -841,24 +936,24 @@ interactions: Content-Length: - '108' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:19 GMT + - Wed, 14 Oct 2020 02:04:25 GMT x-ms-version: - '2018-03-28' method: POST uri: https://clitest000002.queue.core.windows.net/queue000003/messages response: body: - string: "\uFEFFbbed9109-4dce-4e0c-b919-5ff3e71a8816Tue, - 16 Jun 2020 02:31:20 GMTTue, 23 Jun 2020 02:31:20 - GMTAgAAAAMAAAAAAAAAC01UOIZD1gE=Tue, - 16 Jun 2020 02:31:20 GMT" + string: "\uFEFF022e6d2c-ec5e-4889-bff5-1fa009b23bd1Wed, + 14 Oct 2020 02:04:26 GMTWed, 21 Oct 2020 02:04:26 + GMTAgAAAAMAAAAAAAAAPizQV86h1gE=Wed, + 14 Oct 2020 02:04:26 GMT" headers: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:20 GMT + - Wed, 14 Oct 2020 02:04:26 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -874,21 +969,21 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:20 GMT + - Wed, 14 Oct 2020 02:04:26 GMT x-ms-version: - '2018-03-28' method: GET uri: https://clitest000002.queue.core.windows.net/queue000003/messages?peekonly=true&numofmessages=32 response: body: - string: "\uFEFF06848e6a-5eed-4888-afcd-a87cf106eaa9Tue, - 16 Jun 2020 02:31:09 GMTTue, 23 Jun 2020 02:31:09 - GMT1new message!f89a8a38-4281-4b04-89af-107a7993cb65Tue, - 16 Jun 2020 02:31:18 GMTTue, 23 Jun 2020 02:31:18 - GMT0second messagebbed9109-4dce-4e0c-b919-5ff3e71a8816Tue, - 16 Jun 2020 02:31:20 GMTTue, 23 Jun 2020 02:31:20 + string: "\uFEFFe5aef63d-9b46-49eb-b412-e4f097acc467Wed, + 14 Oct 2020 02:04:18 GMTWed, 21 Oct 2020 02:04:18 + GMT1new message!b49b403a-9685-48a2-8af7-75592d9fc5e8Wed, + 14 Oct 2020 02:04:25 GMTWed, 21 Oct 2020 02:04:25 + GMT0second message022e6d2c-ec5e-4889-bff5-1fa009b23bd1Wed, + 14 Oct 2020 02:04:26 GMTWed, 21 Oct 2020 02:04:26 GMT0third message" headers: cache-control: @@ -896,7 +991,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:21 GMT + - Wed, 14 Oct 2020 02:04:26 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -912,19 +1007,19 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:22 GMT + - Wed, 14 Oct 2020 02:04:27 GMT x-ms-version: - '2018-03-28' method: GET uri: https://clitest000002.queue.core.windows.net/queue000003/messages response: body: - string: "\uFEFF06848e6a-5eed-4888-afcd-a87cf106eaa9Tue, - 16 Jun 2020 02:31:09 GMTTue, 23 Jun 2020 02:31:09 - GMTAgAAAAMAAAAAAAAAEvcHTIZD1gE=Tue, - 16 Jun 2020 02:31:53 GMT2new + string: "\uFEFFe5aef63d-9b46-49eb-b412-e4f097acc467Wed, + 14 Oct 2020 02:04:18 GMTWed, 21 Oct 2020 02:04:18 + GMTAgAAAAMAAAAAAAAAUjzzas6h1gE=Wed, + 14 Oct 2020 02:04:58 GMT2new message!" headers: cache-control: @@ -932,7 +1027,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:23 GMT + - Wed, 14 Oct 2020 02:04:27 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -950,13 +1045,13 @@ interactions: Content-Length: - '0' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:23 GMT + - Wed, 14 Oct 2020 02:04:28 GMT x-ms-version: - '2018-03-28' method: DELETE - uri: https://clitest000002.queue.core.windows.net/queue000003/messages/06848e6a-5eed-4888-afcd-a87cf106eaa9?popreceipt=AgAAAAMAAAAAAAAAEvcHTIZD1gE%3D + uri: https://clitest000002.queue.core.windows.net/queue000003/messages/e5aef63d-9b46-49eb-b412-e4f097acc467?popreceipt=AgAAAAMAAAAAAAAAUjzzas6h1gE%3D response: body: string: '' @@ -964,7 +1059,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:31:24 GMT + - Wed, 14 Oct 2020 02:04:29 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -978,19 +1073,19 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:25 GMT + - Wed, 14 Oct 2020 02:04:29 GMT x-ms-version: - '2018-03-28' method: GET uri: https://clitest000002.queue.core.windows.net/queue000003/messages?peekonly=true&numofmessages=32 response: body: - string: "\uFEFFf89a8a38-4281-4b04-89af-107a7993cb65Tue, - 16 Jun 2020 02:31:18 GMTTue, 23 Jun 2020 02:31:18 - GMT0second messagebbed9109-4dce-4e0c-b919-5ff3e71a8816Tue, - 16 Jun 2020 02:31:20 GMTTue, 23 Jun 2020 02:31:20 + string: "\uFEFFb49b403a-9685-48a2-8af7-75592d9fc5e8Wed, + 14 Oct 2020 02:04:25 GMTWed, 21 Oct 2020 02:04:25 + GMT0second message022e6d2c-ec5e-4889-bff5-1fa009b23bd1Wed, + 14 Oct 2020 02:04:26 GMTWed, 21 Oct 2020 02:04:26 GMT0third message" headers: cache-control: @@ -998,7 +1093,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:25 GMT + - Wed, 14 Oct 2020 02:04:29 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -1016,9 +1111,9 @@ interactions: Content-Length: - '0' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:26 GMT + - Wed, 14 Oct 2020 02:04:30 GMT x-ms-version: - '2018-03-28' method: DELETE @@ -1030,7 +1125,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:31:27 GMT + - Wed, 14 Oct 2020 02:04:31 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -1044,9 +1139,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:28 GMT + - Wed, 14 Oct 2020 02:04:31 GMT x-ms-version: - '2018-03-28' method: GET @@ -1061,7 +1156,7 @@ interactions: content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:29 GMT + - Wed, 14 Oct 2020 02:04:31 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -1079,9 +1174,9 @@ interactions: Content-Length: - '0' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:29 GMT + - Wed, 14 Oct 2020 02:04:32 GMT x-ms-version: - '2018-03-28' method: DELETE @@ -1093,7 +1188,7 @@ interactions: content-length: - '0' date: - - Tue, 16 Jun 2020 02:31:30 GMT + - Wed, 14 Oct 2020 02:04:32 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -1107,9 +1202,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:31 GMT + - Wed, 14 Oct 2020 02:04:33 GMT x-ms-version: - '2018-03-28' method: GET @@ -1117,14 +1212,14 @@ interactions: response: body: string: "\uFEFFQueueNotFoundThe - specified queue does not exist.\nRequestId:e6fa9d2e-f003-00bc-1986-43fa73000000\nTime:2020-06-16T02:31:32.4333769Z" + specified queue does not exist.\nRequestId:b8b59a1c-a003-004c-52ce-a136b0000000\nTime:2020-10-14T02:04:34.6281600Z" headers: content-length: - '217' content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:31 GMT + - Wed, 14 Oct 2020 02:04:34 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-error-code: @@ -1140,24 +1235,24 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Tue, 16 Jun 2020 02:31:32 GMT + - Wed, 14 Oct 2020 02:04:34 GMT x-ms-version: - '2018-03-28' method: GET uri: https://clitest000002-secondary.queue.core.windows.net/?restype=service&comp=stats response: body: - string: "\uFEFFliveTue, - 16 Jun 2020 02:28:32 GMT" + string: "\uFEFFliveWed, + 14 Oct 2020 02:01:40 GMT" headers: cache-control: - no-cache content-type: - application/xml date: - - Tue, 16 Jun 2020 02:31:33 GMT + - Wed, 14 Oct 2020 02:04:35 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: diff --git a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_list_oauth.yaml b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_list_oauth.yaml new file mode 100644 index 00000000000..85507ab3afa --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_list_oauth.yaml @@ -0,0 +1,328 @@ +interactions: +- request: + body: null + headers: + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.12.1 + x-ms-date: + - Sat, 10 Oct 2020 09:18:53 GMT + x-ms-meta-key1: + - value1 + x-ms-version: + - '2018-03-28' + method: PUT + uri: https://storage000002.queue.core.windows.net/firstq000003 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Sat, 10 Oct 2020 09:18:54 GMT + server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2018-03-28' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-queue/12.1.2 Python/3.7.9 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Sat, 10 Oct 2020 09:18:55 GMT + x-ms-version: + - '2018-03-28' + method: GET + uri: https://storage000002.queue.core.windows.net/?maxresults=5000&comp=list + response: + body: + string: "\uFEFF5000firstq000003" + headers: + cache-control: + - no-cache + content-type: + - application/xml + date: + - Sat, 10 Oct 2020 09:18:55 GMT + server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2018-03-28' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-queue/12.1.2 Python/3.7.9 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Sat, 10 Oct 2020 09:18:56 GMT + x-ms-version: + - '2018-03-28' + method: GET + uri: https://storage000002.queue.core.windows.net/?maxresults=5000&include=metadata&comp=list + response: + body: + string: "\uFEFF5000firstq000003value1" + headers: + cache-control: + - no-cache + content-type: + - application/xml + date: + - Sat, 10 Oct 2020 09:18:56 GMT + server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2018-03-28' + status: + code: 200 + message: OK +- request: + body: null + headers: + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.12.1 + x-ms-date: + - Sat, 10 Oct 2020 09:18:57 GMT + x-ms-version: + - '2018-03-28' + method: PUT + uri: https://storage000002.queue.core.windows.net/secondq000004 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Sat, 10 Oct 2020 09:18:58 GMT + server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2018-03-28' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-queue/12.1.2 Python/3.7.9 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Sat, 10 Oct 2020 09:18:58 GMT + x-ms-version: + - '2018-03-28' + method: GET + uri: https://storage000002.queue.core.windows.net/?maxresults=5000&comp=list + response: + body: + string: "\uFEFF5000firstq000003secondq000004" + headers: + cache-control: + - no-cache + content-type: + - application/xml + date: + - Sat, 10 Oct 2020 09:18:59 GMT + server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2018-03-28' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-queue/12.1.2 Python/3.7.9 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Sat, 10 Oct 2020 09:19:00 GMT + x-ms-version: + - '2018-03-28' + method: GET + uri: https://storage000002.queue.core.windows.net/?maxresults=1&comp=list + response: + body: + string: "\uFEFF1firstq000003/storage000002/secondq000004" + headers: + cache-control: + - no-cache + content-type: + - application/xml + date: + - Sat, 10 Oct 2020 09:19:00 GMT + server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2018-03-28' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-queue/12.1.2 Python/3.7.9 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Sat, 10 Oct 2020 09:19:01 GMT + x-ms-version: + - '2018-03-28' + method: GET + uri: https://storage000002.queue.core.windows.net/?maxresults=1&comp=list + response: + body: + string: "\uFEFF1firstq000003/storage000002/secondq000004" + headers: + cache-control: + - no-cache + content-type: + - application/xml + date: + - Sat, 10 Oct 2020 09:19:01 GMT + server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2018-03-28' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-queue/12.1.2 Python/3.7.9 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Sat, 10 Oct 2020 09:19:02 GMT + x-ms-version: + - '2018-03-28' + method: GET + uri: https://storage000002.queue.core.windows.net/?marker=%2Fstorage000002%2Fsecondq000004&maxresults=5000&comp=list + response: + body: + string: "\uFEFF/storage000002/secondq0000045000secondq000004" + headers: + cache-control: + - no-cache + content-type: + - application/xml + date: + - Sat, 10 Oct 2020 09:19:03 GMT + server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2018-03-28' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-queue/12.1.2 Python/3.7.9 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Sat, 10 Oct 2020 09:19:03 GMT + x-ms-version: + - '2018-03-28' + method: GET + uri: https://storage000002.queue.core.windows.net/?prefix=second&maxresults=5000&comp=list + response: + body: + string: "\uFEFFsecond5000secondq000004" + headers: + cache-control: + - no-cache + content-type: + - application/xml + date: + - Sat, 10 Oct 2020 09:19:04 GMT + server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2018-03-28' + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_oauth.yaml b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_oauth.yaml index 9fb544555bf..9fea9418cae 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_oauth.yaml +++ b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_queue_oauth.yaml @@ -7,9 +7,9 @@ interactions: Content-Length: - '0' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Fri, 05 Jun 2020 09:04:02 GMT + - Tue, 13 Oct 2020 09:29:40 GMT x-ms-meta-a: - b x-ms-meta-c: @@ -25,7 +25,7 @@ interactions: content-length: - '0' date: - - Fri, 05 Jun 2020 09:04:13 GMT + - Tue, 13 Oct 2020 09:29:49 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -39,9 +39,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Fri, 05 Jun 2020 09:04:14 GMT + - Tue, 13 Oct 2020 09:29:49 GMT x-ms-version: - '2018-03-28' method: GET @@ -55,7 +55,7 @@ interactions: content-length: - '0' date: - - Fri, 05 Jun 2020 09:04:15 GMT + - Tue, 13 Oct 2020 09:29:50 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-approximate-messages-count: @@ -75,43 +75,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Fri, 05 Jun 2020 09:04:16 GMT - x-ms-version: - - '2018-03-28' - method: GET - uri: https://clitest000002.queue.core.windows.net/?comp=list - response: - body: - string: "\uFEFFqueue000003" - headers: - cache-control: - - no-cache - content-type: - - application/xml - date: - - Fri, 05 Jun 2020 09:04:17 GMT - server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: - - chunked - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK -- request: - body: null - headers: - Connection: - - keep-alive - User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 - x-ms-date: - - Fri, 05 Jun 2020 09:04:18 GMT + - Tue, 13 Oct 2020 09:29:50 GMT x-ms-version: - '2018-03-28' method: GET @@ -125,7 +91,7 @@ interactions: content-length: - '0' date: - - Fri, 05 Jun 2020 09:04:18 GMT + - Tue, 13 Oct 2020 09:29:51 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-approximate-messages-count: @@ -147,9 +113,9 @@ interactions: Content-Length: - '0' User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Fri, 05 Jun 2020 09:04:19 GMT + - Tue, 13 Oct 2020 09:29:51 GMT x-ms-meta-e: - f x-ms-meta-g: @@ -165,7 +131,7 @@ interactions: content-length: - '0' date: - - Fri, 05 Jun 2020 09:04:19 GMT + - Tue, 13 Oct 2020 09:29:52 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -179,9 +145,9 @@ interactions: Connection: - keep-alive User-Agent: - - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.7; Windows 10) AZURECLI/2.7.0 + - Azure-Storage/2.0.0-2.0.1 (Python CPython 3.7.9; Windows 10) AZURECLI/2.13.0 x-ms-date: - - Fri, 05 Jun 2020 09:04:21 GMT + - Tue, 13 Oct 2020 09:29:52 GMT x-ms-version: - '2018-03-28' method: GET @@ -195,7 +161,7 @@ interactions: content-length: - '0' date: - - Fri, 05 Jun 2020 09:04:21 GMT + - Tue, 13 Oct 2020 09:29:53 GMT server: - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 x-ms-approximate-messages-count: diff --git a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_oauth.py b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_oauth.py index 41b2aa4336b..a1e30ec1f59 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_oauth.py +++ b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_oauth.py @@ -57,9 +57,6 @@ def test_storage_queue_oauth(self, resource_group, storage_account): self.oauth_cmd('storage queue exists -n {queue} --account-name {account}', checks=[ JMESPathCheck('exists', True)]) - res = self.oauth_cmd('storage queue list --account-name {account}').get_output_in_json() - self.assertIn(self.kwargs.get('queue'), [x['name'] for x in res], 'The newly created queue is not listed.') - self.oauth_cmd('storage queue metadata show -n {queue} --account-name {account}', checks=[ JMESPathCheck('a', 'b'), JMESPathCheck('c', 'd') diff --git a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_oauth_track2.py b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_oauth_track2.py index d90307d6b0d..726b293a6d8 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_oauth_track2.py +++ b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_oauth_track2.py @@ -145,7 +145,7 @@ def test_storage_blob_show_oauth(self, resource_group, storage_account): # test block blob self.oauth_cmd('storage blob upload -c {container} -n {block} -f "{local_file}" --account-name {sa}') - self.oauth_cmd('storage blob show -c {container} -n {block} --account-name {sa}')\ + self.oauth_cmd('storage blob show -c {container} -n {block} --account-name {sa}') \ .assert_with_checks(JMESPathCheck('name', self.kwargs['block']), JMESPathCheck('deleted', False), JMESPathCheck('encryptionScope', None), @@ -184,7 +184,7 @@ def test_storage_blob_show_oauth(self, resource_group, storage_account): JMESPathCheck('tagCount', None), JMESPathCheck('versionId', None)) - self.kwargs['etag'] = self.oauth_cmd('storage blob show -c {container} -n {block} --account-name {sa}')\ + self.kwargs['etag'] = self.oauth_cmd('storage blob show -c {container} -n {block} --account-name {sa}') \ .get_output_in_json()['properties']['etag'] # test page blob @@ -198,7 +198,7 @@ def test_storage_blob_show_oauth(self, resource_group, storage_account): JMESPathCheckExists('properties.pageRanges')) # test snapshot - self.kwargs['snapshot'] = self.oauth_cmd('storage blob snapshot -c {container} -n {block} --account-name {sa}')\ + self.kwargs['snapshot'] = self.oauth_cmd('storage blob snapshot -c {container} -n {block} --account-name {sa}') \ .get_output_in_json()['snapshot'] self.oauth_cmd('storage blob show -c {container} -n {block} --account-name {sa}') \ .assert_with_checks(JMESPathCheck('name', self.kwargs['block']), @@ -230,9 +230,11 @@ def test_storage_blob_show_oauth(self, resource_group, storage_account): self.oauth_cmd('storage blob show -c {container} -n {block} --account-name {sa} --if-none-match *') with self.assertRaisesRegex(ResourceModifiedError, 'ErrorCode:ConditionNotMet'): - self.oauth_cmd('storage blob show -c {container} -n {block} --account-name {sa} --if-unmodified-since "2020-06-29T06:32Z"') + self.oauth_cmd( + 'storage blob show -c {container} -n {block} --account-name {sa} --if-unmodified-since "2020-06-29T06:32Z"') - self.oauth_cmd('storage blob show -c {container} -n {block} --account-name {sa} --if-modified-since "2020-06-29T06:32Z"') \ + self.oauth_cmd( + 'storage blob show -c {container} -n {block} --account-name {sa} --if-modified-since "2020-06-29T06:32Z"') \ .assert_with_checks(JMESPathCheck('name', self.kwargs['block']), JMESPathCheck('properties.blobType', 'BlockBlob'), JMESPathCheck('properties.contentLength', 128 * 1024), @@ -257,7 +259,7 @@ def test_storage_blob_list_oauth(self, resource_group, storage_account): self.oauth_cmd('storage blob upload -c {container} -f "{local_file}" -n {blob_name1} --account-name {account} ') # Test with include snapshot - result = self.oauth_cmd('storage blob snapshot -c {container} -n {blob_name1} --account-name {account} ')\ + result = self.oauth_cmd('storage blob snapshot -c {container} -n {blob_name1} --account-name {account} ') \ .get_output_in_json() self.assertIsNotNone(result['snapshot']) snapshot = result['snapshot'] @@ -266,8 +268,9 @@ def test_storage_blob_list_oauth(self, resource_group, storage_account): .assert_with_checks(JMESPathCheck('[0].snapshot', snapshot)) # Test with metadata - self.oauth_cmd('storage blob metadata update -c {container} -n {blob_name1} --metadata test=1 --account-name {account} ') - self.oauth_cmd('storage blob metadata show -c {container} -n {blob_name1} --account-name {account} ')\ + self.oauth_cmd( + 'storage blob metadata update -c {container} -n {blob_name1} --metadata test=1 --account-name {account} ') + self.oauth_cmd('storage blob metadata show -c {container} -n {blob_name1} --account-name {account} ') \ .assert_with_checks(JMESPathCheck('test', '1')) self.oauth_cmd('storage blob list -c {container} --include m --account-name {account} ') \ @@ -284,7 +287,7 @@ def test_storage_blob_list_oauth(self, resource_group, storage_account): JMESPathCheck('length(@)', 1)) result = self.oauth_cmd( - 'storage blob list -c {container} --num-results 1 --show-next-marker --account-name {account} ')\ + 'storage blob list -c {container} --num-results 1 --show-next-marker --account-name {account} ') \ .get_output_in_json() self.assertIsNotNone(result[1]['nextMarker']) self.kwargs['next_marker'] = result[1]['nextMarker'] @@ -302,6 +305,51 @@ def test_storage_blob_list_oauth(self, resource_group, storage_account): .assert_with_checks(JMESPathCheck('length(@)', 1), JMESPathCheck('[0].name', 'dir/')) + @ResourceGroupPreparer(name_prefix='clitest') + @StorageAccountPreparer(name_prefix='storage', kind='StorageV2', location='eastus2', sku='Standard_RAGZRS') + def test_storage_queue_list_oauth(self, resource_group, storage_account): + self.kwargs.update({ + 'rg': resource_group, + 'account': storage_account, + 'queue_name1': self.create_random_name(prefix='firstq', length=24), + 'queue_name2': self.create_random_name(prefix='secondq', length=24) + }) + + # Prepare queue 1 + self.oauth_cmd('storage queue create -n {queue_name1} --metadata key1=value1 --account-name {account} ') + + # Test list + self.oauth_cmd('storage queue list --account-name {account}') \ + .assert_with_checks(JMESPathCheck('length(@)', 1), JMESPathCheck('[0].metadata', None)) + + # Test with include-metadata + self.oauth_cmd('storage queue list --include-metadata --account-name {account} ') \ + .assert_with_checks(JMESPathCheck('length(@)', 1), JMESPathCheck('[0].metadata.key1', 'value1')) + + # Prepare queue 2 + self.oauth_cmd('storage queue create -n {queue_name2} --account-name {account} ') + + self.oauth_cmd('storage queue list --account-name {account}') \ + .assert_with_checks(JMESPathCheck('length(@)', 2)) + + # Test num_results and next marker + self.oauth_cmd('storage queue list --num-results 1 --account-name {account} ') \ + .assert_with_checks(JMESPathCheck('length(@)', 1)) + + result = self.oauth_cmd( + 'storage queue list --num-results 1 --show-next-marker --account-name {account} ') \ + .get_output_in_json() + self.assertIsNotNone(result[1]['nextMarker']) + self.kwargs['next_marker'] = result[1]['nextMarker'] + + # Test with marker + self.oauth_cmd('storage queue list --marker {next_marker} --account-name {account} ') \ + .assert_with_checks(JMESPathCheck('length(@)', 1)) + + # Test with prefix + self.oauth_cmd('storage queue list --prefix second --account-name {account} ') \ + .assert_with_checks(JMESPathCheck('length(@)', 1)) + @api_version_constraint(ResourceType.DATA_STORAGE_BLOB, min_api='2019-02-02') class StorageBlobSetTierOauthTests(StorageScenarioMixin, ScenarioTest): diff --git a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_queue_scenarios.py b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_queue_scenarios.py index e178aa46b76..339c451a674 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_queue_scenarios.py +++ b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_queue_scenarios.py @@ -17,6 +17,7 @@ def test_storage_queue_general_scenario(self, resource_group, storage_account): from datetime import datetime, timedelta account_key = self.get_account_key(resource_group, storage_account) + connection_string = self.get_connection_string(resource_group, storage_account) self.set_env('AZURE_STORAGE_ACCOUNT', storage_account) self.set_env('AZURE_STORAGE_KEY', account_key) @@ -31,6 +32,10 @@ def test_storage_queue_general_scenario(self, resource_group, storage_account): res = self.cmd('storage queue list').get_output_in_json() self.assertIn(queue, [x['name'] for x in res], 'The newly created queue is not listed.') + # test list with connection-string + res = self.cmd('storage queue list --connection-string {}'.format(connection_string)).get_output_in_json() + self.assertIn(queue, [x['name'] for x in res], 'The newly created queue is not listed.') + expiry = (datetime.utcnow() + timedelta(hours=1)).strftime('%Y-%m-%dT%H:%MZ') sas = self.cmd('storage queue generate-sas -n {} --permissions r --expiry {}'.format(queue, expiry)).output self.assertIn('sig', sas, 'The sig segment is not in the sas {}'.format(sas)) @@ -122,6 +127,10 @@ def get_account_key(self, group, name): return self.cmd('storage account keys list -n {} -g {} --query "[0].value" -otsv' .format(name, group)).output + def get_connection_string(self, group, name): + return self.cmd('storage account show-connection-string -n {} -g {} ' + '--query connectionString -otsv'.format(name, group)).output.strip() + if __name__ == '__main__': import unittest