From 60ada0b5b92d9bb23c547359ba864c685b11ebd5 Mon Sep 17 00:00:00 2001 From: Xiaoxi Fu <49707495+xiafu-msft@users.noreply.github.com> Date: Wed, 10 Jun 2020 14:42:01 -0700 Subject: [PATCH] [Blob][STG73]Blob Tags (#11418) --- .../azure/storage/blob/__init__.py | 2 + .../azure/storage/blob/_blob_client.py | 147 +++++- .../storage/blob/_blob_service_client.py | 33 +- .../azure/storage/blob/_container_client.py | 6 +- .../azure/storage/blob/_generated/version.py | 2 +- .../azure/storage/blob/_models.py | 99 ++++ .../azure/storage/blob/_serialize.py | 32 +- .../azure/storage/blob/_upload_helpers.py | 10 + .../storage/blob/aio/_blob_client_async.py | 116 ++++- .../blob/aio/_blob_service_client_async.py | 33 +- .../blob/aio/_container_client_async.py | 6 +- .../azure/storage/blob/aio/_models.py | 72 ++- .../azure/storage/blob/aio/_upload_helpers.py | 10 + ...tags.test_commit_block_list_with_tags.yaml | 296 ++++++++++++ ...ags.test_create_append_blob_with_tags.yaml | 122 +++++ ..._tags.test_create_page_blob_with_tags.yaml | 122 +++++ .../test_blob_tags.test_filter_blobs.yaml | 428 ++++++++++++++++++ ..._get_blob_properties_returns_tags_num.yaml | 217 +++++++++ .../test_blob_tags.test_get_blob_tags.yaml | 163 +++++++ ...ags.test_get_blob_tags_for_a_snapshot.yaml | 171 +++++++ ...lob_tags.test_list_blobs_returns_tags.yaml | 132 ++++++ .../test_blob_tags.test_set_blob_tags.yaml | 128 ++++++ ...tags.test_set_blob_tags_for_a_version.yaml | 180 ++++++++ ...gs.test_start_copy_from_url_with_tags.yaml | 246 ++++++++++ ...tags.test_upload_block_blob_with_tags.yaml | 126 ++++++ ...sync.test_commit_block_list_with_tags.yaml | 213 +++++++++ ...ync.test_create_append_blob_with_tags.yaml | 87 ++++ ...async.test_create_page_blob_with_tags.yaml | 88 ++++ ...est_blob_tags_async.test_filter_blobs.yaml | 308 +++++++++++++ ..._get_blob_properties_returns_tags_num.yaml | 143 ++++++ ...st_blob_tags_async.test_get_blob_tags.yaml | 118 +++++ ...ync.test_get_blob_tags_for_a_snapshot.yaml | 119 +++++ ...gs_async.test_list_blobs_returns_tags.yaml | 96 ++++ ...st_blob_tags_async.test_set_blob_tags.yaml | 92 ++++ ...sync.test_set_blob_tags_for_a_version.yaml | 129 ++++++ ...nc.test_start_copy_from_url_with_tags.yaml | 168 +++++++ ...sync.test_upload_block_blob_with_tags.yaml | 90 ++++ .../tests/test_blob_tags.py | 287 ++++++++++++ .../tests/test_blob_tags_async.py | 294 ++++++++++++ 39 files changed, 5113 insertions(+), 18 deletions(-) create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_commit_block_list_with_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_create_append_blob_with_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_create_page_blob_with_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_filter_blobs.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_properties_returns_tags_num.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_tags_for_a_snapshot.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_list_blobs_returns_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_set_blob_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_set_blob_tags_for_a_version.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_start_copy_from_url_with_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_upload_block_blob_with_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_commit_block_list_with_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_create_append_blob_with_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_create_page_blob_with_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_filter_blobs.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_properties_returns_tags_num.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_tags_for_a_snapshot.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_list_blobs_returns_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_set_blob_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_set_blob_tags_for_a_version.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_start_copy_from_url_with_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_upload_block_blob_with_tags.yaml create mode 100644 sdk/storage/azure-storage-blob/tests/test_blob_tags.py create mode 100644 sdk/storage/azure-storage-blob/tests/test_blob_tags_async.py diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py index 39d68159442e..6976c963a457 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py @@ -41,6 +41,7 @@ CorsRule, ContainerProperties, BlobProperties, + FilteredBlob, LeaseProperties, ContentSettings, CopyProperties, @@ -192,6 +193,7 @@ def download_blob_from_url( 'CorsRule', 'ContainerProperties', 'BlobProperties', + 'FilteredBlob', 'LeaseProperties', 'ContentSettings', 'CopyProperties', diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py index 0f04e4884dd6..1da944103ce9 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py @@ -38,14 +38,14 @@ QueryRequest, CpkInfo) from ._serialize import get_modify_conditions, get_source_conditions, get_cpk_scope_info, get_api_version, \ - get_quick_query_serialization_info + serialize_blob_tags_header, serialize_blob_tags, get_quick_query_serialization_info from ._deserialize import get_page_ranges_result, deserialize_blob_properties, deserialize_blob_stream from ._quick_query_helper import QuickQueryReader from ._upload_helpers import ( upload_block_blob, upload_append_blob, upload_page_blob) -from ._models import BlobType, BlobBlock +from ._models import BlobType, BlobBlock, BlobProperties from ._download import StorageStreamDownloader from ._lease import BlobLeaseClient, get_access_conditions @@ -358,6 +358,7 @@ def _upload_blob_options( # pylint:disable=too-many-statements blob_content_language=content_settings.content_language, blob_content_disposition=content_settings.content_disposition ) + kwargs['blob_tags_string'] = serialize_blob_tags_header(kwargs.pop('tags', None)) kwargs['stream'] = stream kwargs['length'] = length kwargs['overwrite'] = overwrite @@ -399,6 +400,16 @@ def upload_blob( # pylint: disable=too-many-locals :param metadata: Name-value pairs associated with the blob as metadata. :type metadata: dict(str, str) + :keyword tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + + .. versionadded:: 12.4.0 + + :paramtype tags: dict(str, str) :keyword bool overwrite: Whether the blob to be uploaded should overwrite the current data. If True, upload_blob will overwrite the existing data. If set to False, the operation will fail with ResourceExistsError. The exception to the above is with Append @@ -1104,6 +1115,9 @@ def _create_page_blob_options( # type: ignore headers['x-ms-access-tier'] = premium_page_blob_tier.value # type: ignore except AttributeError: headers['x-ms-access-tier'] = premium_page_blob_tier # type: ignore + + blob_tags_string = serialize_blob_tags_header(kwargs.pop('tags', None)) + options = { 'content_length': 0, 'blob_content_length': size, @@ -1114,6 +1128,7 @@ def _create_page_blob_options( # type: ignore 'modified_access_conditions': mod_conditions, 'cpk_scope_info': cpk_scope_info, 'cpk_info': cpk_info, + 'blob_tags_string': blob_tags_string, 'cls': return_response_headers, 'headers': headers} options.update(kwargs) @@ -1143,6 +1158,16 @@ def create_page_blob( # type: ignore A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. + :keyword tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + + .. versionadded:: 12.4.0 + + :paramtype tags: dict(str, str) :keyword int sequence_number: Only for Page blobs. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 @@ -1224,6 +1249,7 @@ def _create_append_blob_options(self, content_settings=None, metadata=None, **kw raise ValueError("Customer provided encryption key must be used over HTTPS.") cpk_info = CpkInfo(encryption_key=cpk.key_value, encryption_key_sha256=cpk.key_hash, encryption_algorithm=cpk.algorithm) + blob_tags_string = serialize_blob_tags_header(kwargs.pop('tags', None)) options = { 'content_length': 0, @@ -1233,6 +1259,7 @@ def _create_append_blob_options(self, content_settings=None, metadata=None, **kw 'modified_access_conditions': mod_conditions, 'cpk_scope_info': cpk_scope_info, 'cpk_info': cpk_info, + 'blob_tags_string': blob_tags_string, 'cls': return_response_headers, 'headers': headers} options.update(kwargs) @@ -1249,6 +1276,16 @@ def create_append_blob(self, content_settings=None, metadata=None, **kwargs): :param metadata: Name-value pairs associated with the blob as metadata. :type metadata: dict(str, str) + :keyword tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + + .. versionadded:: 12.4.0 + + :paramtype tags: dict(str, str) :keyword lease: Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. @@ -1411,10 +1448,13 @@ def _start_copy_from_url_options(self, source_url, metadata=None, incremental_co timeout = kwargs.pop('timeout', None) dest_mod_conditions = get_modify_conditions(kwargs) + blob_tags_string = serialize_blob_tags_header(kwargs.pop('tags', None)) + options = { 'copy_source': source_url, 'timeout': timeout, 'modified_access_conditions': dest_mod_conditions, + 'blob_tags_string': blob_tags_string, 'headers': headers, 'cls': return_response_headers, } @@ -1486,6 +1526,16 @@ def start_copy_from_url(self, source_url, metadata=None, incremental_copy=False, the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. Defaults to False. + :keyword tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + + .. versionadded:: 12.4.0 + + :paramtype tags: dict(str, str) :keyword ~datetime.datetime source_if_modified_since: A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. @@ -1998,6 +2048,7 @@ def _commit_block_list_options( # type: ignore encryption_algorithm=cpk.algorithm) tier = kwargs.pop('standard_blob_tier', None) + blob_tags_string = serialize_blob_tags_header(kwargs.pop('tags', None)) options = { 'blocks': block_lookup, @@ -2010,6 +2061,7 @@ def _commit_block_list_options( # type: ignore 'cpk_scope_info': cpk_scope_info, 'cpk_info': cpk_info, 'tier': tier.value if tier else None, + 'blob_tags_string': blob_tags_string, 'headers': headers } options.update(kwargs) @@ -2034,6 +2086,16 @@ def commit_block_list( # type: ignore :param metadata: Name-value pairs associated with the blob as metadata. :type metadata: dict[str, str] + :keyword tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + + .. versionadded:: 12.4.0 + + :paramtype tags: dict(str, str) :keyword lease: Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. @@ -2125,6 +2187,87 @@ def set_premium_page_blob_tier(self, premium_page_blob_tier, **kwargs): except StorageErrorException as error: process_storage_error(error) + def _set_blob_tags_options(self, tags=None, **kwargs): + # type: (Optional[Dict[str, str]], **Any) -> Dict[str, Any] + tags = serialize_blob_tags(tags) + + options = { + 'tags': tags, + 'cls': return_response_headers} + options.update(kwargs) + return options + + @distributed_trace + def set_blob_tags(self, tags=None, **kwargs): + # type: (Optional[Dict[str, str]], **Any) -> Dict[str, Any] + """The Set Tags operation enables users to set tags on a blob or specific blob version, but not snapshot. + Each call to this operation replaces all existing tags attached to the blob. To remove all + tags from the blob, call this operation with no tags set. + + .. versionadded:: 12.4.0 + This operation was introduced in API version '2019-12-12'. + + :param tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + :type tags: dict(str, str) + :keyword str version_id: + The version id parameter is an opaque DateTime + value that, when present, specifies the version of the blob to add tags to. + :keyword bool validate_content: + If true, calculates an MD5 hash of the tags content. The storage + service checks the hash of the content that has arrived + with the hash that was sent. This is primarily valuable for detecting + bitflips on the wire if using http instead of https, as https (the default), + will already validate. Note that this MD5 hash is not stored with the + blob. + :keyword int timeout: + The timeout parameter is expressed in seconds. + :returns: Blob-updated property dict (Etag and last modified) + :rtype: Dict[str, Any] + """ + options = self._set_blob_tags_options(tags=tags, **kwargs) + try: + return self._client.blob.set_tags(**options) + except StorageErrorException as error: + process_storage_error(error) + + def _get_blob_tags_options(self, **kwargs): + # type: (**Any) -> Dict[str, str] + + options = { + 'version_id': kwargs.pop('version_id', None), + 'snapshot': self.snapshot, + 'timeout': kwargs.pop('timeout', None), + 'cls': return_headers_and_deserialized} + return options + + @distributed_trace + def get_blob_tags(self, **kwargs): + # type: (**Any) -> Dict[str, str] + """The Get Tags operation enables users to get tags on a blob or specific blob version, or snapshot. + + .. versionadded:: 12.4.0 + This operation was introduced in API version '2019-12-12'. + + :keyword str version_id: + The version id parameter is an opaque DateTime + value that, when present, specifies the version of the blob to add tags to. + :keyword int timeout: + The timeout parameter is expressed in seconds. + :returns: Key value pairs of blob tags. + :rtype: Dict[str, str] + """ + options = self._get_blob_tags_options(**kwargs) + try: + _, tags = self._client.blob.get_tags(**options) + return BlobProperties._parse_tags(tags) # pylint: disable=protected-access + except StorageErrorException as error: + process_storage_error(error) + def _get_page_ranges_options( # type: ignore self, offset=None, # type: Optional[int] length=None, # type: Optional[int] diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client.py index 1100f1657b1f..bb38436876da 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client.py @@ -28,7 +28,7 @@ from ._generated.models import StorageErrorException, StorageServiceProperties, KeyInfo from ._container_client import ContainerClient from ._blob_client import BlobClient -from ._models import ContainerPropertiesPaged +from ._models import ContainerPropertiesPaged, FilteredBlobPaged from ._serialize import get_api_version from ._deserialize import service_stats_deserialize, service_properties_deserialize @@ -426,6 +426,37 @@ def list_containers( page_iterator_class=ContainerPropertiesPaged ) + @distributed_trace + def find_blobs_by_tags(self, filter_expression, **kwargs): + # type: (str, **Any) -> ItemPaged[FilteredBlob] + """The Filter Blobs operation enables callers to list blobs across all + containers whose tags match a given search expression. Filter blobs + searches across all containers within a storage account but can be + scoped within the expression to a single container. + + :param str filter_expression: + The expression to find blobs whose tags matches the specified condition. + eg. "yourtagname='firsttag' and yourtagname2='secondtag'" + To specify a container, eg. "@container=’containerName’ and Name = ‘C’" + :keyword int results_per_page: + The max result per page when paginating. + :keyword int timeout: + The timeout parameter is expressed in seconds. + :returns: An iterable (auto-paging) response of BlobProperties. + :rtype: ~azure.core.paging.ItemPaged[~azure.storage.blob.FilteredBlob] + """ + + results_per_page = kwargs.pop('results_per_page', None) + timeout = kwargs.pop('timeout', None) + command = functools.partial( + self._client.service.filter_blobs, + where=filter_expression, + timeout=timeout, + **kwargs) + return ItemPaged( + command, results_per_page=results_per_page, + page_iterator_class=FilteredBlobPaged) + @distributed_trace def create_container( self, name, # type: str diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py index 9d010b4e9cbc..44b3e8669a70 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py @@ -635,7 +635,7 @@ def set_container_access_policy( @distributed_trace def list_blobs(self, name_starts_with=None, include=None, **kwargs): - # type: (Optional[str], Optional[Any], **Any) -> ItemPaged[BlobProperties] + # type: (Optional[str], Optional[Union[str, List[str]]], **Any) -> ItemPaged[BlobProperties] """Returns a generator to list the blobs under the specified container. The generator will lazily follow the continuation tokens returned by the service. @@ -643,9 +643,9 @@ def list_blobs(self, name_starts_with=None, include=None, **kwargs): :param str name_starts_with: Filters the results to return only blobs whose names begin with the specified prefix. - :param list[str] include: + :param list[str] or str include: Specifies one or more additional datasets to include in the response. - Options include: 'snapshots', 'metadata', 'uncommittedblobs', 'copy', 'deleted'. + Options include: 'snapshots', 'metadata', 'uncommittedblobs', 'copy', 'deleted', 'tags'. :keyword int timeout: The timeout parameter is expressed in seconds. :returns: An iterable (auto-paging) response of BlobProperties. diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/version.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/version.py index be045899fa00..0b20a9ed22a5 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/version.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "2019-12-12" +VERSION = "2019-10-10" diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py index 4d364c87c02d..dac6e4bb0105 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py @@ -9,6 +9,7 @@ from enum import Enum from azure.core.paging import PageIterator, ItemPaged +from azure.storage.blob._generated.models import FilterBlobItem from ._shared import decode_base64_to_text from ._shared.response_handlers import return_context_and_deserialized, process_storage_error @@ -487,6 +488,10 @@ class BlobProperties(DictMixin): Dictionary :ivar str object_replication_destination_policy: Represents the Object Replication Policy Id that created this blob. + :ivar int tag_count: + Tags count on this blob. + :ivar dict(str, str) tags: + Key value pair of tags on this blob. """ def __init__(self, **kwargs): @@ -521,6 +526,8 @@ def __init__(self, **kwargs): self.request_server_encrypted = kwargs.get('x-ms-server-encrypted') self.object_replication_source_properties = kwargs.get('object_replication_source_properties') self.object_replication_destination_policy = kwargs.get('x-ms-or-policy-id') + self.tag_count = kwargs.get('x-ms-tag-count') + self.tags = None @classmethod def _from_generated(cls, generated): @@ -550,8 +557,20 @@ def _from_generated(cls, generated): blob.blob_tier_change_time = generated.properties.access_tier_change_time blob.version_id = generated.version_id blob.is_current_version = generated.is_current_version + blob.tag_count = generated.properties.tag_count + blob.tags = blob._parse_tags(generated.blob_tags) # pylint: disable=protected-access return blob + @staticmethod + def _parse_tags(generated_tags): + # type: (Optional[List[BlobTag]]) -> Union[Dict[str, str], None] + """Deserialize a list of BlobTag objects into a dict. + """ + if generated_tags: + tag_dict = {t.key: t.value for t in generated_tags.blob_tag_set} + return tag_dict + return None + class BlobPropertiesPaged(PageIterator): """An Iterable of Blob properties. @@ -638,6 +657,86 @@ def _build_item(self, item): return item +class FilteredBlob(FilterBlobItem): + """Blob info from a Filter Blobs API call. + + :ivar name: Blob name + :type name: str + :ivar container_name: Container name. + :type container_name: str + :ivar tag_value: tag value filtered by the expression. + :type tag_value: str + """ + + +class FilteredBlobPaged(PageIterator): + """An Iterable of Blob properties. + + :ivar str service_endpoint: The service URL. + :ivar str prefix: A blob name prefix being used to filter the list. + :ivar str marker: The continuation token of the current page of results. + :ivar int results_per_page: The maximum number of results retrieved per API call. + :ivar str continuation_token: The continuation token to retrieve the next page of results. + :ivar str location_mode: The location mode being used to list results. The available + options include "primary" and "secondary". + :ivar current_page: The current page of listed results. + :vartype current_page: list(~azure.storage.blob.FilteredBlob) + :ivar str container: The container that the blobs are listed from. + + :param callable command: Function to retrieve the next page of items. + :param str container: The name of the container. + :param int results_per_page: The maximum number of blobs to retrieve per + call. + :param str continuation_token: An opaque continuation token. + :param location_mode: Specifies the location the request should be sent to. + This mode only applies for RA-GRS accounts which allow secondary read access. + Options include 'primary' or 'secondary'. + """ + def __init__( + self, command, + container=None, + results_per_page=None, + continuation_token=None, + location_mode=None): + super(FilteredBlobPaged, self).__init__( + get_next=self._get_next_cb, + extract_data=self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command + self.service_endpoint = None + self.marker = continuation_token + self.results_per_page = results_per_page + self.container = container + self.current_page = None + self.location_mode = location_mode + + def _get_next_cb(self, continuation_token): + try: + return self._command( + marker=continuation_token or None, + maxresults=self.results_per_page, + cls=return_context_and_deserialized, + use_location=self.location_mode) + except StorageErrorException as error: + process_storage_error(error) + + def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return + self.service_endpoint = self._response.service_endpoint + self.marker = self._response.next_marker + self.current_page = [self._build_item(item) for item in self._response.blobs] + + return self._response.next_marker or None, self.current_page + + @staticmethod + def _build_item(item): + if isinstance(item, FilterBlobItem): + blob = FilteredBlob(name=item.name, container_name=item.container_name, tag_value=item.tag_value) # pylint: disable=protected-access + return blob + return item + + class BlobPrefix(ItemPaged, DictMixin): """An Iterable of Blob properties. diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py index 6682af36e573..eb4b6f41d16a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py @@ -4,6 +4,10 @@ # license information. # -------------------------------------------------------------------------- # pylint: disable=no-self-use +try: + from urllib.parse import quote +except ImportError: + from urllib2 import quote # type: ignore from azure.core import MatchConditions @@ -17,7 +21,9 @@ QuickQuerySerialization, DelimitedTextConfiguration, JsonTextConfiguration, - QuickQueryFormatType + QuickQueryFormatType, + BlobTag, + BlobTags ) @@ -124,3 +130,27 @@ def get_quick_query_serialization_info(serialization_settings=None): "or JsonTextConfiguration") return QuickQuerySerialization(format=qq_format) return None + + +def serialize_blob_tags_header(tags=None): + # type: (Optional[Dict[str, str]]) -> str + components = list() + if tags: + for key, value in tags.items(): + components.append(quote(key, safe='.-')) + components.append('=') + components.append(quote(value, safe='.-')) + components.append('&') + + if components: + del components[-1] + + return ''.join(components) + + +def serialize_blob_tags(tags=None): + # type: (Optional[Dict[str, str]]) -> Union[BlobTags, None] + tag_list = list() + if tags: + tag_list = [BlobTag(key=k, value=v) for k, v in tags.items()] + return BlobTags(blob_tag_set=tag_list) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_upload_helpers.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_upload_helpers.py index d3862eb72646..bd59362dc91a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_upload_helpers.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_upload_helpers.py @@ -79,6 +79,7 @@ def upload_block_blob( # pylint: disable=too-many-locals adjusted_count += (16 - (length % 16)) blob_headers = kwargs.pop('blob_headers', None) tier = kwargs.pop('standard_blob_tier', None) + blob_tags_string = kwargs.pop('blob_tags_string', None) # Do single put if the size is smaller than or equal config.max_single_put_size if adjusted_count is not None and (adjusted_count <= blob_settings.max_single_put_size): @@ -101,6 +102,7 @@ def upload_block_blob( # pylint: disable=too-many-locals data_stream_total=adjusted_count, upload_stream_current=0, tier=tier.value if tier else None, + blob_tags_string=blob_tags_string, **kwargs) use_original_upload_path = blob_settings.use_byte_buffer or \ @@ -147,6 +149,7 @@ def upload_block_blob( # pylint: disable=too-many-locals validate_content=validate_content, headers=headers, tier=tier.value if tier else None, + blob_tags_string=blob_tags_string, **kwargs) except StorageErrorException as error: try: @@ -184,11 +187,14 @@ def upload_page_blob( headers['x-ms-access-tier'] = premium_page_blob_tier if encryption_options and encryption_options.get('data'): headers['x-ms-meta-encryptiondata'] = encryption_options['data'] + blob_tags_string = kwargs.pop('blob_tags_string', None) + response = client.create( content_length=0, blob_content_length=length, blob_sequence_number=None, blob_http_headers=kwargs.pop('blob_headers', None), + blob_tags_string=blob_tags_string, cls=return_response_headers, headers=headers, **kwargs) @@ -234,12 +240,15 @@ def upload_append_blob( # pylint: disable=unused-argument append_conditions = AppendPositionAccessConditions( max_size=kwargs.pop('maxsize_condition', None), append_position=None) + blob_tags_string = kwargs.pop('blob_tags_string', None) + try: if overwrite: client.create( content_length=0, blob_http_headers=blob_headers, headers=headers, + blob_tags_string=blob_tags_string, **kwargs) return upload_data_chunks( service=client, @@ -266,6 +275,7 @@ def upload_append_blob( # pylint: disable=unused-argument content_length=0, blob_http_headers=blob_headers, headers=headers, + blob_tags_string=blob_tags_string, **kwargs) return upload_data_chunks( service=client, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py index dbf446e5d784..66addaa7c426 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py @@ -26,7 +26,7 @@ upload_block_blob, upload_append_blob, upload_page_blob) -from .._models import BlobType, BlobBlock +from .._models import BlobType, BlobBlock, BlobProperties from .._lease import get_access_conditions from ._lease_async import BlobLeaseClient from ._download_async import StorageStreamDownloader @@ -35,9 +35,6 @@ from datetime import datetime from azure.core.pipeline.policies import HTTPPolicy from .._models import ( # pylint: disable=unused-import - ContainerProperties, - BlobProperties, - BlobSasPermissions, ContentSettings, PremiumPageBlobTier, StandardBlobTier, @@ -165,6 +162,16 @@ async def upload_blob( :param metadata: Name-value pairs associated with the blob as metadata. :type metadata: dict(str, str) + :keyword tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + + .. versionadded:: 12.4.0 + + :paramtype tags: dict(str, str) :keyword bool overwrite: Whether the blob to be uploaded should overwrite the current data. If True, upload_blob will overwrite the existing data. If set to False, the operation will fail with ResourceExistsError. The exception to the above is with Append @@ -640,6 +647,16 @@ async def create_page_blob( # type: ignore A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. + :keyword tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + + .. versionadded:: 12.4.0 + + :paramtype tags: dict(str, str) :keyword int sequence_number: Only for Page blobs. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 @@ -705,6 +722,16 @@ async def create_append_blob(self, content_settings=None, metadata=None, **kwarg :param metadata: Name-value pairs associated with the blob as metadata. :type metadata: dict(str, str) + :keyword tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + + .. versionadded:: 12.4.0 + + :paramtype tags: dict(str, str) :keyword lease: Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. @@ -882,6 +909,16 @@ async def start_copy_from_url(self, source_url, metadata=None, incremental_copy= the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. Defaults to False. + :keyword tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + + .. versionadded:: 12.4.0 + + :paramtype tags: dict(str, str) :keyword ~datetime.datetime source_if_modified_since: A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. @@ -1251,6 +1288,16 @@ async def commit_block_list( # type: ignore :param metadata: Name-value pairs associated with the blob as metadata. :type metadata: dict[str, str] + :keyword tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + + .. versionadded:: 12.4.0 + + :paramtype tags: dict(str, str) :keyword lease: Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. @@ -1342,6 +1389,67 @@ async def set_premium_page_blob_tier(self, premium_page_blob_tier, **kwargs): except StorageErrorException as error: process_storage_error(error) + @distributed_trace_async + async def set_blob_tags(self, tags=None, **kwargs): + # type: (Optional[Dict[str, str]], **Any) -> Dict[str, Any] + """The Set Tags operation enables users to set tags on a blob or specific blob version, but not snapshot. + Each call to this operation replaces all existing tags attached to the blob. To remove all + tags from the blob, call this operation with no tags set. + + .. versionadded:: 12.4.0 + This operation was introduced in API version '2019-12-12'. + + :param tags: + Name-value pairs associated with the blob as tag. Tags are case-sensitive. + The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, + and tag values must be between 0 and 256 characters. + Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), + space (` `), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) + :type tags: dict(str, str) + :keyword str version_id: + The version id parameter is an opaque DateTime + value that, when present, specifies the version of the blob to delete. + :keyword bool validate_content: + If true, calculates an MD5 hash of the tags content. The storage + service checks the hash of the content that has arrived + with the hash that was sent. This is primarily valuable for detecting + bitflips on the wire if using http instead of https, as https (the default), + will already validate. Note that this MD5 hash is not stored with the + blob. + :keyword int timeout: + The timeout parameter is expressed in seconds. + :returns: Blob-updated property dict (Etag and last modified) + :rtype: Dict[str, Any] + """ + options = self._set_blob_tags_options(tags=tags, **kwargs) + try: + return await self._client.blob.set_tags(**options) + except StorageErrorException as error: + process_storage_error(error) + + @distributed_trace_async + async def get_blob_tags(self, **kwargs): + # type: (**Any) -> Dict[str, str] + """The Get Tags operation enables users to get tags on a blob or specific blob version, but not snapshot. + + .. versionadded:: 12.4.0 + This operation was introduced in API version '2019-12-12'. + + :keyword str version_id: + The version id parameter is an opaque DateTime + value that, when present, specifies the version of the blob to add tags to. + :keyword int timeout: + The timeout parameter is expressed in seconds. + :returns: Key value pairs of blob tags. + :rtype: Dict[str, str] + """ + options = self._get_blob_tags_options(**kwargs) + try: + _, tags = await self._client.blob.get_tags(**options) + return BlobProperties._parse_tags(tags) # pylint: disable=protected-access + except StorageErrorException as error: + process_storage_error(error) + @distributed_trace_async async def get_page_ranges( # type: ignore self, offset=None, # type: Optional[int] diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py index 532cbbe18f99..48ef864f11db 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py @@ -30,7 +30,7 @@ from .._models import ContainerProperties from .._deserialize import service_stats_deserialize, service_properties_deserialize from .._serialize import get_api_version -from ._models import ContainerPropertiesPaged +from ._models import ContainerPropertiesPaged, FilteredBlobPaged if TYPE_CHECKING: from datetime import datetime @@ -379,6 +379,37 @@ def list_containers( page_iterator_class=ContainerPropertiesPaged ) + @distributed_trace + def find_blobs_by_tags(self, filter_expression, **kwargs): + # type: (str, **Any) -> AsyncItemPaged[FilteredBlob] + """The Filter Blobs operation enables callers to list blobs across all + containers whose tags match a given search expression. Filter blobs + searches across all containers within a storage account but can be + scoped within the expression to a single container. + + :param str filter_expression: + The expression to find blobs whose tags matches the specified condition. + eg. "yourtagname='firsttag' and yourtagname2='secondtag'" + To specify a container, eg. "@container=’containerName’ and Name = ‘C’" + :keyword int results_per_page: + The max result per page when paginating. + :keyword int timeout: + The timeout parameter is expressed in seconds. + :returns: An iterable (auto-paging) response of BlobProperties. + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.FilteredBlob] + """ + + results_per_page = kwargs.pop('results_per_page', None) + timeout = kwargs.pop('timeout', None) + command = functools.partial( + self._client.service.filter_blobs, + where=filter_expression, + timeout=timeout, + **kwargs) + return AsyncItemPaged( + command, results_per_page=results_per_page, + page_iterator_class=FilteredBlobPaged) + @distributed_trace_async async def create_container( self, name, # type: str diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py index e0299163fa3d..d026c1fbaeb1 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py @@ -507,7 +507,7 @@ async def set_container_access_policy( @distributed_trace def list_blobs(self, name_starts_with=None, include=None, **kwargs): - # type: (Optional[str], Optional[Any], **Any) -> AsyncItemPaged[BlobProperties] + # type: (Optional[str], Optional[Union[str, List[str]]], **Any) -> AsyncItemPaged[BlobProperties] """Returns a generator to list the blobs under the specified container. The generator will lazily follow the continuation tokens returned by the service. @@ -515,9 +515,9 @@ def list_blobs(self, name_starts_with=None, include=None, **kwargs): :param str name_starts_with: Filters the results to return only blobs whose names begin with the specified prefix. - :param list[str] include: + :param list[str] or str include: Specifies one or more additional datasets to include in the response. - Options include: 'snapshots', 'metadata', 'uncommittedblobs', 'copy', 'deleted'. + Options include: 'snapshots', 'metadata', 'uncommittedblobs', 'copy', 'deleted', 'tags'. :keyword int timeout: The timeout parameter is expressed in seconds. :returns: An iterable (auto-paging) response of BlobProperties. diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_models.py index e519a8ce9783..806c62cb67f0 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_models.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_models.py @@ -10,13 +10,13 @@ from azure.core.async_paging import AsyncPageIterator, AsyncItemPaged -from .._models import BlobProperties, ContainerProperties +from .._models import BlobProperties, ContainerProperties, FilteredBlob from .._shared.response_handlers import return_context_and_deserialized, process_storage_error from .._shared.models import DictMixin from .._generated.models import StorageErrorException from .._generated.models import BlobPrefix as GenBlobPrefix -from .._generated.models import BlobItemInternal +from .._generated.models import BlobItemInternal, FilterBlobItem class ContainerPropertiesPaged(AsyncPageIterator): @@ -161,6 +161,74 @@ def _build_item(self, item): return item +class FilteredBlobPaged(AsyncPageIterator): + """An Iterable of Blob properties. + + :ivar str service_endpoint: The service URL. + :ivar str prefix: A blob name prefix being used to filter the list. + :ivar str marker: The continuation token of the current page of results. + :ivar int results_per_page: The maximum number of results retrieved per API call. + :ivar str continuation_token: The continuation token to retrieve the next page of results. + :ivar str location_mode: The location mode being used to list results. The available + options include "primary" and "secondary". + :ivar current_page: The current page of listed results. + :vartype current_page: list(~azure.storage.blob.BlobProperties) + :ivar str container: The container that the blobs are listed from. + + :param callable command: Function to retrieve the next page of items. + :param str container: The name of the container. + :param int results_per_page: The maximum number of blobs to retrieve per + call. + :param str continuation_token: An opaque continuation token. + :param location_mode: Specifies the location the request should be sent to. + This mode only applies for RA-GRS accounts which allow secondary read access. + Options include 'primary' or 'secondary'. + """ + def __init__( + self, command, + container=None, + results_per_page=None, + continuation_token=None, + location_mode=None): + super(FilteredBlobPaged, self).__init__( + get_next=self._get_next_cb, + extract_data=self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command + self.service_endpoint = None + self.marker = continuation_token + self.results_per_page = results_per_page + self.container = container + self.current_page = None + self.location_mode = location_mode + + async def _get_next_cb(self, continuation_token): + try: + return await self._command( + marker=continuation_token or None, + maxresults=self.results_per_page, + cls=return_context_and_deserialized, + use_location=self.location_mode) + except StorageErrorException as error: + process_storage_error(error) + + async def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return + self.service_endpoint = self._response.service_endpoint + self.marker = self._response.next_marker + self.current_page = [self._build_item(item) for item in self._response.blobs] + + return self._response.next_marker or None, self.current_page + + @staticmethod + def _build_item(item): + if isinstance(item, FilterBlobItem): + blob = FilteredBlob(name=item.name, container_name=item.container_name, tag_value=item.tag_value) # pylint: disable=protected-access + return blob + return item + + class BlobPrefix(AsyncItemPaged, DictMixin): """An Iterable of Blob properties. diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_upload_helpers.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_upload_helpers.py index 7842e03f9d50..3a495b5750d4 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_upload_helpers.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_upload_helpers.py @@ -54,6 +54,7 @@ async def upload_block_blob( # pylint: disable=too-many-locals adjusted_count += (16 - (length % 16)) blob_headers = kwargs.pop('blob_headers', None) tier = kwargs.pop('standard_blob_tier', None) + blob_tags_string = kwargs.pop('blob_tags_string', None) # Do single put if the size is smaller than config.max_single_put_size if adjusted_count is not None and (adjusted_count <= blob_settings.max_single_put_size): @@ -76,6 +77,7 @@ async def upload_block_blob( # pylint: disable=too-many-locals data_stream_total=adjusted_count, upload_stream_current=0, tier=tier.value if tier else None, + blob_tags_string=blob_tags_string, **kwargs) use_original_upload_path = blob_settings.use_byte_buffer or \ @@ -122,6 +124,7 @@ async def upload_block_blob( # pylint: disable=too-many-locals validate_content=validate_content, headers=headers, tier=tier.value if tier else None, + blob_tags_string=blob_tags_string, **kwargs) except StorageErrorException as error: try: @@ -159,11 +162,14 @@ async def upload_page_blob( headers['x-ms-access-tier'] = premium_page_blob_tier if encryption_options and encryption_options.get('data'): headers['x-ms-meta-encryptiondata'] = encryption_options['data'] + blob_tags_string = kwargs.pop('blob_tags_string', None) + response = await client.create( content_length=0, blob_content_length=length, blob_sequence_number=None, blob_http_headers=kwargs.pop('blob_headers', None), + blob_tags_string=blob_tags_string, cls=return_response_headers, headers=headers, **kwargs) @@ -209,12 +215,15 @@ async def upload_append_blob( # pylint: disable=unused-argument append_conditions = AppendPositionAccessConditions( max_size=kwargs.pop('maxsize_condition', None), append_position=None) + blob_tags_string = kwargs.pop('blob_tags_string', None) + try: if overwrite: await client.create( content_length=0, blob_http_headers=blob_headers, headers=headers, + blob_tags_string=blob_tags_string, **kwargs) return await upload_data_chunks( service=client, @@ -241,6 +250,7 @@ async def upload_append_blob( # pylint: disable=unused-argument content_length=0, blob_http_headers=blob_headers, headers=headers, + blob_tags_string=blob_tags_string, **kwargs) return await upload_data_chunks( service=client, diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_commit_block_list_with_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_commit_block_list_with_tags.yaml new file mode 100644 index 000000000000..4602351fa82c --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_commit_block_list_with_tags.yaml @@ -0,0 +1,296 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:11 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercd831351?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:12 GMT + etag: + - '"0x8D7F70782B2C12F"' + last-modified: + - Wed, 13 May 2020 06:33:12 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 06:33:12 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercd831351/blobcd831351 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - 1B2M2Y8AsgTpgAmY7PhCfg== + date: + - Wed, 13 May 2020 06:33:12 GMT + etag: + - '"0x8D7F70782CDDA82"' + last-modified: + - Wed, 13 May 2020 06:33:12 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - AAAAAAAAAAA= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:12.7575170Z' + status: + code: 201 + message: Created +- request: + body: AAA + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '3' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:12 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercd831351/blobcd831351?blockid=MQ%3D%3D&comp=block + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:12 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - Cc/2Kr4DuKg= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: BBB + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '3' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:13 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercd831351/blobcd831351?blockid=Mg%3D%3D&comp=block + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:12 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - +3yuPEA7IqE= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: CCC + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '3' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:13 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercd831351/blobcd831351?blockid=Mw%3D%3D&comp=block + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:13 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - VRJmMeosVKY= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: ' + + MQ==Mg==Mw==' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '125' + Content-Type: + - application/xml; charset=utf-8 + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:13 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercd831351/blobcd831351?comp=blocklist + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:13 GMT + etag: + - '"0x8D7F7078340D556"' + last-modified: + - Wed, 13 May 2020 06:33:13 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - dAoQ5rLgKr0= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:13.5120486Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:13 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/containercd831351/blobcd831351?comp=tags + response: + body: + string: "\uFEFF\ntag1firsttagtag2secondtagtag3thirdtag" + headers: + content-length: + - '220' + content-type: + - application/xml + date: + - Wed, 13 May 2020 06:33:13 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_create_append_blob_with_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_create_append_blob_with_tags.yaml new file mode 100644 index 000000000000..57efdac1f305 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_create_append_blob_with_tags.yaml @@ -0,0 +1,122 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:13 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerde1e138c?timeout=5&restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:ac36955b-801e-0025-66f0-288221000000\nTime:2020-05-13T06:33:14.6378876Z" + headers: + content-length: + - '230' + content-type: + - application/xml + date: + - Wed, 13 May 2020 06:33:14 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: + - ContainerAlreadyExists + x-ms-version: + - '2019-10-10' + status: + code: 409 + message: The specified container already exists. +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - AppendBlob + x-ms-date: + - Wed, 13 May 2020 06:33:14 GMT + x-ms-tags: + - '%2B-.%2F%3A%3D_%20=firsttag&tag2=%2B-.%2F%3A%3D_&%2B-.%2F%3A%3D_1=%2B-.%2F%3A%3D_' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerde1e138c/blobde1e138c + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:14 GMT + etag: + - '"0x8D7F707840A8B5A"' + last-modified: + - Wed, 13 May 2020 06:33:14 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:14.8339818Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:14 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/containerde1e138c/blobde1e138c?comp=tags + response: + body: + string: "\uFEFF\n+-./:=_ + firsttag+-./:=_1+-./:=_tag2+-./:=_" + headers: + content-length: + - '225' + content-type: + - application/xml + date: + - Wed, 13 May 2020 06:33:14 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_create_page_blob_with_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_create_page_blob_with_tags.yaml new file mode 100644 index 000000000000..d33083ee4aca --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_create_page_blob_with_tags.yaml @@ -0,0 +1,122 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:15 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerb6e012b1?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:15 GMT + etag: + - '"0x8D7F70784BB0F54"' + last-modified: + - Wed, 13 May 2020 06:33:15 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-content-length: + - '512' + x-ms-blob-type: + - PageBlob + x-ms-date: + - Wed, 13 May 2020 06:33:16 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerb6e012b1/blobb6e012b1 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:15 GMT + etag: + - '"0x8D7F70784D92441"' + last-modified: + - Wed, 13 May 2020 06:33:16 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:16.1869377Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:16 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/containerb6e012b1/blobb6e012b1?comp=tags + response: + body: + string: "\uFEFF\ntag1firsttagtag2secondtagtag3thirdtag" + headers: + content-length: + - '220' + content-type: + - application/xml + date: + - Wed, 13 May 2020 06:33:15 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_filter_blobs.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_filter_blobs.yaml new file mode 100644 index 000000000000..8a266ffb0de6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_filter_blobs.yaml @@ -0,0 +1,428 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Thu, 04 Jun 2020 06:20:53 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerd79a0d11?timeout=5&restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:2d996372-701e-0041-4c38-3a1544000000\nTime:2020-06-04T06:20:53.5832041Z" + headers: + content-length: + - '230' + content-type: + - application/xml + date: + - Thu, 04 Jun 2020 06:20:52 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: + - ContainerAlreadyExists + x-ms-version: + - '2019-10-10' + status: + code: 409 + message: The specified container already exists. +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Thu, 04 Jun 2020 06:20:53 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container1d79a0d11?restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:2d996391-701e-0041-6538-3a1544000000\nTime:2020-06-04T06:20:53.6672649Z" + headers: + content-length: + - '230' + content-type: + - application/xml + date: + - Thu, 04 Jun 2020 06:20:53 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: + - ContainerAlreadyExists + x-ms-version: + - '2019-10-10' + status: + code: 409 + message: The specified container already exists. +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Thu, 04 Jun 2020 06:20:53 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container2d79a0d11?restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:2d9963aa-701e-0041-7a38-3a1544000000\nTime:2020-06-04T06:20:53.7533272Z" + headers: + content-length: + - '230' + content-type: + - application/xml + date: + - Thu, 04 Jun 2020 06:20:53 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: + - ContainerAlreadyExists + x-ms-version: + - '2019-10-10' + status: + code: 409 + message: The specified container already exists. +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Thu, 04 Jun 2020 06:20:53 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container3d79a0d11?restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:2d9963cb-701e-0041-1a38-3a1544000000\nTime:2020-06-04T06:20:53.8383887Z" + headers: + content-length: + - '230' + content-type: + - application/xml + date: + - Thu, 04 Jun 2020 06:20:53 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: + - ContainerAlreadyExists + x-ms-version: + - '2019-10-10' + status: + code: 409 + message: The specified container already exists. +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 04 Jun 2020 06:20:53 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerd79a0d11/blobd79a0d11 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Thu, 04 Jun 2020 06:20:53 GMT + etag: + - '"0x8D8084F6F84B69C"' + last-modified: + - Thu, 04 Jun 2020 06:20:53 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 04 Jun 2020 06:20:53 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container1d79a0d11/blobd79a0d11 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Thu, 04 Jun 2020 06:20:53 GMT + etag: + - '"0x8D8084F6F924DAC"' + last-modified: + - Thu, 04 Jun 2020 06:20:54 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 04 Jun 2020 06:20:54 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container2d79a0d11/blobd79a0d11 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Thu, 04 Jun 2020 06:20:53 GMT + etag: + - '"0x8D8084F6F9F968D"' + last-modified: + - Thu, 04 Jun 2020 06:20:54 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Thu, 04 Jun 2020 06:20:54 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container3d79a0d11/blobd79a0d11 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Thu, 04 Jun 2020 06:20:53 GMT + etag: + - '"0x8D8084F6FAD7BCA"' + last-modified: + - Thu, 04 Jun 2020 06:20:54 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Thu, 04 Jun 2020 06:20:54 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/?where=tag1%3D%27firsttag%27&maxresults=2&comp=blobs + response: + body: + string: "\uFEFF\ntag1='firsttag'2blobd79a0d11container1d79a0d11firsttagblobd79a0d11container2d79a0d11firsttag2!252!MDAwMDM1IWNvbnRhaW5lcjJkNzlhMGQxMQEwMUQ2M0EzNUE0MUU1OTVDITAwMDAxMiFibG9iZDc5YTBkMTEhMDAwMDE2IQgAAAAIAAAAZmlyc3R0YWchMDAwMDAxITAhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVohMDAwMDM2IWU5YjRkMGViLWI0YjEtNGYzNS05OWY0LTQ1OTNhY2NlNTc0MSEwMDAwMDQhdGFnMSE-" + headers: + content-type: + - application/xml + date: + - Thu, 04 Jun 2020 06:20:54 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-10-10' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Thu, 04 Jun 2020 06:20:54 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/?where=tag1%3D%27firsttag%27&marker=2%21252%21MDAwMDM1IWNvbnRhaW5lcjJkNzlhMGQxMQEwMUQ2M0EzNUE0MUU1OTVDITAwMDAxMiFibG9iZDc5YTBkMTEhMDAwMDE2IQgAAAAIAAAAZmlyc3R0YWchMDAwMDAxITAhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVohMDAwMDM2IWU5YjRkMGViLWI0YjEtNGYzNS05OWY0LTQ1OTNhY2NlNTc0MSEwMDAwMDQhdGFnMSE-&maxresults=2&comp=blobs + response: + body: + string: "\uFEFF\n2!252!MDAwMDM1IWNvbnRhaW5lcjJkNzlhMGQxMQEwMUQ2M0EzNUE0MUU1OTVDITAwMDAxMiFibG9iZDc5YTBkMTEhMDAwMDE2IQgAAAAIAAAAZmlyc3R0YWchMDAwMDAxITAhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVohMDAwMDM2IWU5YjRkMGViLWI0YjEtNGYzNS05OWY0LTQ1OTNhY2NlNTc0MSEwMDAwMDQhdGFnMSE-tag1='firsttag'2blobd79a0d11container3d79a0d11firsttagblobd79a0d11containerd79a0d11firsttag2!252!MDAwMDM0IWNvbnRhaW5lcmQ3OWEwZDExATAxRDYzQTM1QTQwNDNDRjEhMDAwMDEyIWJsb2JkNzlhMGQxMSEwMDAwMTYhCAAAAAgAAABmaXJzdHRhZyEwMDAwMDEhMCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiEwMDAwMzYhNjA4NzU3YjMtNjVlMS00OGE0LWE3ZDktYWY4MWZmM2U4ZTZjITAwMDAwNCF0YWcxIQ--" + headers: + content-type: + - application/xml + date: + - Thu, 04 Jun 2020 06:20:54 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-10-10' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_properties_returns_tags_num.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_properties_returns_tags_num.yaml new file mode 100644 index 000000000000..c33ebdbc5f8e --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_properties_returns_tags_num.yaml @@ -0,0 +1,217 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 16:20:26 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container8f371733?timeout=5&restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:fa13589d-001e-0049-0f42-2969b6000000\nTime:2020-05-13T16:20:27.2748266Z" + headers: + content-length: + - '230' + content-type: + - application/xml + date: + - Wed, 13 May 2020 16:20:27 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: + - ContainerAlreadyExists + x-ms-version: + - '2019-10-10' + status: + code: 409 + message: The specified container already exists. +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 16:20:27 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container8f371733/blob8f371733 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Wed, 13 May 2020 16:20:27 GMT + etag: + - '"0x8D7F7598C5355D9"' + last-modified: + - Wed, 13 May 2020 16:20:27 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T16:20:27.4656256Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 16:20:27 GMT + x-ms-version: + - '2019-10-10' + method: HEAD + uri: https://storagename.blob.core.windows.net/container8f371733/blob8f371733 + response: + body: + string: '' + headers: + accept-ranges: + - bytes + content-length: + - '1024' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + content-type: + - application/octet-stream + date: + - Wed, 13 May 2020 16:20:27 GMT + etag: + - '"0x8D7F7598C5355D9"' + last-modified: + - Wed, 13 May 2020 16:20:27 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-access-tier: + - Hot + x-ms-access-tier-inferred: + - 'true' + x-ms-blob-type: + - BlockBlob + x-ms-creation-time: + - Wed, 13 May 2020 16:20:27 GMT + x-ms-is-current-version: + - 'true' + x-ms-lease-state: + - available + x-ms-lease-status: + - unlocked + x-ms-server-encrypted: + - 'true' + x-ms-tag-count: + - '3' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T16:20:27.4656256Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 16:20:27 GMT + x-ms-range: + - bytes=0-33554431 + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container8f371733/blob8f371733 + response: + body: + string: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + accept-ranges: + - bytes + content-length: + - '1024' + content-range: + - bytes 0-1023/1024 + content-type: + - application/octet-stream + date: + - Wed, 13 May 2020 16:20:27 GMT + etag: + - '"0x8D7F7598C5355D9"' + last-modified: + - Wed, 13 May 2020 16:20:27 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-blob-content-md5: + - yaNM/IXZgmmMasifdgcavQ== + x-ms-blob-type: + - BlockBlob + x-ms-creation-time: + - Wed, 13 May 2020 16:20:27 GMT + x-ms-is-current-version: + - 'true' + x-ms-lease-state: + - available + x-ms-lease-status: + - unlocked + x-ms-server-encrypted: + - 'true' + x-ms-tag-count: + - '3' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T16:20:27.4656256Z' + status: + code: 206 + message: Partial Content +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_tags.yaml new file mode 100644 index 000000000000..077d8bf9c95b --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_tags.yaml @@ -0,0 +1,163 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:19 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containere45e0d66?timeout=5&restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:7f260d9e-701e-0031-60f0-28ca4e000000\nTime:2020-05-13T06:33:19.8590616Z" + headers: + content-length: + - '230' + content-type: + - application/xml + date: + - Wed, 13 May 2020 06:33:19 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: + - ContainerAlreadyExists + x-ms-version: + - '2019-10-10' + status: + code: 409 + message: The specified container already exists. +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 06:33:19 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containere45e0d66/blobe45e0d66 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Wed, 13 May 2020 06:33:19 GMT + etag: + - '"0x8D7F70787263DD9"' + last-modified: + - Wed, 13 May 2020 06:33:20 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:20.0486633Z' + status: + code: 201 + message: Created +- request: + body: ' + + tag1firsttagtag2secondtagtag3thirdtag' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '217' + Content-Type: + - application/xml; charset=utf-8 + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:20 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containere45e0d66/blobe45e0d66?comp=tags + response: + body: + string: '' + headers: + date: + - Wed, 13 May 2020 06:33:19 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:20 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/containere45e0d66/blobe45e0d66?comp=tags + response: + body: + string: "\uFEFF\ntag1firsttagtag2secondtagtag3thirdtag" + headers: + content-length: + - '220' + content-type: + - application/xml + date: + - Wed, 13 May 2020 06:33:20 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_tags_for_a_snapshot.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_tags_for_a_snapshot.yaml new file mode 100644 index 000000000000..2bfb8cf7c7b1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_get_blob_tags_for_a_snapshot.yaml @@ -0,0 +1,171 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:20 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerde23139b?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:20 GMT + etag: + - '"0x8D7F70787E59072"' + last-modified: + - Wed, 13 May 2020 06:33:21 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 06:33:21 GMT + x-ms-tags: + - '%2B-.%2F%3A%3D_%20=firsttag&tag2=%2B-.%2F%3A%3D_&%2B-.%2F%3A%3D_1=%2B-.%2F%3A%3D_' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerde23139b/blobde23139b + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Wed, 13 May 2020 06:33:21 GMT + etag: + - '"0x8D7F7078803CD99"' + last-modified: + - Wed, 13 May 2020 06:33:21 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:21.4996889Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:21 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerde23139b/blobde23139b?comp=snapshot + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:21 GMT + etag: + - '"0x8D7F7078803CD99"' + last-modified: + - Wed, 13 May 2020 06:33:21 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-request-server-encrypted: + - 'false' + x-ms-snapshot: + - '2020-05-13T06:33:21.6668054Z' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:21.6678054Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:21 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/containerde23139b/blobde23139b?snapshot=2020-05-13T06:33:21.6668054Z&comp=tags + response: + body: + string: "\uFEFF\n+-./:=_ + firsttag+-./:=_1+-./:=_tag2+-./:=_" + headers: + content-length: + - '225' + content-type: + - application/xml + date: + - Wed, 13 May 2020 06:33:21 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_list_blobs_returns_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_list_blobs_returns_tags.yaml new file mode 100644 index 000000000000..8b1962ec9871 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_list_blobs_returns_tags.yaml @@ -0,0 +1,132 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:21 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container845a11c7?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:21 GMT + etag: + - '"0x8D7F70788B4FC1E"' + last-modified: + - Wed, 13 May 2020 06:33:22 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 06:33:22 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container845a11c7/blob845a11c7 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Wed, 13 May 2020 06:33:22 GMT + etag: + - '"0x8D7F70788D1F136"' + last-modified: + - Wed, 13 May 2020 06:33:22 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:22.8506422Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:22 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container845a11c7?include=tags&restype=container&comp=list + response: + body: + string: "\uFEFFblob845a11c72020-05-13T06:33:22.8506422ZtrueWed, + 13 May 2020 06:33:22 GMTWed, 13 May 2020 06:33:22 + GMT0x8D7F70788D1F1361024application/octet-streamyaNM/IXZgmmMasifdgcavQ==BlockBlobHottrueunlockedavailabletrue3tag1firsttagtag2secondtagtag3thirdtag" + headers: + content-type: + - application/xml + date: + - Wed, 13 May 2020 06:33:22 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-10-10' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_set_blob_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_set_blob_tags.yaml new file mode 100644 index 000000000000..3ffd0132de03 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_set_blob_tags.yaml @@ -0,0 +1,128 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:23 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containere4fa0d72?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:23 GMT + etag: + - '"0x8D7F707897B7293"' + last-modified: + - Wed, 13 May 2020 06:33:23 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 06:33:24 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containere4fa0d72/blobe4fa0d72 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Wed, 13 May 2020 06:33:24 GMT + etag: + - '"0x8D7F7078999AB0F"' + last-modified: + - Wed, 13 May 2020 06:33:24 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:24.1595663Z' + status: + code: 201 + message: Created +- request: + body: ' + + tag1firsttagtag2secondtagtag3thirdtag' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '217' + Content-Type: + - application/xml; charset=utf-8 + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:24 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containere4fa0d72/blobe4fa0d72?comp=tags + response: + body: + string: '' + headers: + date: + - Wed, 13 May 2020 06:33:24 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_set_blob_tags_for_a_version.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_set_blob_tags_for_a_version.yaml new file mode 100644 index 000000000000..c3823641d3fb --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_set_blob_tags_for_a_version.yaml @@ -0,0 +1,180 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:24 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercbfb133d?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:24 GMT + etag: + - '"0x8D7F7078A3E3EF2"' + last-modified: + - Wed, 13 May 2020 06:33:25 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 06:33:25 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercbfb133d/blobcbfb133d + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Wed, 13 May 2020 06:33:24 GMT + etag: + - '"0x8D7F7078A5DE1D5"' + last-modified: + - Wed, 13 May 2020 06:33:25 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:25.4454741Z' + status: + code: 201 + message: Created +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 06:33:25 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercbfb133d/blobcbfb133d + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Wed, 13 May 2020 06:33:24 GMT + etag: + - '"0x8D7F7078A7B5A38"' + last-modified: + - Wed, 13 May 2020 06:33:25 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:25.6406111Z' + status: + code: 201 + message: Created +- request: + body: ' + + tag1firsttagtag2secondtagtag3thirdtag' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '217' + Content-Type: + - application/xml; charset=utf-8 + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:25 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercbfb133d/blobcbfb133d?versionid=2020-05-13T06%3A33%3A25.4454741Z&comp=tags + response: + body: + string: '' + headers: + date: + - Wed, 13 May 2020 06:33:24 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_start_copy_from_url_with_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_start_copy_from_url_with_tags.yaml new file mode 100644 index 000000000000..a7f45bb5e6a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_start_copy_from_url_with_tags.yaml @@ -0,0 +1,246 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:26 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerf9181450?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:25 GMT + etag: + - '"0x8D7F7078B0AE34B"' + last-modified: + - Wed, 13 May 2020 06:33:26 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 06:33:26 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerf9181450/blobf9181450 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Wed, 13 May 2020 06:33:26 GMT + etag: + - '"0x8D7F7078B24D83F"' + last-modified: + - Wed, 13 May 2020 06:33:26 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:26.7493951Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-copy-source: + - https://huxfrancec.blob.core.windows.net/containerf9181450/blobf9181450 + x-ms-date: + - Wed, 13 May 2020 06:33:26 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerf9181450/blob1copy + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:26 GMT + etag: + - '"0x8D7F7078B43D784"' + last-modified: + - Wed, 13 May 2020 06:33:26 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-copy-id: + - 95bb9d00-831c-479e-8daf-060e3dc5b953 + x-ms-copy-status: + - success + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:26.9535392Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:27 GMT + x-ms-range: + - bytes=0-33554431 + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/containerf9181450/blob1copy + response: + body: + string: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + accept-ranges: + - bytes + content-length: + - '1024' + content-range: + - bytes 0-1023/1024 + content-type: + - application/octet-stream + date: + - Wed, 13 May 2020 06:33:26 GMT + etag: + - '"0x8D7F7078B43D784"' + last-modified: + - Wed, 13 May 2020 06:33:26 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-blob-content-md5: + - yaNM/IXZgmmMasifdgcavQ== + x-ms-blob-type: + - BlockBlob + x-ms-copy-completion-time: + - Wed, 13 May 2020 06:33:26 GMT + x-ms-copy-id: + - 95bb9d00-831c-479e-8daf-060e3dc5b953 + x-ms-copy-progress: + - 1024/1024 + x-ms-copy-source: + - https://huxfrancec.blob.core.windows.net/containerf9181450/blobf9181450 + x-ms-copy-status: + - success + x-ms-creation-time: + - Wed, 13 May 2020 06:33:26 GMT + x-ms-is-current-version: + - 'true' + x-ms-lease-state: + - available + x-ms-lease-status: + - unlocked + x-ms-server-encrypted: + - 'true' + x-ms-tag-count: + - '3' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:26.9535392Z' + status: + code: 206 + message: Partial Content +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:27 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/containerf9181450/blob1copy?comp=tags + response: + body: + string: "\uFEFF\ntag1firsttagtag2secondtagtag3thirdtag" + headers: + content-length: + - '220' + content-type: + - application/xml + date: + - Wed, 13 May 2020 06:33:26 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_upload_block_blob_with_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_upload_block_blob_with_tags.yaml new file mode 100644 index 000000000000..41e4988369b5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags.test_upload_block_blob_with_tags.yaml @@ -0,0 +1,126 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:27 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercc271330?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 13 May 2020 06:33:27 GMT + etag: + - '"0x8D7F7078BF67B1E"' + last-modified: + - Wed, 13 May 2020 06:33:28 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 201 + message: Created +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 06:33:28 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containercc271330/blobcc271330 + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - yaNM/IXZgmmMasifdgcavQ== + date: + - Wed, 13 May 2020 06:33:27 GMT + etag: + - '"0x8D7F7078C135AF6"' + last-modified: + - Wed, 13 May 2020 06:33:28 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - ov8U1LLnyKc= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2019-10-10' + x-ms-version-id: + - '2020-05-13T06:33:28.3124982Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 06:33:28 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/containercc271330/blobcc271330?comp=tags + response: + body: + string: "\uFEFF\ntag1firsttagtag2secondtagtag3thirdtag" + headers: + content-length: + - '220' + content-type: + - application/xml + date: + - Wed, 13 May 2020 06:33:28 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: + - '2019-10-10' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_commit_block_list_with_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_commit_block_list_with_tags.yaml new file mode 100644 index 000000000000..7df85a184457 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_commit_block_list_with_tags.yaml @@ -0,0 +1,213 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:33 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container4b1215ce?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:33 GMT + etag: '"0x8D7F70C732E6738"' + last-modified: Wed, 13 May 2020 07:08:34 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container4b1215ce?timeout=5&restype=container +- request: + body: null + headers: + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:08:34 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container4b1215ce/blob4b1215ce + response: + body: + string: '' + headers: + content-length: '0' + content-md5: 1B2M2Y8AsgTpgAmY7PhCfg== + date: Wed, 13 May 2020 07:08:34 GMT + etag: '"0x8D7F70C7351FAA3"' + last-modified: Wed, 13 May 2020 07:08:34 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: AAAAAAAAAAA= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:34.2645174Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container4b1215ce/blob4b1215ce +- request: + body: AAA + headers: + Content-Length: + - '3' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:34 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container4b1215ce/blob4b1215ce?blockid=MQ%3D%3D&comp=block + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:34 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: Cc/2Kr4DuKg= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container4b1215ce/blob4b1215ce?blockid=MQ%3D%3D&comp=block +- request: + body: BBB + headers: + Content-Length: + - '3' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:34 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container4b1215ce/blob4b1215ce?blockid=Mg%3D%3D&comp=block + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:34 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: +3yuPEA7IqE= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container4b1215ce/blob4b1215ce?blockid=Mg%3D%3D&comp=block +- request: + body: CCC + headers: + Content-Length: + - '3' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:34 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container4b1215ce/blob4b1215ce?blockid=Mw%3D%3D&comp=block + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:34 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: VRJmMeosVKY= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container4b1215ce/blob4b1215ce?blockid=Mw%3D%3D&comp=block +- request: + body: ' + + MQ==Mg==Mw==' + headers: + Content-Length: + - '125' + Content-Type: + - application/xml; charset=utf-8 + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:34 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container4b1215ce/blob4b1215ce?comp=blocklist + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:34 GMT + etag: '"0x8D7F70C73B58961"' + last-modified: Wed, 13 May 2020 07:08:34 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: dAoQ5rLgKr0= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:34.9179789Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container4b1215ce/blob4b1215ce?comp=blocklist +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:35 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container4b1215ce/blob4b1215ce?comp=tags + response: + body: + string: "\uFEFF\ntag1firsttagtag2secondtagtag3thirdtag" + headers: + content-length: '220' + content-type: application/xml + date: Wed, 13 May 2020 07:08:34 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/container4b1215ce/blob4b1215ce?comp=tags +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_create_append_blob_with_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_create_append_blob_with_tags.yaml new file mode 100644 index 000000000000..72afba7d94ad --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_create_append_blob_with_tags.yaml @@ -0,0 +1,87 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:35 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container5e2a1609?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:34 GMT + etag: '"0x8D7F70C7435B848"' + last-modified: Wed, 13 May 2020 07:08:35 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container5e2a1609?timeout=5&restype=container +- request: + body: null + headers: + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - AppendBlob + x-ms-date: + - Wed, 13 May 2020 07:08:35 GMT + x-ms-tags: + - '%2B-.%2F%3A%3D_%20=firsttag&tag2=%2B-.%2F%3A%3D_&%2B-.%2F%3A%3D_1=%2B-.%2F%3A%3D_' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container5e2a1609/blob5e2a1609 + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:35 GMT + etag: '"0x8D7F70C74505EBD"' + last-modified: Wed, 13 May 2020 07:08:35 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:35.9306941Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container5e2a1609/blob5e2a1609 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:36 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container5e2a1609/blob5e2a1609?comp=tags + response: + body: + string: "\uFEFF\n+-./:=_ + firsttag+-./:=_1+-./:=_tag2+-./:=_" + headers: + content-length: '225' + content-type: application/xml + date: Wed, 13 May 2020 07:08:35 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/container5e2a1609/blob5e2a1609?comp=tags +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_create_page_blob_with_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_create_page_blob_with_tags.yaml new file mode 100644 index 000000000000..fabfd4a44860 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_create_page_blob_with_tags.yaml @@ -0,0 +1,88 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:36 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container31f2152e?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:35 GMT + etag: '"0x8D7F70C74D0FEB1"' + last-modified: Wed, 13 May 2020 07:08:36 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container31f2152e?timeout=5&restype=container +- request: + body: null + headers: + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-content-length: + - '512' + x-ms-blob-type: + - PageBlob + x-ms-date: + - Wed, 13 May 2020 07:08:36 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container31f2152e/blob31f2152e + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:36 GMT + etag: '"0x8D7F70C74EB3419"' + last-modified: Wed, 13 May 2020 07:08:36 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:36.9454105Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container31f2152e/blob31f2152e +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:37 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container31f2152e/blob31f2152e?comp=tags + response: + body: + string: "\uFEFF\ntag1firsttagtag2secondtagtag3thirdtag" + headers: + content-length: '220' + content-type: application/xml + date: Wed, 13 May 2020 07:08:36 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/container31f2152e/blob31f2152e?comp=tags +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_filter_blobs.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_filter_blobs.yaml new file mode 100644 index 000000000000..e60ed671a186 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_filter_blobs.yaml @@ -0,0 +1,308 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:28:13 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container2fd60f8e?timeout=5&restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:61a4c08a-e01e-0051-3df8-28b6d1000000\nTime:2020-05-13T07:28:14.1301838Z" + headers: + content-length: '230' + content-type: application/xml + date: Wed, 13 May 2020 07:28:13 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: ContainerAlreadyExists + x-ms-version: '2019-10-10' + status: + code: 409 + message: The specified container already exists. + url: https://huxfrancec.blob.core.windows.net/container2fd60f8e?timeout=5&restype=container +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:28:14 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container12fd60f8e?restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:61a4c0d3-e01e-0051-76f8-28b6d1000000\nTime:2020-05-13T07:28:14.2963027Z" + headers: + content-length: '230' + content-type: application/xml + date: Wed, 13 May 2020 07:28:13 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: ContainerAlreadyExists + x-ms-version: '2019-10-10' + status: + code: 409 + message: The specified container already exists. + url: https://huxfrancec.blob.core.windows.net/container12fd60f8e?restype=container +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:28:14 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container22fd60f8e?restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:61a4c0f5-e01e-0051-10f8-28b6d1000000\nTime:2020-05-13T07:28:14.4584192Z" + headers: + content-length: '230' + content-type: application/xml + date: Wed, 13 May 2020 07:28:14 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: ContainerAlreadyExists + x-ms-version: '2019-10-10' + status: + code: 409 + message: The specified container already exists. + url: https://huxfrancec.blob.core.windows.net/container22fd60f8e?restype=container +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:28:14 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container32fd60f8e?restype=container + response: + body: + string: "\uFEFFContainerAlreadyExistsThe + specified container already exists.\nRequestId:61a4c122-e01e-0051-33f8-28b6d1000000\nTime:2020-05-13T07:28:14.6175327Z" + headers: + content-length: '230' + content-type: application/xml + date: Wed, 13 May 2020 07:28:14 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: ContainerAlreadyExists + x-ms-version: '2019-10-10' + status: + code: 409 + message: The specified container already exists. + url: https://huxfrancec.blob.core.windows.net/container32fd60f8e?restype=container +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:28:14 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container2fd60f8e/blob2fd60f8e + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:28:14 GMT + etag: '"0x8D7F70F32F8099E"' + last-modified: Wed, 13 May 2020 07:28:14 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:28:14.7920841Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container2fd60f8e/blob2fd60f8e +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:28:14 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container12fd60f8e/blob2fd60f8e + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:28:14 GMT + etag: '"0x8D7F70F33135EC7"' + last-modified: Wed, 13 May 2020 07:28:14 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:28:14.9702103Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container12fd60f8e/blob2fd60f8e +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:28:15 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container22fd60f8e/blob2fd60f8e + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:28:14 GMT + etag: '"0x8D7F70F332C6985"' + last-modified: Wed, 13 May 2020 07:28:15 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:28:15.1353264Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container22fd60f8e/blob2fd60f8e +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:28:15 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container32fd60f8e/blob2fd60f8e + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:28:14 GMT + etag: '"0x8D7F70F33459B67"' + last-modified: Wed, 13 May 2020 07:28:15 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:28:15.3004426Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container32fd60f8e/blob2fd60f8e +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:28:15 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/?where=%22tag1%22%3D'firsttag'&maxresults=2&comp=blobs + response: + body: + string: "\uFEFF\n"tag1"='firsttag'2blob2fd60f8econtainer12fd60f8efirsttagblobd79a0d11container1563d06cf66d4a66aa2287700480c19ed79a0d11firsttag2!292!MDAwMDY2IWNvbnRhaW5lcjFjZjg0NWE0NzM0ZDQ4YjFhNDM4NGZmN2IyZjM1YjViZDc5YTBkMTEBMDFENjI4RjA2MzRBQjUxQSEwMDAwMTIhYmxvYmQ3OWEwZDExITAwMDAxNiEIAAAACAAAAGZpcnN0dGFnITAwMDAwMSEwITAwMDAyOCE5OTk5LTEyLTMxVDIzOjU5OjU5Ljk5OTk5OTlaITAwMDAzNiEwYmNjODQwNi0wYzJiLTQ0MWItYWRjZS1hNDE3ZTA5YzBlY2YhMDAwMDA0IXRhZzEh" + headers: + content-type: application/xml + date: Wed, 13 May 2020 07:28:15 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-10-10' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/?where=%22tag1%22%3D'firsttag'&maxresults=2&comp=blobs +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:28:15 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/?where=%22tag1%22%3D'firsttag'&marker=2!292!MDAwMDY2IWNvbnRhaW5lcjFjZjg0NWE0NzM0ZDQ4YjFhNDM4NGZmN2IyZjM1YjViZDc5YTBkMTEBMDFENjI4RjA2MzRBQjUxQSEwMDAwMTIhYmxvYmQ3OWEwZDExITAwMDAxNiEIAAAACAAAAGZpcnN0dGFnITAwMDAwMSEwITAwMDAyOCE5OTk5LTEyLTMxVDIzOjU5OjU5Ljk5OTk5OTlaITAwMDAzNiEwYmNjODQwNi0wYzJiLTQ0MWItYWRjZS1hNDE3ZTA5YzBlY2YhMDAwMDA0IXRhZzEh&maxresults=2&comp=blobs + response: + body: + string: "\uFEFF\n2!292!MDAwMDY2IWNvbnRhaW5lcjFjZjg0NWE0NzM0ZDQ4YjFhNDM4NGZmN2IyZjM1YjViZDc5YTBkMTEBMDFENjI4RjA2MzRBQjUxQSEwMDAwMTIhYmxvYmQ3OWEwZDExITAwMDAxNiEIAAAACAAAAGZpcnN0dGFnITAwMDAwMSEwITAwMDAyOCE5OTk5LTEyLTMxVDIzOjU5OjU5Ljk5OTk5OTlaITAwMDAzNiEwYmNjODQwNi0wYzJiLTQ0MWItYWRjZS1hNDE3ZTA5YzBlY2YhMDAwMDA0IXRhZzEh"tag1"='firsttag'2blobd79a0d11container1cf845a4734d48b1a4384ff7b2f35b5bd79a0d11firsttagblobd79a0d11container2216a5d8ac6948708416df41420f55c6d79a0d11firsttag2!252!MDAwMDM1IWNvbnRhaW5lcjIyZmQ2MGY4ZQEwMUQ2MjhGNkY3RTU1OUM2ITAwMDAxMiFibG9iMmZkNjBmOGUhMDAwMDE2IQgAAAAIAAAAZmlyc3R0YWchMDAwMDAxITAhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVohMDAwMDM2ITBiNjZiYzg0LWFmMWItNGFiMC1iNGU3LTEzZDA2ODZhNzIzNSEwMDAwMDQhdGFnMSE-" + headers: + content-type: application/xml + date: Wed, 13 May 2020 07:28:15 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-10-10' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/?where=%22tag1%22%3D'firsttag'&marker=2!292!MDAwMDY2IWNvbnRhaW5lcjFjZjg0NWE0NzM0ZDQ4YjFhNDM4NGZmN2IyZjM1YjViZDc5YTBkMTEBMDFENjI4RjA2MzRBQjUxQSEwMDAwMTIhYmxvYmQ3OWEwZDExITAwMDAxNiEIAAAACAAAAGZpcnN0dGFnITAwMDAwMSEwITAwMDAyOCE5OTk5LTEyLTMxVDIzOjU5OjU5Ljk5OTk5OTlaITAwMDAzNiEwYmNjODQwNi0wYzJiLTQ0MWItYWRjZS1hNDE3ZTA5YzBlY2YhMDAwMDA0IXRhZzEh&maxresults=2&comp=blobs +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_properties_returns_tags_num.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_properties_returns_tags_num.yaml new file mode 100644 index 000000000000..fda7675296e5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_properties_returns_tags_num.yaml @@ -0,0 +1,143 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 16:21:51 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container232b19b0?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 16:21:51 GMT + etag: '"0x8D7F759BE7BA48B"' + last-modified: Wed, 13 May 2020 16:21:51 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container232b19b0?timeout=5&restype=container +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 16:21:51 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container232b19b0/blob232b19b0 + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 16:21:51 GMT + etag: '"0x8D7F759BE98122F"' + last-modified: Wed, 13 May 2020 16:21:51 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T16:21:51.8001711Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container232b19b0/blob232b19b0 +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 16:21:51 GMT + x-ms-version: + - '2019-10-10' + method: HEAD + uri: https://storagename.blob.core.windows.net/container232b19b0/blob232b19b0 + response: + body: + string: '' + headers: + accept-ranges: bytes + content-length: '1024' + content-md5: yaNM/IXZgmmMasifdgcavQ== + content-type: application/octet-stream + date: Wed, 13 May 2020 16:21:51 GMT + etag: '"0x8D7F759BE98122F"' + last-modified: Wed, 13 May 2020 16:21:51 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-access-tier: Hot + x-ms-access-tier-inferred: 'true' + x-ms-blob-type: BlockBlob + x-ms-creation-time: Wed, 13 May 2020 16:21:51 GMT + x-ms-is-current-version: 'true' + x-ms-lease-state: available + x-ms-lease-status: unlocked + x-ms-server-encrypted: 'true' + x-ms-tag-count: '3' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T16:21:51.8001711Z' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/container232b19b0/blob232b19b0 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 16:21:52 GMT + x-ms-range: + - bytes=0-33554431 + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container232b19b0/blob232b19b0 + response: + body: + string: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + accept-ranges: bytes + content-length: '1024' + content-range: bytes 0-1023/1024 + content-type: application/octet-stream + date: Wed, 13 May 2020 16:21:52 GMT + etag: '"0x8D7F759BE98122F"' + last-modified: Wed, 13 May 2020 16:21:51 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-blob-content-md5: yaNM/IXZgmmMasifdgcavQ== + x-ms-blob-type: BlockBlob + x-ms-creation-time: Wed, 13 May 2020 16:21:51 GMT + x-ms-is-current-version: 'true' + x-ms-lease-state: available + x-ms-lease-status: unlocked + x-ms-server-encrypted: 'true' + x-ms-tag-count: '3' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T16:21:51.8001711Z' + status: + code: 206 + message: Partial Content + url: https://huxfrancec.blob.core.windows.net/container232b19b0/blob232b19b0 +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_tags.yaml new file mode 100644 index 000000000000..304503d9a087 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_tags.yaml @@ -0,0 +1,118 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:38 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container3f170fe3?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:38 GMT + etag: '"0x8D7F70C760A07A2"' + last-modified: Wed, 13 May 2020 07:08:38 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container3f170fe3?timeout=5&restype=container +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:08:38 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container3f170fe3/blob3f170fe3 + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:08:38 GMT + etag: '"0x8D7F70C7624B011"' + last-modified: Wed, 13 May 2020 07:08:38 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:38.9998609Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container3f170fe3/blob3f170fe3 +- request: + body: ' + + tag1firsttagtag2secondtagtag3thirdtag' + headers: + Content-Length: + - '217' + Content-Type: + - application/xml; charset=utf-8 + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:39 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container3f170fe3/blob3f170fe3?comp=tags + response: + body: + string: '' + headers: + date: Wed, 13 May 2020 07:08:38 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 204 + message: No Content + url: https://huxfrancec.blob.core.windows.net/container3f170fe3/blob3f170fe3?comp=tags +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:39 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container3f170fe3/blob3f170fe3?comp=tags + response: + body: + string: "\uFEFF\ntag1firsttagtag2secondtagtag3thirdtag" + headers: + content-length: '220' + content-type: application/xml + date: Wed, 13 May 2020 07:08:38 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/container3f170fe3/blob3f170fe3?comp=tags +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_tags_for_a_snapshot.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_tags_for_a_snapshot.yaml new file mode 100644 index 000000000000..467523220ecc --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_get_blob_tags_for_a_snapshot.yaml @@ -0,0 +1,119 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:39 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container5e2f1618?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:39 GMT + etag: '"0x8D7F70C76BBD474"' + last-modified: Wed, 13 May 2020 07:08:39 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container5e2f1618?timeout=5&restype=container +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:08:40 GMT + x-ms-tags: + - '%2B-.%2F%3A%3D_%20=firsttag&tag2=%2B-.%2F%3A%3D_&%2B-.%2F%3A%3D_1=%2B-.%2F%3A%3D_' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container5e2f1618/blob5e2f1618 + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:08:39 GMT + etag: '"0x8D7F70C76D55B4B"' + last-modified: Wed, 13 May 2020 07:08:40 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:40.1576779Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container5e2f1618/blob5e2f1618 +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:40 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container5e2f1618/blob5e2f1618?comp=snapshot + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:40 GMT + etag: '"0x8D7F70C76D55B4B"' + last-modified: Wed, 13 May 2020 07:08:40 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-request-server-encrypted: 'false' + x-ms-snapshot: '2020-05-13T07:08:40.3217927Z' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:40.3227927Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container5e2f1618/blob5e2f1618?comp=snapshot +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:40 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container5e2f1618/blob5e2f1618?snapshot=2020-05-13T07:08:40.3217927Z&comp=tags + response: + body: + string: "\uFEFF\n+-./:=_ + firsttag+-./:=_1+-./:=_tag2+-./:=_" + headers: + content-length: '225' + content-type: application/xml + date: Wed, 13 May 2020 07:08:40 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/container5e2f1618/blob5e2f1618?snapshot=2020-05-13T07:08:40.3217927Z&comp=tags +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_list_blobs_returns_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_list_blobs_returns_tags.yaml new file mode 100644 index 000000000000..b9fb4ab9aa31 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_list_blobs_returns_tags.yaml @@ -0,0 +1,96 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:40 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerf7e61444?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:40 GMT + etag: '"0x8D7F70C7770511E"' + last-modified: Wed, 13 May 2020 07:08:41 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/containerf7e61444?timeout=5&restype=container +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:08:41 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/containerf7e61444/blobf7e61444 + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:08:40 GMT + etag: '"0x8D7F70C778BACE2"' + last-modified: Wed, 13 May 2020 07:08:41 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:41.3535225Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/containerf7e61444/blobf7e61444 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:41 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/containerf7e61444?include=tags&restype=container&comp=list + response: + body: + string: "\uFEFFblobf7e614442020-05-13T07:08:41.3535225ZtrueWed, + 13 May 2020 07:08:41 GMTWed, 13 May 2020 07:08:41 + GMT0x8D7F70C778BACE21024application/octet-streamyaNM/IXZgmmMasifdgcavQ==BlockBlobHottrueunlockedavailabletrue3tag1firsttagtag2secondtagtag3thirdtag" + headers: + content-type: application/xml + date: Wed, 13 May 2020 07:08:40 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-10-10' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/containerf7e61444?include=tags&restype=container&comp=list +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_set_blob_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_set_blob_tags.yaml new file mode 100644 index 000000000000..c65a7d2148a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_set_blob_tags.yaml @@ -0,0 +1,92 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:41 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container3fb30fef?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:41 GMT + etag: '"0x8D7F70C780C36A2"' + last-modified: Wed, 13 May 2020 07:08:42 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container3fb30fef?timeout=5&restype=container +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:08:42 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container3fb30fef/blob3fb30fef + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:08:42 GMT + etag: '"0x8D7F70C782597B4"' + last-modified: Wed, 13 May 2020 07:08:42 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:42.3612340Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container3fb30fef/blob3fb30fef +- request: + body: ' + + tag1firsttagtag2secondtagtag3thirdtag' + headers: + Content-Length: + - '217' + Content-Type: + - application/xml; charset=utf-8 + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:42 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container3fb30fef/blob3fb30fef?comp=tags + response: + body: + string: '' + headers: + date: Wed, 13 May 2020 07:08:42 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 204 + message: No Content + url: https://huxfrancec.blob.core.windows.net/container3fb30fef/blob3fb30fef?comp=tags +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_set_blob_tags_for_a_version.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_set_blob_tags_for_a_version.yaml new file mode 100644 index 000000000000..b260088367a3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_set_blob_tags_for_a_version.yaml @@ -0,0 +1,129 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:42 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container498a15ba?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:42 GMT + etag: '"0x8D7F70C78A76D7B"' + last-modified: Wed, 13 May 2020 07:08:43 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container498a15ba?timeout=5&restype=container +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:08:43 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container498a15ba/blob498a15ba + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:08:43 GMT + etag: '"0x8D7F70C78C1A5C8"' + last-modified: Wed, 13 May 2020 07:08:43 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:43.3839560Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container498a15ba/blob498a15ba +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:08:43 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container498a15ba/blob498a15ba + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:08:43 GMT + etag: '"0x8D7F70C78DAFEBD"' + last-modified: Wed, 13 May 2020 07:08:43 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:43.5520740Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container498a15ba/blob498a15ba +- request: + body: ' + + tag1firsttagtag2secondtagtag3thirdtag' + headers: + Content-Length: + - '217' + Content-Type: + - application/xml; charset=utf-8 + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:43 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container498a15ba/blob498a15ba?versionid=2020-05-13T07:08:43.3839560Z&comp=tags + response: + body: + string: '' + headers: + date: Wed, 13 May 2020 07:08:43 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 204 + message: No Content + url: https://huxfrancec.blob.core.windows.net/container498a15ba/blob498a15ba?versionid=2020-05-13T07:08:43.3839560Z&comp=tags +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_start_copy_from_url_with_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_start_copy_from_url_with_tags.yaml new file mode 100644 index 000000000000..8aa2ef61e7ef --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_start_copy_from_url_with_tags.yaml @@ -0,0 +1,168 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:43 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container7ba116cd?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:43 GMT + etag: '"0x8D7F70C795D64CF"' + last-modified: Wed, 13 May 2020 07:08:44 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container7ba116cd?timeout=5&restype=container +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:08:44 GMT + x-ms-tags: + - '' + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container7ba116cd/blob7ba116cd + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:08:44 GMT + etag: '"0x8D7F70C7977A92D"' + last-modified: Wed, 13 May 2020 07:08:44 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:44.5767981Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container7ba116cd/blob7ba116cd +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-copy-source: + - https://huxfrancec.blob.core.windows.net/container7ba116cd/blob7ba116cd + x-ms-date: + - Wed, 13 May 2020 07:08:44 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container7ba116cd/blob1copy + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:44 GMT + etag: '"0x8D7F70C799261ED"' + last-modified: Wed, 13 May 2020 07:08:44 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-copy-id: a085ccb8-a19f-4398-a044-d3345e582900 + x-ms-copy-status: success + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:44.7519213Z' + status: + code: 202 + message: Accepted + url: https://huxfrancec.blob.core.windows.net/container7ba116cd/blob1copy +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:44 GMT + x-ms-range: + - bytes=0-33554431 + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container7ba116cd/blob1copy + response: + body: + string: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + accept-ranges: bytes + content-length: '1024' + content-range: bytes 0-1023/1024 + content-type: application/octet-stream + date: Wed, 13 May 2020 07:08:44 GMT + etag: '"0x8D7F70C799261ED"' + last-modified: Wed, 13 May 2020 07:08:44 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-blob-content-md5: yaNM/IXZgmmMasifdgcavQ== + x-ms-blob-type: BlockBlob + x-ms-copy-completion-time: Wed, 13 May 2020 07:08:44 GMT + x-ms-copy-id: a085ccb8-a19f-4398-a044-d3345e582900 + x-ms-copy-progress: 1024/1024 + x-ms-copy-source: https://huxfrancec.blob.core.windows.net/container7ba116cd/blob7ba116cd + x-ms-copy-status: success + x-ms-creation-time: Wed, 13 May 2020 07:08:44 GMT + x-ms-is-current-version: 'true' + x-ms-lease-state: available + x-ms-lease-status: unlocked + x-ms-server-encrypted: 'true' + x-ms-tag-count: '3' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:44.7519213Z' + status: + code: 206 + message: Partial Content + url: https://huxfrancec.blob.core.windows.net/container7ba116cd/blob1copy +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:45 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container7ba116cd/blob1copy?comp=tags + response: + body: + string: "\uFEFF\ntag1firsttagtag2secondtagtag3thirdtag" + headers: + content-length: '220' + content-type: application/xml + date: Wed, 13 May 2020 07:08:44 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/container7ba116cd/blob1copy?comp=tags +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_upload_block_blob_with_tags.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_upload_block_blob_with_tags.yaml new file mode 100644 index 000000000000..05d3cd0acb8a --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_tags_async.test_upload_block_blob_with_tags.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:45 GMT + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container49b615ad?timeout=5&restype=container + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 13 May 2020 07:08:45 GMT + etag: '"0x8D7F70C7A487E06"' + last-modified: Wed, 13 May 2020 07:08:45 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container49b615ad?timeout=5&restype=container +- request: + body: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 13 May 2020 07:08:46 GMT + x-ms-tags: + - tag1=firsttag&tag2=secondtag&tag3=thirdtag + x-ms-version: + - '2019-10-10' + method: PUT + uri: https://storagename.blob.core.windows.net/container49b615ad/blob49b615ad + response: + body: + string: '' + headers: + content-length: '0' + content-md5: yaNM/IXZgmmMasifdgcavQ== + date: Wed, 13 May 2020 07:08:45 GMT + etag: '"0x8D7F70C7A639360"' + last-modified: Wed, 13 May 2020 07:08:46 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: ov8U1LLnyKc= + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-10-10' + x-ms-version-id: '2020-05-13T07:08:46.1228896Z' + status: + code: 201 + message: Created + url: https://huxfrancec.blob.core.windows.net/container49b615ad/blob49b615ad +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-storage-blob/12.3.2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-date: + - Wed, 13 May 2020 07:08:46 GMT + x-ms-version: + - '2019-10-10' + method: GET + uri: https://storagename.blob.core.windows.net/container49b615ad/blob49b615ad?comp=tags + response: + body: + string: "\uFEFF\ntag1firsttagtag2secondtagtag3thirdtag" + headers: + content-length: '220' + content-type: application/xml + date: Wed, 13 May 2020 07:08:46 GMT + server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-10-10' + status: + code: 200 + message: OK + url: https://huxfrancec.blob.core.windows.net/container49b615ad/blob49b615ad?comp=tags +version: 1 diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_tags.py b/sdk/storage/azure-storage-blob/tests/test_blob_tags.py new file mode 100644 index 000000000000..83d5a6d54df5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/test_blob_tags.py @@ -0,0 +1,287 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import os +import uuid +from enum import Enum +try: + from urllib.parse import quote +except ImportError: + from urllib2 import quote + +from _shared.testcase import StorageTestCase, GlobalStorageAccountPreparer +from azure.core.exceptions import ( + ResourceExistsError) +from azure.storage.blob import ( + BlobServiceClient, + BlobBlock) + +#------------------------------------------------------------------------------ + +TEST_CONTAINER_PREFIX = 'container' +TEST_BLOB_PREFIX = 'blob' +#------------------------------------------------------------------------------ + +class StorageBlobTagsTest(StorageTestCase): + + def _setup(self, storage_account, key): + self.bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=key) + self.container_name = self.get_resource_name("container") + if self.is_live: + container = self.bsc.get_container_client(self.container_name) + try: + container.create_container(timeout=5) + except ResourceExistsError: + pass + self.byte_data = self.get_random_bytes(1024) + + + def _teardown(self, FILE_PATH): + if os.path.isfile(FILE_PATH): + try: + os.remove(FILE_PATH) + except: + pass + + #--Helpers----------------------------------------------------------------- + def _get_blob_reference(self): + return self.get_resource_name(TEST_BLOB_PREFIX) + + def _create_block_blob(self, tags=None, container_name=None): + blob_name = self._get_blob_reference() + blob_client = self.bsc.get_blob_client(container_name or self.container_name, blob_name) + resp = blob_client.upload_blob(self.byte_data, length=len(self.byte_data), overwrite=True, tags=tags) + return blob_client, resp + + def _create_empty_block_blob(self): + blob_name = self._get_blob_reference() + blob_client = self.bsc.get_blob_client(self.container_name, blob_name) + resp = blob_client.upload_blob(b'', length=0, overwrite=True) + return blob_client, resp + + def _create_append_blob(self, tags=None): + blob_name = self._get_blob_reference() + blob_client = self.bsc.get_blob_client(self.container_name, blob_name) + resp = blob_client.create_append_blob(tags=tags) + return blob_client, resp + + def _create_page_blob(self, tags=None): + blob_name = self._get_blob_reference() + blob_client = self.bsc.get_blob_client(self.container_name, blob_name) + resp = blob_client.create_page_blob(tags=tags, size=512) + return blob_client, resp + + def _create_container(self, prefix="container"): + container_name = self.get_resource_name(prefix) + try: + self.bsc.create_container(container_name) + except: + pass + return container_name + + #-- test cases for blob tags ---------------------------------------------- + + @GlobalStorageAccountPreparer() + def test_set_blob_tags(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + blob_client, _ = self._create_block_blob() + + # Act + blob_tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + resp = blob_client.set_blob_tags(blob_tags) + + # Assert + self.assertIsNotNone(resp) + + @GlobalStorageAccountPreparer() + def test_set_blob_tags_for_a_version(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + # use this version to set tag + blob_client, resp = self._create_block_blob() + self._create_block_blob() + # TODO: enable versionid for this account and test set tag for a version + + # Act + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + resp = blob_client.set_blob_tags(tags, version_id=resp['version_id']) + + # Assert + self.assertIsNotNone(resp) + + @GlobalStorageAccountPreparer() + def test_get_blob_tags(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + blob_client, resp = self._create_block_blob() + + # Act + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client.set_blob_tags(tags) + + resp = blob_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), 3) + for key, value in resp.items(): + self.assertEqual(tags[key], value) + + @GlobalStorageAccountPreparer() + def test_get_blob_tags_for_a_snapshot(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + tags = {"+-./:=_ ": "firsttag", "tag2": "+-./:=_", "+-./:=_1": "+-./:=_"} + blob_client, resp = self._create_block_blob(tags=tags) + + snapshot = blob_client.create_snapshot() + snapshot_client = self.bsc.get_blob_client(self.container_name, blob_client.blob_name, snapshot=snapshot) + + resp = snapshot_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), 3) + for key, value in resp.items(): + self.assertEqual(tags[key], value) + + @GlobalStorageAccountPreparer() + def test_upload_block_blob_with_tags(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client, resp = self._create_block_blob(tags=tags) + + resp = blob_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), 3) + + @GlobalStorageAccountPreparer() + def test_get_blob_properties_returns_tags_num(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client, resp = self._create_block_blob(tags=tags) + + resp = blob_client.get_blob_properties() + downloaded = blob_client.download_blob() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(resp.tag_count, len(tags)) + self.assertEqual(downloaded.properties.tag_count, len(tags)) + + @GlobalStorageAccountPreparer() + def test_create_append_blob_with_tags(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + tags = {"+-./:=_ ": "firsttag", "tag2": "+-./:=_", "+-./:=_1": "+-./:=_"} + blob_client, resp = self._create_append_blob(tags=tags) + + resp = blob_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), 3) + + @GlobalStorageAccountPreparer() + def test_create_page_blob_with_tags(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client, resp = self._create_page_blob(tags=tags) + + resp = blob_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), 3) + + @GlobalStorageAccountPreparer() + def test_commit_block_list_with_tags(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client, resp = self._create_empty_block_blob() + + blob_client.stage_block('1', b'AAA') + blob_client.stage_block('2', b'BBB') + blob_client.stage_block('3', b'CCC') + + # Act + block_list = [BlobBlock(block_id='1'), BlobBlock(block_id='2'), BlobBlock(block_id='3')] + blob_client.commit_block_list(block_list, tags=tags) + + resp = blob_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), len(tags)) + + @GlobalStorageAccountPreparer() + def test_start_copy_from_url_with_tags(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client, resp = self._create_block_blob() + + # Act + sourceblob = '{0}/{1}/{2}'.format( + self.account_url(storage_account, "blob"), self.container_name, blob_client.blob_name) + + copyblob = self.bsc.get_blob_client(self.container_name, 'blob1copy') + copy = copyblob.start_copy_from_url(sourceblob, tags=tags) + + # Assert + self.assertIsNotNone(copy) + self.assertEqual(copy['copy_status'], 'success') + self.assertFalse(isinstance(copy['copy_status'], Enum)) + self.assertIsNotNone(copy['copy_id']) + + copy_content = copyblob.download_blob().readall() + self.assertEqual(copy_content, self.byte_data) + + resp = copyblob.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), len(tags)) + + @GlobalStorageAccountPreparer() + def test_list_blobs_returns_tags(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + self._create_block_blob(tags=tags) + container = self.bsc.get_container_client(self.container_name) + blob_list = container.list_blobs(include="tags") + + #Assert + for blob in blob_list: + self.assertEqual(blob.tag_count, len(tags)) + for key, value in blob.tags.items(): + self.assertEqual(tags[key], value) + + @GlobalStorageAccountPreparer() + def test_filter_blobs(self, resource_group, location, storage_account, storage_account_key): + self._setup(storage_account, storage_account_key) + container_name1 = self._create_container(prefix="container1") + container_name2 = self._create_container(prefix="container2") + container_name3 = self._create_container(prefix="container3") + + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + self._create_block_blob(tags=tags) + self._create_block_blob(tags=tags, container_name=container_name1) + self._create_block_blob(tags=tags, container_name=container_name2) + self._create_block_blob(tags=tags, container_name=container_name3) + + where = "tag1='firsttag'" + blob_list = self.bsc.find_blobs_by_tags(filter_expression=where, results_per_page=2).by_page() + first_page = next(blob_list) + items_on_page1 = list(first_page) + second_page = next(blob_list) + items_on_page2 = list(second_page) + + self.assertEqual(2, len(items_on_page1)) + + for blob in items_on_page1: + self.assertEqual(blob.tag_value, "firsttag") + for blob in items_on_page2: + self.assertEqual(blob.tag_value, "firsttag") + +#------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_tags_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_tags_async.py new file mode 100644 index 000000000000..ceda1cf2d3ad --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/test_blob_tags_async.py @@ -0,0 +1,294 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from enum import Enum + +from _shared.asynctestcase import AsyncStorageTestCase + +try: + from urllib.parse import quote +except ImportError: + from urllib2 import quote + +from _shared.testcase import GlobalStorageAccountPreparer +from azure.core.exceptions import ( + ResourceExistsError) +from azure.storage.blob import BlobBlock +from azure.storage.blob.aio import BlobServiceClient +#------------------------------------------------------------------------------ + +TEST_CONTAINER_PREFIX = 'container' +TEST_BLOB_PREFIX = 'blob' +#------------------------------------------------------------------------------ + +class StorageBlobTagsTest(AsyncStorageTestCase): + + async def _setup(self, storage_account, key): + self.bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=key) + self.container_name = self.get_resource_name("container") + if self.is_live: + container = self.bsc.get_container_client(self.container_name) + try: + await container.create_container(timeout=5) + except ResourceExistsError: + pass + self.byte_data = self.get_random_bytes(1024) + + #--Helpers----------------------------------------------------------------- + def _get_blob_reference(self): + return self.get_resource_name(TEST_BLOB_PREFIX) + + async def _create_block_blob(self, tags=None, container_name=None): + blob_name = self._get_blob_reference() + blob_client = self.bsc.get_blob_client(container_name or self.container_name, blob_name) + resp = await blob_client.upload_blob(self.byte_data, length=len(self.byte_data), overwrite=True, tags=tags) + return blob_client, resp + + async def _create_empty_block_blob(self): + blob_name = self._get_blob_reference() + blob_client = self.bsc.get_blob_client(self.container_name, blob_name) + resp = await blob_client.upload_blob(b'', length=0, overwrite=True) + return blob_client, resp + + async def _create_append_blob(self, tags=None): + blob_name = self._get_blob_reference() + blob_client = self.bsc.get_blob_client(self.container_name, blob_name) + resp = await blob_client.create_append_blob(tags=tags) + return blob_client, resp + + async def _create_page_blob(self, tags=None): + blob_name = self._get_blob_reference() + blob_client = self.bsc.get_blob_client(self.container_name, blob_name) + resp = await blob_client.create_page_blob(tags=tags, size=512) + return blob_client, resp + + async def _create_container(self, prefix="container"): + container_name = self.get_resource_name(prefix) + try: + await self.bsc.create_container(container_name) + except: + pass + return container_name + + #-- test cases for blob tags ---------------------------------------------- + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_set_blob_tags(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + blob_client, _ = await self._create_block_blob() + + # Act + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + resp = await blob_client.set_blob_tags(tags) + + # Assert + self.assertIsNotNone(resp) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_set_blob_tags_for_a_version(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + # use this version to set tag + blob_client, resp = await self._create_block_blob() + await self._create_block_blob() + # TODO: enable versionid for this account and test set tag for a version + + # Act + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + resp = await blob_client.set_blob_tags(tags, version_id=resp['version_id']) + + # Assert + self.assertIsNotNone(resp) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_get_blob_tags(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + blob_client, resp = await self._create_block_blob() + + # Act + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + await blob_client.set_blob_tags(tags) + + resp = await blob_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), 3) + for key, value in resp.items(): + self.assertEqual(tags[key], value) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_get_blob_tags_for_a_snapshot(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + tags = {"+-./:=_ ": "firsttag", "tag2": "+-./:=_", "+-./:=_1": "+-./:=_"} + blob_client, resp = await self._create_block_blob(tags=tags) + + snapshot = await blob_client.create_snapshot() + snapshot_client = self.bsc.get_blob_client(self.container_name, blob_client.blob_name, snapshot=snapshot) + + resp = await snapshot_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), 3) + for key, value in resp.items(): + self.assertEqual(tags[key], value) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_upload_block_blob_with_tags(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client, resp = await self._create_block_blob(tags=tags) + + resp = await blob_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), 3) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_get_blob_properties_returns_tags_num(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client, resp = await self._create_block_blob(tags=tags) + + resp = await blob_client.get_blob_properties() + downloaded = await blob_client.download_blob() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(resp.tag_count, len(tags)) + self.assertEqual(downloaded.properties.tag_count, len(tags)) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_create_append_blob_with_tags(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + tags = {"+-./:=_ ": "firsttag", "tag2": "+-./:=_", "+-./:=_1": "+-./:=_"} + blob_client, resp = await self._create_append_blob(tags=tags) + + resp = await blob_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), 3) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_create_page_blob_with_tags(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client, resp = await self._create_page_blob(tags=tags) + + resp = await blob_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), 3) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_commit_block_list_with_tags(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client, resp = await self._create_empty_block_blob() + + await blob_client.stage_block('1', b'AAA') + await blob_client.stage_block('2', b'BBB') + await blob_client.stage_block('3', b'CCC') + + # Act + block_list = [BlobBlock(block_id='1'), BlobBlock(block_id='2'), BlobBlock(block_id='3')] + await blob_client.commit_block_list(block_list, tags=tags) + + resp = await blob_client.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), len(tags)) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_start_copy_from_url_with_tags(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + blob_client, resp = await self._create_block_blob() + + # Act + sourceblob = '{0}/{1}/{2}'.format( + self.account_url(storage_account, "blob"), self.container_name, blob_client.blob_name) + + copyblob = self.bsc.get_blob_client(self.container_name, 'blob1copy') + copy = await copyblob.start_copy_from_url(sourceblob, tags=tags) + + # Assert + self.assertIsNotNone(copy) + self.assertEqual(copy['copy_status'], 'success') + self.assertFalse(isinstance(copy['copy_status'], Enum)) + self.assertIsNotNone(copy['copy_id']) + + copy_content = await (await copyblob.download_blob()).readall() + self.assertEqual(copy_content, self.byte_data) + + resp = await copyblob.get_blob_tags() + + # Assert + self.assertIsNotNone(resp) + self.assertEqual(len(resp), len(tags)) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_list_blobs_returns_tags(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + await self._create_block_blob(tags=tags) + container = self.bsc.get_container_client(self.container_name) + blob_list = container.list_blobs(include="tags") + + #Assert + async for blob in blob_list: + self.assertEqual(blob.tag_count, len(tags)) + for key, value in blob.tags.items(): + self.assertEqual(tags[key], value) + + @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test + async def test_filter_blobs(self, resource_group, location, storage_account, storage_account_key): + await self._setup(storage_account, storage_account_key) + container_name1 = await self._create_container(prefix="container1") + container_name2 = await self._create_container(prefix="container2") + container_name3 = await self._create_container(prefix="container3") + + tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} + await self._create_block_blob(tags=tags) + await self._create_block_blob(tags=tags, container_name=container_name1) + await self._create_block_blob(tags=tags, container_name=container_name2) + await self._create_block_blob(tags=tags, container_name=container_name3) + + where = "\"tag1\"='firsttag'" + blob_list = self.bsc.find_blobs_by_tags(filter_expression=where, results_per_page=2).by_page() + first_page = await blob_list.__anext__() + items_on_page1 = list() + async for item in first_page: + items_on_page1.append(item) + second_page = await blob_list.__anext__() + items_on_page2 = list() + async for item in second_page: + items_on_page2.append(item) + + self.assertEqual(2, len(items_on_page1)) + + for blob in items_on_page1: + self.assertEqual(blob.tag_value, "firsttag") + for blob in items_on_page2: + self.assertEqual(blob.tag_value, "firsttag") + +#------------------------------------------------------------------------------