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 8892b400710e..d227edb86905 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 @@ -80,7 +80,8 @@ class BlobClient(AsyncStorageAccountHostsMixin, BlobClientBase): # pylint: disa shared access key, or an instance of a TokenCredentials class from azure.identity. If the URL already has a SAS token, specifying an explicit credential will take priority. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_authentication_async.py :start-after: [START create_blob_client] :end-before: [END create_blob_client] @@ -229,7 +230,8 @@ async def upload_blob( :returns: Blob-updated property dict (Etag and last modified) :rtype: dict[str, Any] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_hello_world_async.py :start-after: [START upload_a_blob] :end-before: [END upload_a_blob] @@ -310,7 +312,8 @@ async def download_blob(self, offset=None, length=None, validate_content=False, :returns: A iterable data generator (stream) :rtype: ~azure.storage.blob._blob_utils.StorageStreamDownloader - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_hello_world_async.py :start-after: [START download_a_blob] :end-before: [END download_a_blob] @@ -380,7 +383,8 @@ async def delete_blob(self, delete_snapshots=False, **kwargs): The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_hello_world_async.py :start-after: [START delete_blob] :end-before: [END delete_blob] @@ -406,7 +410,8 @@ async def undelete_blob(self, **kwargs): The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common_async.py :start-after: [START undelete_blob] :end-before: [END undelete_blob] @@ -460,7 +465,8 @@ async def get_blob_properties(self, **kwargs): :returns: BlobProperties :rtype: ~azure.storage.blob.models.BlobProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common_async.py :start-after: [START get_blob_properties] :end-before: [END get_blob_properties] @@ -772,7 +778,8 @@ async def create_snapshot(self, metadata=None, **kwargs): :returns: Blob-updated property dict (Snapshot ID, Etag, and last modified). :rtype: dict[str, Any] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common_async.py :start-after: [START create_blob_snapshot] :end-before: [END create_blob_snapshot] @@ -923,7 +930,8 @@ async def start_copy_from_url(self, source_url, metadata=None, incremental_copy= :returns: A dictionary of copy properties (etag, last_modified, copy_id, copy_status). :rtype: Dict[str, Union[str, datetime]] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common_async.py :start-after: [START copy_blob_from_url] :end-before: [END copy_blob_from_url] @@ -957,7 +965,8 @@ async def abort_copy(self, copy_id, **kwargs): :type copy_id: str or ~azure.storage.blob.models.BlobProperties :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common_async.py :start-after: [START abort_copy_blob_from_url] :end-before: [END abort_copy_blob_from_url] @@ -1014,7 +1023,8 @@ async def acquire_lease(self, lease_duration=-1, lease_id=None, **kwargs): :returns: A LeaseClient object. :rtype: ~azure.storage.blob.aio.lease_async.LeaseClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common_async.py :start-after: [START acquire_lease_on_blob] :end-before: [END acquire_lease_on_blob] 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 06238e8d0bd2..10587ebbca9c 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 @@ -80,7 +80,8 @@ class BlobServiceClient(AsyncStorageAccountHostsMixin, BlobServiceClientBase): shared access key, or an instance of a TokenCredentials class from azure.identity. If the URL already has a SAS token, specifying an explicit credential will take priority. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_authentication_async.py :start-after: [START create_blob_service_client] :end-before: [END create_blob_service_client] @@ -153,7 +154,8 @@ async def get_account_information(self, **kwargs): # type: ignore :returns: A dict of account information (SKU and account type). :rtype: dict(str, str) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service_async.py :start-after: [START get_blob_service_account_info] :end-before: [END get_blob_service_account_info] @@ -192,7 +194,8 @@ async def get_service_stats(self, timeout=None, **kwargs): # type: ignore :return: The blob service stats. :rtype: ~azure.storage.blob._generated.models.StorageServiceStats - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service_async.py :start-after: [START get_blob_service_stats] :end-before: [END get_blob_service_stats] @@ -216,7 +219,8 @@ async def get_service_properties(self, timeout=None, **kwargs): The timeout parameter is expressed in seconds. :rtype: ~azure.storage.blob._generated.models.StorageServiceProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service_async.py :start-after: [START get_blob_service_properties] :end-before: [END get_blob_service_properties] @@ -284,7 +288,8 @@ async def set_service_properties( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service_async.py :start-after: [START set_blob_service_properties] :end-before: [END set_blob_service_properties] @@ -334,7 +339,8 @@ def list_containers( :returns: An iterable (auto-paging) of ContainerProperties. :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.models.ContainerProperties] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service_async.py :start-after: [START bsc_list_containers] :end-before: [END bsc_list_containers] @@ -383,7 +389,8 @@ async def create_container( The timeout parameter is expressed in seconds. :rtype: ~azure.storage.blob.aio.container_client_async.ContainerClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service_async.py :start-after: [START bsc_create_container] :end-before: [END bsc_create_container] @@ -443,7 +450,8 @@ async def delete_container( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service_async.py :start-after: [START bsc_delete_container] :end-before: [END bsc_delete_container] @@ -471,7 +479,8 @@ def get_container_client(self, container): :returns: A ContainerClient. :rtype: ~azure.core.blob.aio.container_client_async.ContainerClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service_async.py :start-after: [START bsc_get_container_client] :end-before: [END bsc_get_container_client] @@ -512,7 +521,8 @@ def get_blob_client( :returns: A BlobClient. :rtype: ~azure.storage.blob.aio.blob_client_async.BlobClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service_async.py :start-after: [START bsc_get_blob_client] :end-before: [END bsc_get_blob_client] 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 b4611d3a29d6..58e3e9a184c3 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 @@ -85,7 +85,8 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase): shared access key, or an instance of a TokenCredentials class from azure.identity. If the URL already has a SAS token, specifying an explicit credential will take priority. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START create_container_client_from_service] :end-before: [END create_container_client_from_service] @@ -135,7 +136,8 @@ async def create_container(self, metadata=None, public_access=None, timeout=None The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START create_container] :end-before: [END create_container] @@ -195,7 +197,8 @@ async def delete_container( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START delete_container] :end-before: [END delete_container] @@ -264,7 +267,8 @@ async def acquire_lease( :returns: A LeaseClient object, that can be run in a context manager. :rtype: ~azure.storage.blob.aio.lease_async.LeaseClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START acquire_lease_on_container] :end-before: [END acquire_lease_on_container] @@ -307,7 +311,8 @@ async def get_container_properties(self, lease=None, timeout=None, **kwargs): :return: Properties for the specified container within a container object. :rtype: ~azure.storage.blob.models.ContainerProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START get_container_properties] :end-before: [END get_container_properties] @@ -357,7 +362,8 @@ async def set_container_metadata( # type: ignore The timeout parameter is expressed in seconds. :returns: Container-updated property dict (Etag and last modified). - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START set_container_metadata] :end-before: [END set_container_metadata] @@ -394,7 +400,8 @@ async def get_container_access_policy(self, lease=None, timeout=None, **kwargs): :returns: Access policy information in a dict. :rtype: dict[str, str] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START get_container_access_policy] :end-before: [END get_container_access_policy] @@ -455,7 +462,8 @@ async def set_container_access_policy( The timeout parameter is expressed in seconds. :returns: Container-updated property dict (Etag and last modified). - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START set_container_access_policy] :end-before: [END set_container_access_policy] @@ -510,7 +518,8 @@ def list_blobs(self, name_starts_with=None, include=None, timeout=None, **kwargs :returns: An iterable (auto-paging) response of BlobProperties. :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.models.BlobProperties] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START list_blobs_in_container] :end-before: [END list_blobs_in_container] @@ -682,7 +691,8 @@ async def upload_blob( :returns: A BlobClient to interact with the newly uploaded blob. :rtype: ~azure.storage.blob.aio.blob_client_async.BlobClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START upload_blob_to_container] :end-before: [END upload_blob_to_container] @@ -990,7 +1000,8 @@ def get_blob_client( :returns: A BlobClient. :rtype: ~azure.storage.blob.aio.blob_client_async.BlobClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers_async.py :start-after: [START get_blob_client] :end-before: [END get_blob_client] 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 bedf49a3be52..a0002d83f3dd 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 @@ -106,7 +106,8 @@ class BlobClient(StorageAccountHostsMixin): # pylint: disable=too-many-public-m shared access key, or an instance of a TokenCredentials class from azure.identity. If the URL already has a SAS token, specifying an explicit credential will take priority. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_authentication.py :start-after: [START create_blob_client] :end-before: [END create_blob_client] @@ -210,7 +211,8 @@ def from_connection_string( key, or an instance of a TokenCredentials class from azure.identity. Credentials provided here will take precedence over those in the connection string. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_authentication.py :start-after: [START auth_from_connection_string_blob] :end-before: [END auth_from_connection_string_blob] @@ -533,7 +535,8 @@ def upload_blob( # pylint: disable=too-many-locals :returns: Blob-updated property dict (Etag and last modified) :rtype: dict[str, Any] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_hello_world.py :start-after: [START upload_a_blob] :end-before: [END upload_a_blob] @@ -654,7 +657,8 @@ def download_blob(self, offset=None, length=None, validate_content=False, **kwar :returns: A iterable data generator (stream) :rtype: ~azure.storage.blob._blob_utils.StorageStreamDownloader - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_hello_world.py :start-after: [START download_a_blob] :end-before: [END download_a_blob] @@ -749,7 +753,8 @@ def delete_blob(self, delete_snapshots=False, **kwargs): The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_hello_world.py :start-after: [START delete_blob] :end-before: [END delete_blob] @@ -775,7 +780,8 @@ def undelete_blob(self, **kwargs): The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common.py :start-after: [START undelete_blob] :end-before: [END undelete_blob] @@ -829,7 +835,8 @@ def get_blob_properties(self, **kwargs): :returns: BlobProperties :rtype: ~azure.storage.blob.models.BlobProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common.py :start-after: [START get_blob_properties] :end-before: [END get_blob_properties] @@ -1326,7 +1333,8 @@ def create_snapshot(self, metadata=None, **kwargs): :returns: Blob-updated property dict (Snapshot ID, Etag, and last modified). :rtype: dict[str, Any] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common.py :start-after: [START create_blob_snapshot] :end-before: [END create_blob_snapshot] @@ -1519,7 +1527,8 @@ def start_copy_from_url(self, source_url, metadata=None, incremental_copy=False, :returns: A dictionary of copy properties (etag, last_modified, copy_id, copy_status). :rtype: Dict[str, Union[str, datetime]] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common.py :start-after: [START copy_blob_from_url] :end-before: [END copy_blob_from_url] @@ -1570,7 +1579,8 @@ def abort_copy(self, copy_id, **kwargs): :type copy_id: str or ~azure.storage.blob.models.BlobProperties :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common.py :start-after: [START abort_copy_blob_from_url] :end-before: [END abort_copy_blob_from_url] @@ -1627,7 +1637,8 @@ def acquire_lease(self, lease_duration=-1, lease_id=None, **kwargs): :returns: A LeaseClient object. :rtype: ~azure.storage.blob.lease.LeaseClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_common.py :start-after: [START acquire_lease_on_blob] :end-before: [END acquire_lease_on_blob] 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 ddae62e8d2dc..bb44129bc5ce 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 @@ -83,7 +83,8 @@ class BlobServiceClient(StorageAccountHostsMixin): shared access key, or an instance of a TokenCredentials class from azure.identity. If the URL already has a SAS token, specifying an explicit credential will take priority. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_authentication.py :start-after: [START create_blob_service_client] :end-before: [END create_blob_service_client] @@ -142,7 +143,8 @@ def from_connection_string( key, or an instance of a TokenCredentials class from azure.identity. Credentials provided here will take precedence over those in the connection string. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_authentication.py :start-after: [START auth_from_connection_string] :end-before: [END auth_from_connection_string] @@ -204,7 +206,8 @@ def generate_shared_access_signature( :return: A Shared Access Signature (sas) token. :rtype: str - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_authentication.py :start-after: [START create_sas_token] :end-before: [END create_sas_token] @@ -267,7 +270,8 @@ def get_account_information(self, **kwargs): # type: ignore :returns: A dict of account information (SKU and account type). :rtype: dict(str, str) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service.py :start-after: [START get_blob_service_account_info] :end-before: [END get_blob_service_account_info] @@ -306,7 +310,8 @@ def get_service_stats(self, timeout=None, **kwargs): # type: ignore :return: The blob service stats. :rtype: ~azure.storage.blob._generated.models.StorageServiceStats - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service.py :start-after: [START get_blob_service_stats] :end-before: [END get_blob_service_stats] @@ -330,7 +335,8 @@ def get_service_properties(self, timeout=None, **kwargs): The timeout parameter is expressed in seconds. :rtype: ~azure.storage.blob._generated.models.StorageServiceProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service.py :start-after: [START get_blob_service_properties] :end-before: [END get_blob_service_properties] @@ -398,7 +404,8 @@ def set_service_properties( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service.py :start-after: [START set_blob_service_properties] :end-before: [END set_blob_service_properties] @@ -448,7 +455,8 @@ def list_containers( :returns: An iterable (auto-paging) of ContainerProperties. :rtype: ~azure.core.paging.ItemPaged[~azure.core.blob.models.ContainerProperties] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service.py :start-after: [START bsc_list_containers] :end-before: [END bsc_list_containers] @@ -497,7 +505,8 @@ def create_container( The timeout parameter is expressed in seconds. :rtype: ~azure.storage.blob.container_client.ContainerClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service.py :start-after: [START bsc_create_container] :end-before: [END bsc_create_container] @@ -557,7 +566,8 @@ def delete_container( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service.py :start-after: [START bsc_delete_container] :end-before: [END bsc_delete_container] @@ -585,7 +595,8 @@ def get_container_client(self, container): :returns: A ContainerClient. :rtype: ~azure.core.blob.container_client.ContainerClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service.py :start-after: [START bsc_get_container_client] :end-before: [END bsc_get_container_client] @@ -625,7 +636,8 @@ def get_blob_client( :returns: A BlobClient. :rtype: ~azure.storage.blob.blob_client.BlobClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_service.py :start-after: [START bsc_get_blob_client] :end-before: [END bsc_get_blob_client] 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 a4f176c35685..5000bbc261f6 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 @@ -93,7 +93,8 @@ class ContainerClient(StorageAccountHostsMixin): shared access key, or an instance of a TokenCredentials class from azure.identity. If the URL already has a SAS token, specifying an explicit credential will take priority. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START create_container_client_from_service] :end-before: [END create_container_client_from_service] @@ -170,7 +171,8 @@ def from_connection_string( key, or an instance of a TokenCredentials class from azure.identity. Credentials provided here will take precedence over those in the connection string. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_authentication.py :start-after: [START auth_from_connection_string_container] :end-before: [END auth_from_connection_string_container] @@ -263,7 +265,8 @@ def generate_shared_access_signature( :return: A Shared Access Signature (sas) token. :rtype: str - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START generate_sas_token] :end-before: [END generate_sas_token] @@ -313,7 +316,8 @@ def create_container(self, metadata=None, public_access=None, timeout=None, **kw The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START create_container] :end-before: [END create_container] @@ -373,7 +377,8 @@ def delete_container( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START delete_container] :end-before: [END delete_container] @@ -442,7 +447,8 @@ def acquire_lease( :returns: A LeaseClient object, that can be run in a context manager. :rtype: ~azure.storage.blob.lease.LeaseClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START acquire_lease_on_container] :end-before: [END acquire_lease_on_container] @@ -485,7 +491,8 @@ def get_container_properties(self, lease=None, timeout=None, **kwargs): :return: Properties for the specified container within a container object. :rtype: ~azure.storage.blob.models.ContainerProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START get_container_properties] :end-before: [END get_container_properties] @@ -535,7 +542,8 @@ def set_container_metadata( # type: ignore The timeout parameter is expressed in seconds. :returns: Container-updated property dict (Etag and last modified). - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START set_container_metadata] :end-before: [END set_container_metadata] @@ -572,7 +580,8 @@ def get_container_access_policy(self, lease=None, timeout=None, **kwargs): :returns: Access policy information in a dict. :rtype: dict[str, str] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START get_container_access_policy] :end-before: [END get_container_access_policy] @@ -633,7 +642,8 @@ def set_container_access_policy( The timeout parameter is expressed in seconds. :returns: Container-updated property dict (Etag and last modified). - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START set_container_access_policy] :end-before: [END set_container_access_policy] @@ -688,7 +698,8 @@ def list_blobs(self, name_starts_with=None, include=None, timeout=None, **kwargs :returns: An iterable (auto-paging) response of BlobProperties. :rtype: ~azure.core.paging.ItemPaged[~azure.storage.blob.models.BlobProperties] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START list_blobs_in_container] :end-before: [END list_blobs_in_container] @@ -857,7 +868,8 @@ def upload_blob( :returns: A BlobClient to interact with the newly uploaded blob. :rtype: ~azure.storage.blob.blob_client.BlobClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START upload_blob_to_container] :end-before: [END upload_blob_to_container] @@ -1251,7 +1263,8 @@ def get_blob_client( :returns: A BlobClient. :rtype: ~azure.storage.blob.blob_client.BlobClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_blob_samples_containers.py :start-after: [START get_blob_client] :end-before: [END get_blob_client] diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py index b447a978dad6..d4cf4760ba9b 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py @@ -126,7 +126,8 @@ def get_subdirectory_client(self, directory_name, **kwargs): :returns: A Directory Client. :rtype: ~azure.storage.file.aio.directory_client_async.DirectoryClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory_async.py :start-after: [START get_subdirectory_client] :end-before: [END get_subdirectory_client] @@ -157,7 +158,8 @@ async def create_directory( # type: ignore :returns: Directory-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory_async.py :start-after: [START create_directory] :end-before: [END create_directory] @@ -186,7 +188,8 @@ async def delete_directory(self, timeout=None, **kwargs): The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory_async.py :start-after: [START delete_directory] :end-before: [END delete_directory] @@ -212,7 +215,8 @@ def list_directories_and_files(self, name_starts_with=None, timeout=None, **kwar :returns: An auto-paging iterable of dict-like DirectoryProperties and FileProperties :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.file.models.DirectoryProperties] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory_async.py :start-after: [START lists_directory] :end-before: [END lists_directory] @@ -425,7 +429,8 @@ async def create_subdirectory( :returns: DirectoryClient :rtype: ~azure.storage.file.aio.directory_client_async.DirectoryClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory_async.py :start-after: [START create_subdirectory] :end-before: [END create_subdirectory] @@ -452,7 +457,8 @@ async def delete_subdirectory( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory_async.py :start-after: [START delete_subdirectory] :end-before: [END delete_subdirectory] @@ -507,7 +513,8 @@ async def upload_file( :returns: FileClient :rtype: ~azure.storage.file.aio.file_client_async.FileClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory_async.py :start-after: [START upload_file_to_directory] :end-before: [END upload_file_to_directory] @@ -544,7 +551,8 @@ async def delete_file( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory_async.py :start-after: [START delete_file_in_directory] :end-before: [END delete_file_in_directory] diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py index 2b4277d957a5..7bc1a718e75c 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py @@ -195,7 +195,8 @@ async def create_file( # type: ignore :returns: File-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_file_async.py :start-after: [START create_file] :end-before: [END create_file] @@ -306,7 +307,8 @@ async def upload_file( :returns: File-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_file_async.py :start-after: [START upload_file] :end-before: [END upload_file] @@ -374,7 +376,8 @@ async def start_copy_from_url( The timeout parameter is expressed in seconds. :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_file_async.py :start-after: [START copy_file_from_url] :end-before: [END copy_file_from_url] @@ -449,7 +452,8 @@ async def download_file( The timeout parameter is expressed in seconds. :returns: A iterable data generator (stream) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_file_async.py :start-after: [START download_file] :end-before: [END download_file] @@ -488,7 +492,8 @@ async def delete_file(self, timeout=None, **kwargs): The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_file_async.py :start-after: [START delete_file] :end-before: [END delete_file] diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py index 0034963eff8b..02e605621a06 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py @@ -65,7 +65,8 @@ class FileServiceClient(AsyncStorageAccountHostsMixin, FileServiceClientBase): account URL already has a SAS token. The value can be a SAS token string or an account shared access key. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_authentication_async.py :start-after: [START create_file_service_client] :end-before: [END create_file_service_client] @@ -99,7 +100,8 @@ async def get_service_properties(self, timeout=None, **kwargs): The timeout parameter is expressed in seconds. :rtype: ~azure.storage.file._generated.models.StorageServiceProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service_async.py :start-after: [START get_service_properties] :end-before: [END get_service_properties] @@ -142,7 +144,8 @@ async def set_service_properties( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service_async.py :start-after: [START set_service_properties] :end-before: [END set_service_properties] @@ -184,7 +187,8 @@ def list_shares( :returns: An iterable (auto-paging) of ShareProperties. :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.file.models.ShareProperties] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service_async.py :start-after: [START fsc_list_shares] :end-before: [END fsc_list_shares] @@ -231,7 +235,8 @@ async def create_share( The timeout parameter is expressed in seconds. :rtype: ~azure.storage.file.aio.share_client_async.ShareClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service_async.py :start-after: [START fsc_create_shares] :end-before: [END fsc_create_shares] @@ -265,7 +270,8 @@ async def delete_share( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service_async.py :start-after: [START fsc_delete_shares] :end-before: [END fsc_delete_shares] @@ -292,7 +298,8 @@ def get_share_client(self, share, snapshot=None): :returns: A ShareClient. :rtype: ~azure.storage.file.aio.share_client_async.ShareClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service_async.py :start-after: [START get_share_client] :end-before: [END get_share_client] diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/share_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/share_client_async.py index 719200b0e7f3..f5f6de513d65 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/share_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/share_client_async.py @@ -138,7 +138,8 @@ async def create_share( # type: ignore :returns: Share-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share_async.py :start-after: [START create_share] :end-before: [END create_share] @@ -185,7 +186,8 @@ async def create_snapshot( # type: ignore :returns: Share-updated property dict (Snapshot ID, Etag, and last modified). :rtype: dict[str, Any] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share_async.py :start-after: [START create_share_snapshot] :end-before: [END create_share_snapshot] @@ -220,7 +222,8 @@ async def delete_share( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share_async.py :start-after: [START delete_share] :end-before: [END delete_share] @@ -252,7 +255,8 @@ async def get_share_properties(self, timeout=None, **kwargs): :returns: The share properties. :rtype: ~azure.storage.file.models.ShareProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_hello_world_async.py :start-after: [START get_share_properties] :end-before: [END get_share_properties] @@ -285,7 +289,8 @@ async def set_share_quota(self, quota, timeout=None, **kwargs): # type: ignore :returns: Share-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share_async.py :start-after: [START set_share_quota] :end-before: [END set_share_quota] @@ -319,7 +324,8 @@ async def set_share_metadata(self, metadata, timeout=None, **kwargs): # type: ig :returns: Share-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share_async.py :start-after: [START set_share_metadata] :end-before: [END set_share_metadata] @@ -445,7 +451,8 @@ def list_directories_and_files( # type: ignore The timeout parameter is expressed in seconds. :returns: An auto-paging iterable of dict-like DirectoryProperties and FileProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share_async.py :start-after: [START share_list_files_in_dir] :end-before: [END share_list_files_in_dir] diff --git a/sdk/storage/azure-storage-file/azure/storage/file/directory_client.py b/sdk/storage/azure-storage-file/azure/storage/file/directory_client.py index 1e98fe6153f5..36bbd50c1729 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/directory_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/directory_client.py @@ -200,7 +200,8 @@ def get_subdirectory_client(self, directory_name, **kwargs): :returns: A Directory Client. :rtype: ~azure.storage.file.directory_client.DirectoryClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory.py :start-after: [START get_subdirectory_client] :end-before: [END get_subdirectory_client] @@ -231,7 +232,8 @@ def create_directory( # type: ignore :returns: Directory-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory.py :start-after: [START create_directory] :end-before: [END create_directory] @@ -260,7 +262,8 @@ def delete_directory(self, timeout=None, **kwargs): The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory.py :start-after: [START delete_directory] :end-before: [END delete_directory] @@ -286,7 +289,8 @@ def list_directories_and_files(self, name_starts_with=None, timeout=None, **kwar :returns: An auto-paging iterable of dict-like DirectoryProperties and FileProperties :rtype: ~azure.core.paging.ItemPaged[~azure.storage.file.models.DirectoryProperties] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory.py :start-after: [START lists_directory] :end-before: [END lists_directory] @@ -498,7 +502,8 @@ def create_subdirectory( :returns: DirectoryClient :rtype: ~azure.storage.file.directory_client.DirectoryClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory.py :start-after: [START create_subdirectory] :end-before: [END create_subdirectory] @@ -525,7 +530,8 @@ def delete_subdirectory( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory.py :start-after: [START delete_subdirectory] :end-before: [END delete_subdirectory] @@ -580,7 +586,8 @@ def upload_file( :returns: FileClient :rtype: ~azure.storage.file.file_client.FileClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory.py :start-after: [START upload_file_to_directory] :end-before: [END upload_file_to_directory] @@ -617,7 +624,8 @@ def delete_file( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_directory.py :start-after: [START delete_file_in_directory] :end-before: [END delete_file_in_directory] diff --git a/sdk/storage/azure-storage-file/azure/storage/file/file_client.py b/sdk/storage/azure-storage-file/azure/storage/file/file_client.py index 3c2b8dbfc837..99b028a55b67 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/file_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/file_client.py @@ -223,7 +223,8 @@ def from_connection_string( account URL already has a SAS token. The value can be a SAS token string or an account shared access key. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_hello_world.py :start-after: [START create_file_client] :end-before: [END create_file_client] @@ -383,7 +384,8 @@ def create_file( # type: ignore :returns: File-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_file.py :start-after: [START create_file] :end-before: [END create_file] @@ -492,7 +494,8 @@ def upload_file( :returns: File-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_file.py :start-after: [START upload_file] :end-before: [END upload_file] @@ -558,7 +561,8 @@ def start_copy_from_url( The timeout parameter is expressed in seconds. :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_file.py :start-after: [START copy_file_from_url] :end-before: [END copy_file_from_url] @@ -635,7 +639,8 @@ def download_file( The timeout parameter is expressed in seconds. :returns: A iterable data generator (stream) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_file.py :start-after: [START download_file] :end-before: [END download_file] @@ -674,7 +679,8 @@ def delete_file(self, timeout=None, **kwargs): The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_file.py :start-after: [START delete_file] :end-before: [END delete_file] diff --git a/sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py b/sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py index 53fba3a0d745..4fc335954e2a 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py @@ -68,7 +68,8 @@ class FileServiceClient(StorageAccountHostsMixin): account URL already has a SAS token. The value can be a SAS token string or an account shared access key. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_authentication.py :start-after: [START create_file_service_client] :end-before: [END create_file_service_client] @@ -122,7 +123,8 @@ def from_connection_string( account URL already has a SAS token. The value can be a SAS token string or an account shared access key. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_authentication.py :start-after: [START create_file_service_client_from_conn_string] :end-before: [END create_file_service_client_from_conn_string] @@ -182,7 +184,8 @@ def generate_shared_access_signature( :return: A Shared Access Signature (sas) token. :rtype: str - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_authentication.py :start-after: [START generate_sas_token] :end-before: [END generate_sas_token] @@ -214,7 +217,8 @@ def get_service_properties(self, timeout=None, **kwargs): The timeout parameter is expressed in seconds. :rtype: ~azure.storage.file._generated.models.StorageServiceProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service.py :start-after: [START get_service_properties] :end-before: [END get_service_properties] @@ -257,7 +261,8 @@ def set_service_properties( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service.py :start-after: [START set_service_properties] :end-before: [END set_service_properties] @@ -300,7 +305,8 @@ def list_shares( :returns: An iterable (auto-paging) of ShareProperties. :rtype: ~azure.core.paging.ItemPaged[~azure.storage.file.models.ShareProperties] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service.py :start-after: [START fsc_list_shares] :end-before: [END fsc_list_shares] @@ -347,7 +353,8 @@ def create_share( The timeout parameter is expressed in seconds. :rtype: ~azure.storage.file.share_client.ShareClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service.py :start-after: [START fsc_create_shares] :end-before: [END fsc_create_shares] @@ -381,7 +388,8 @@ def delete_share( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service.py :start-after: [START fsc_delete_shares] :end-before: [END fsc_delete_shares] @@ -408,7 +416,8 @@ def get_share_client(self, share, snapshot=None): :returns: A ShareClient. :rtype: ~azure.storage.file.share_client.ShareClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_service.py :start-after: [START get_share_client] :end-before: [END get_share_client] diff --git a/sdk/storage/azure-storage-file/azure/storage/file/share_client.py b/sdk/storage/azure-storage-file/azure/storage/file/share_client.py index 77482bb77ca8..d0e79573fa8f 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/share_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/share_client.py @@ -153,7 +153,8 @@ def from_connection_string( account URL already has a SAS token. The value can be a SAS token string or an account shared access key. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share.py :start-after: [START create_share_client_from_conn_string] :end-before: [END create_share_client_from_conn_string] @@ -305,7 +306,8 @@ def create_share( # type: ignore :returns: Share-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share.py :start-after: [START create_share] :end-before: [END create_share] @@ -352,7 +354,8 @@ def create_snapshot( # type: ignore :returns: Share-updated property dict (Snapshot ID, Etag, and last modified). :rtype: dict[str, Any] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share.py :start-after: [START create_share_snapshot] :end-before: [END create_share_snapshot] @@ -387,7 +390,8 @@ def delete_share( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share.py :start-after: [START delete_share] :end-before: [END delete_share] @@ -419,7 +423,8 @@ def get_share_properties(self, timeout=None, **kwargs): :returns: The share properties. :rtype: ~azure.storage.file.models.ShareProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_hello_world.py :start-after: [START get_share_properties] :end-before: [END get_share_properties] @@ -452,7 +457,8 @@ def set_share_quota(self, quota, timeout=None, **kwargs): # type: ignore :returns: Share-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share.py :start-after: [START set_share_quota] :end-before: [END set_share_quota] @@ -486,7 +492,8 @@ def set_share_metadata(self, metadata, timeout=None, **kwargs): # type: ignore :returns: Share-updated property dict (Etag and last modified). :rtype: dict(str, Any) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share.py :start-after: [START set_share_metadata] :end-before: [END set_share_metadata] @@ -612,7 +619,8 @@ def list_directories_and_files( # type: ignore The timeout parameter is expressed in seconds. :returns: An auto-paging iterable of dict-like DirectoryProperties and FileProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_file_samples_share.py :start-after: [START share_list_files_in_dir] :end-before: [END share_list_files_in_dir] diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py index 37f9a9f56dec..ab8cfbd450f2 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py @@ -84,7 +84,8 @@ class QueueClient(AsyncStorageAccountHostsMixin, QueueClientBase): account URL already has a SAS token. The value can be a SAS token string, and account shared access key, or an instance of a TokenCredentials class from azure.identity. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message_async.py :start-after: [START async_create_queue_client] :end-before: [END async_create_queue_client] @@ -133,7 +134,8 @@ async def create_queue(self, metadata=None, timeout=None, **kwargs): # type: ig :raises: ~azure.storage.queue._generated.models._models.StorageErrorException - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_hello_world_async.py :start-after: [START async_create_queue] :end-before: [END async_create_queue] @@ -167,7 +169,8 @@ async def delete_queue(self, timeout=None, **kwargs): # type: ignore The server timeout, expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_hello_world_async.py :start-after: [START async_delete_queue] :end-before: [END async_delete_queue] @@ -192,7 +195,8 @@ async def get_queue_properties(self, timeout=None, **kwargs): # type: ignore :return: Properties for the specified container within a container object. :rtype: ~azure.storage.queue.models.QueueProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message_async.py :start-after: [START async_get_queue_properties] :end-before: [END async_get_queue_properties] @@ -223,7 +227,8 @@ async def set_queue_metadata(self, metadata=None, timeout=None, **kwargs): # ty :param int timeout: The server timeout, expressed in seconds. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message_async.py :start-after: [START async_set_queue_metadata] :end-before: [END async_set_queue_metadata] @@ -284,7 +289,8 @@ async def set_queue_access_policy(self, signed_identifiers=None, timeout=None, * :param int timeout: The server timeout, expressed in seconds. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message_async.py :start-after: [START async_set_access_policy] :end-before: [END async_set_access_policy] @@ -356,7 +362,8 @@ async def enqueue_message( # type: ignore returned from the service. :rtype: ~azure.storage.queue.models.QueueMessage - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message_async.py :start-after: [START async_enqueue_messages] :end-before: [END async_enqueue_messages] @@ -422,7 +429,8 @@ def receive_messages(self, messages_per_page=None, visibility_timeout=None, time Returns a message iterator of dict-like Message objects. :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.queue.models.Message] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message_async.py :start-after: [START async_receive_messages] :end-before: [END async_receive_messages] @@ -494,7 +502,8 @@ async def update_message( this object is also populated with the content, although it is not returned by the service. :rtype: ~azure.storage.queue.models.QueueMessage - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message_async.py :start-after: [START async_update_message] :end-before: [END async_update_message] @@ -577,7 +586,8 @@ async def peek_messages(self, max_messages=None, timeout=None, **kwargs): # typ not pop the message and can only retrieve already visible messages. :rtype: list(:class:`~azure.storage.queue.models.QueueMessage`) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message_async.py :start-after: [START async_peek_message] :end-before: [END async_peek_message] @@ -611,7 +621,8 @@ async def clear_messages(self, timeout=None, **kwargs): # type: ignore :param int timeout: The server timeout, expressed in seconds. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message_async.py :start-after: [START async_clear_messages] :end-before: [END async_clear_messages] @@ -647,7 +658,8 @@ async def delete_message(self, message, pop_receipt=None, timeout=None, **kwargs :param int timeout: The server timeout, expressed in seconds. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message_async.py :start-after: [START async_delete_message] :end-before: [END async_delete_message] diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py index 1798b10ac0ed..39f6a8781ac7 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py @@ -74,7 +74,8 @@ class QueueServiceClient(AsyncStorageAccountHostsMixin, QueueServiceClientBase): account URL already has a SAS token. The value can be a SAS token string, and account shared access key, or an instance of a TokenCredentials class from azure.identity. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_authentication_async.py :start-after: [START async_create_queue_service_client] :end-before: [END async_create_queue_service_client] @@ -148,7 +149,8 @@ async def get_service_properties(self, timeout=None, **kwargs): # type: ignore The timeout parameter is expressed in seconds. :rtype: ~azure.storage.queue._generated.models._models.StorageServiceProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service_async.py :start-after: [START async_get_queue_service_properties] :end-before: [END async_get_queue_service_properties] @@ -197,7 +199,8 @@ async def set_service_properties( # type: ignore The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service_async.py :start-after: [START async_set_queue_service_properties] :end-before: [END async_set_queue_service_properties] @@ -244,7 +247,8 @@ def list_queues( :returns: An iterable (auto-paging) of QueueProperties. :rtype: ~azure.core.paging.AsyncItemPaged[~azure.core.queue.models.QueueProperties] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service_async.py :start-after: [START async_qsc_list_queues] :end-before: [END async_qsc_list_queues] @@ -286,7 +290,8 @@ async def create_queue( # type: ignore The timeout parameter is expressed in seconds. :rtype: ~azure.storage.queue.aio.queue_client_async.QueueClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service_async.py :start-after: [START async_qsc_create_queue] :end-before: [END async_qsc_create_queue] @@ -325,7 +330,8 @@ async def delete_queue( # type: ignore The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service_async.py :start-after: [START async_qsc_delete_queue] :end-before: [END async_qsc_delete_queue] @@ -350,7 +356,8 @@ def get_queue_client(self, queue, **kwargs): :returns: A :class:`~azure.core.queue.queue_client.QueueClient` object. :rtype: ~azure.storage.queue.aio.queue_client_async.QueueClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service_async.py :start-after: [START async_get_queue_client] :end-before: [END async_get_queue_client] diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py index d1fc7766aaf6..7a1a1d90547a 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py @@ -70,7 +70,8 @@ class QueueClient(StorageAccountHostsMixin): account URL already has a SAS token. The value can be a SAS token string, and account shared access key, or an instance of a TokenCredentials class from azure.identity. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START create_queue_client] :end-before: [END create_queue_client] @@ -147,7 +148,8 @@ def from_connection_string( access key values. The value can be a SAS token string, and account shared access key, or an instance of a TokenCredentials class from azure.identity. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START create_queue_client_from_connection_string] :end-before: [END create_queue_client_from_connection_string] @@ -209,7 +211,8 @@ def generate_shared_access_signature( :return: A Shared Access Signature (sas) token. :rtype: str - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START queue_client_sas_token] :end-before: [END queue_client_sas_token] @@ -250,7 +253,8 @@ def create_queue(self, metadata=None, timeout=None, **kwargs): :raises: ~azure.storage.queue._generated.models._models.StorageErrorException - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_hello_world.py :start-after: [START create_queue] :end-before: [END create_queue] @@ -287,7 +291,8 @@ def delete_queue(self, timeout=None, **kwargs): The server timeout, expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_hello_world.py :start-after: [START delete_queue] :end-before: [END delete_queue] @@ -312,7 +317,8 @@ def get_queue_properties(self, timeout=None, **kwargs): :return: Properties for the specified container within a container object. :rtype: ~azure.storage.queue.models.QueueProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START get_queue_properties] :end-before: [END get_queue_properties] @@ -344,7 +350,8 @@ def set_queue_metadata(self, metadata=None, timeout=None, **kwargs): :param int timeout: The server timeout, expressed in seconds. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START set_queue_metadata] :end-before: [END set_queue_metadata] @@ -408,7 +415,8 @@ def set_queue_access_policy(self, signed_identifiers=None, timeout=None, **kwarg :param int timeout: The server timeout, expressed in seconds. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START set_access_policy] :end-before: [END set_access_policy] @@ -481,7 +489,8 @@ def enqueue_message( # type: ignore returned from the service. :rtype: ~azure.storage.queue.models.QueueMessage - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START enqueue_messages] :end-before: [END enqueue_messages] @@ -545,7 +554,8 @@ def receive_messages(self, messages_per_page=None, visibility_timeout=None, time Returns a message iterator of dict-like Message objects. :rtype: ~azure.core.paging.ItemPaged[~azure.storage.queue.models.Message] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START receive_messages] :end-before: [END receive_messages] @@ -609,7 +619,8 @@ def update_message(self, message, visibility_timeout=None, pop_receipt=None, # t this object is also populated with the content, although it is not returned by the service. :rtype: ~azure.storage.queue.models.QueueMessage - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START update_message] :end-before: [END update_message] @@ -692,7 +703,8 @@ def peek_messages(self, max_messages=None, timeout=None, **kwargs): # type: igno not pop the message and can only retrieve already visible messages. :rtype: list(:class:`~azure.storage.queue.models.QueueMessage`) - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START peek_message] :end-before: [END peek_message] @@ -727,7 +739,8 @@ def clear_messages(self, timeout=None, **kwargs): :param int timeout: The server timeout, expressed in seconds. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START clear_messages] :end-before: [END clear_messages] @@ -763,7 +776,8 @@ def delete_message(self, message, pop_receipt=None, timeout=None, **kwargs): :param int timeout: The server timeout, expressed in seconds. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_message.py :start-after: [START delete_message] :end-before: [END delete_message] diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py index 3baf0f7393e5..7c3a7f48e110 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py @@ -73,7 +73,8 @@ class QueueServiceClient(StorageAccountHostsMixin): account URL already has a SAS token. The value can be a SAS token string, and account shared access key, or an instance of a TokenCredentials class from azure.identity. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_authentication.py :start-after: [START create_queue_service_client] :end-before: [END create_queue_service_client] @@ -133,7 +134,8 @@ def from_connection_string( access key values. The value can be a SAS token string, and account shared access key, or an instance of a TokenCredentials class from azure.identity. - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_authentication.py :start-after: [START auth_from_connection_string] :end-before: [END auth_from_connection_string] @@ -247,7 +249,8 @@ def get_service_properties(self, timeout=None, **kwargs): # type: ignore The timeout parameter is expressed in seconds. :rtype: ~azure.storage.queue._generated.models._models.StorageServiceProperties - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service.py :start-after: [START get_queue_service_properties] :end-before: [END get_queue_service_properties] @@ -296,7 +299,8 @@ def set_service_properties( # type: ignore The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service.py :start-after: [START set_queue_service_properties] :end-before: [END set_queue_service_properties] @@ -344,7 +348,8 @@ def list_queues( :returns: An iterable (auto-paging) of QueueProperties. :rtype: ~azure.core.paging.ItemPaged[~azure.core.queue.models.QueueProperties] - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service.py :start-after: [START qsc_list_queues] :end-before: [END qsc_list_queues] @@ -386,7 +391,8 @@ def create_queue( The timeout parameter is expressed in seconds. :rtype: ~azure.storage.queue.queue_client.QueueClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service.py :start-after: [START qsc_create_queue] :end-before: [END qsc_create_queue] @@ -425,7 +431,8 @@ def delete_queue( The timeout parameter is expressed in seconds. :rtype: None - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service.py :start-after: [START qsc_delete_queue] :end-before: [END qsc_delete_queue] @@ -450,7 +457,8 @@ def get_queue_client(self, queue, **kwargs): :returns: A :class:`~azure.core.queue.queue_client.QueueClient` object. :rtype: ~azure.core.queue.queue_client.QueueClient - Example: + .. admonition:: Example: + .. literalinclude:: ../tests/test_queue_samples_service.py :start-after: [START get_queue_client] :end-before: [END get_queue_client]