Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class BlobClient(AsyncStorageAccountHostsMixin, BlobClientBase): # pylint: disa

:ivar str url:
The full endpoint URL to the Blob, including snapshot and SAS token if used. This could be
either the primary endpoint, or the secondard endpoint depending on the current `location_mode`.
either the primary endpoint, or the secondary endpoint depending on the current `location_mode`.
:ivar str primary_endpoint:
The full primary endpoint URL.
:ivar str primary_hostname:
The hostname of the primary endpoint.
:ivar str secondary_endpoint:
The full secondard endpoint URL if configured. If not available
The full secondary endpoint URL if configured. If not available
a ValueError will be raised. To explicitly specify a secondary hostname, use the optional
`secondary_hostname` keyword argument on instantiation.
:ivar str secondary_hostname:
Expand All @@ -78,14 +78,14 @@ class BlobClient(AsyncStorageAccountHostsMixin, BlobClientBase): # pylint: disa
If the URL already has a SAS token, specifying an explicit credential will take priority.

Example:
.. literalinclude:: ../tests/test_blob_samples_authentication.py
.. literalinclude:: ../tests/test_blob_samples_authentication_async.py
:start-after: [START create_blob_client]
:end-before: [END create_blob_client]
:language: python
:dedent: 8
:caption: Creating the BlobClient from a URL to a public blob (no auth needed).

.. literalinclude:: ../tests/test_blob_samples_authentication.py
.. literalinclude:: ../tests/test_blob_samples_authentication_async.py
:start-after: [START create_blob_client_sas_url]
:end-before: [END create_blob_client_sas_url]
:language: python
Expand Down Expand Up @@ -217,7 +217,7 @@ async def upload_blob(
:rtype: dict[str, Any]

Example:
.. literalinclude:: ../tests/test_blob_samples_hello_world.py
.. literalinclude:: ../tests/test_blob_samples_hello_world_async.py
:start-after: [START upload_a_blob]
:end-before: [END upload_a_blob]
:language: python
Expand Down Expand Up @@ -292,7 +292,7 @@ async def download_blob(self, offset=None, length=None, validate_content=False,
:rtype: ~azure.storage.blob._blob_utils.StorageStreamDownloader

Example:
.. literalinclude:: ../tests/test_blob_samples_hello_world.py
.. literalinclude:: ../tests/test_blob_samples_hello_world_async.py
:start-after: [START download_a_blob]
:end-before: [END download_a_blob]
:language: python
Expand Down Expand Up @@ -361,7 +361,7 @@ async def delete_blob(self, delete_snapshots=False, **kwargs):
:rtype: None

Example:
.. literalinclude:: ../tests/test_blob_samples_hello_world.py
.. literalinclude:: ../tests/test_blob_samples_hello_world_async.py
:start-after: [START delete_blob]
:end-before: [END delete_blob]
:language: python
Expand All @@ -386,7 +386,7 @@ async def undelete_blob(self, **kwargs):
:rtype: None

Example:
.. literalinclude:: ../tests/test_blob_samples_common.py
.. literalinclude:: ../tests/test_blob_samples_common_async.py
:start-after: [START undelete_blob]
:end-before: [END undelete_blob]
:language: python
Expand Down Expand Up @@ -434,7 +434,7 @@ async def get_blob_properties(self, **kwargs):
:rtype: ~azure.storage.blob.models.BlobProperties

Example:
.. literalinclude:: ../tests/test_blob_samples_common.py
.. literalinclude:: ../tests/test_blob_samples_common_async.py
:start-after: [START get_blob_properties]
:end-before: [END get_blob_properties]
:language: python
Expand Down Expand Up @@ -465,7 +465,7 @@ async def set_http_headers(self, content_settings=None, **kwargs):
# type: (Optional[ContentSettings], Any) -> None
"""Sets system properties on the blob.

If one property is set for the content_settings, all properties will be overriden.
If one property is set for the content_settings, all properties will be overridden.

:param ~azure.storage.blob.models.ContentSettings content_settings:
ContentSettings object used to set blob properties.
Expand Down Expand Up @@ -713,7 +713,7 @@ async def create_snapshot(self, metadata=None, **kwargs):
:rtype: dict[str, Any]

Example:
.. literalinclude:: ../tests/test_blob_samples_common.py
.. literalinclude:: ../tests/test_blob_samples_common_async.py
:start-after: [START create_blob_snapshot]
:end-before: [END create_blob_snapshot]
:language: python
Expand Down Expand Up @@ -767,7 +767,9 @@ async def start_copy_from_url(self, source_url, metadata=None, incremental_copy=
is public, no authentication is required.
Examples:
https://myaccount.blob.core.windows.net/mycontainer/myblob

https://myaccount.blob.core.windows.net/mycontainer/myblob?snapshot=<DateTime>

https://otheraccount.blob.core.windows.net/mycontainer/myblob?sastoken
:param metadata:
Name-value pairs associated with the blob as metadata. If no name-value
Expand Down Expand Up @@ -852,9 +854,16 @@ async def start_copy_from_url(self, source_url, metadata=None, incremental_copy=
premium storage accounts.
:param bool requires_sync:
Enforces that the service will not return a response until the copy is complete.
:param bool polling: A poller will be used for this operation. Defaults to True.
:returns: A pollable object to check copy operation status (and abort).
:rtype: :class:`~azure.storage.blob.polling.CopyStatusPoller`
:returns: A dictionary of copy properties (etag, last_modified, copy_id, copy_status).
:rtype: Dict[str, Union[str, datetime]]

Example:
.. literalinclude:: ../tests/test_blob_samples_common_async.py
:start-after: [START copy_blob_from_url]
:end-before: [END copy_blob_from_url]
:language: python
:dedent: 12
:caption: Copy a blob from a URL.
"""
options = self._start_copy_from_url_options(
source_url,
Expand All @@ -869,17 +878,25 @@ async def start_copy_from_url(self, source_url, metadata=None, incremental_copy=
process_storage_error(error)

async def abort_copy(self, copy_id, **kwargs):
# type: (Union[str, FileProperties], Any) -> Dict[str, Any]
# type: (Union[str, BlobProperties], Any) -> None
"""Abort an ongoing copy operation.

This will leave a destination blob with zero length and full metadata.
This will raise an error if the copy operation has already ended.

:param copy_id:
The copy operation to abort. This can be either an ID, or an
instance of FileProperties.
:type copy_id: str or ~azure.storage.file.models.FileProperties
instance of BlobProperties.
:type copy_id: str or ~azure.storage.blob.models.BlobProperties
:rtype: None

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]
:language: python
:dedent: 12
:caption: Abort copying a blob from URL.
"""
options = self._abort_copy_options(copy_id, **kwargs)
try:
Expand Down Expand Up @@ -930,7 +947,7 @@ async def acquire_lease(self, lease_duration=-1, lease_id=None, **kwargs):
:rtype: ~azure.storage.blob.lease.LeaseClient

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use this PR to update rtypes here to something like this
~azure.storage.blob.aio.lease_async.LeaseClient

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll do this.


Example:
.. literalinclude:: ../tests/test_blob_samples_common.py
.. literalinclude:: ../tests/test_blob_samples_common_async.py
:start-after: [START acquire_lease_on_blob]
:end-before: [END acquire_lease_on_blob]
:language: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ class BlobServiceClient(AsyncStorageAccountHostsMixin, BlobServiceClientBase):

:ivar str url:
The full endpoint URL to the Blob service endpoint. This could be either the
primary endpoint, or the secondard endpoint depending on the current `location_mode`.
primary endpoint, or the secondary endpoint depending on the current `location_mode`.
:ivar str primary_endpoint:
The full primary endpoint URL.
:ivar str primary_hostname:
The hostname of the primary endpoint.
:ivar str secondary_endpoint:
The full secondard endpoint URL if configured. If not available
The full secondary endpoint URL if configured. If not available
a ValueError will be raised. To explicitly specify a secondary hostname, use the optional
`secondary_hostname` keyword argument on instantiation.
:ivar str secondary_hostname:
Expand All @@ -76,14 +76,14 @@ class BlobServiceClient(AsyncStorageAccountHostsMixin, BlobServiceClientBase):
If the URL already has a SAS token, specifying an explicit credential will take priority.

Example:
.. literalinclude:: ../tests/test_blob_samples_authentication.py
.. literalinclude:: ../tests/test_blob_samples_authentication_async.py
:start-after: [START create_blob_service_client]
:end-before: [END create_blob_service_client]
:language: python
:dedent: 8
:caption: Creating the BlobServiceClient with account url and credential.

.. literalinclude:: ../tests/test_blob_samples_authentication.py
.. literalinclude:: ../tests/test_blob_samples_authentication_async.py
:start-after: [START create_blob_service_client_oauth]
:end-before: [END create_blob_service_client_oauth]
:language: python
Expand Down Expand Up @@ -118,7 +118,7 @@ async def get_account_information(self, **kwargs): # type: ignore
:rtype: dict(str, str)

Example:
.. literalinclude:: ../tests/test_blob_samples_service.py
.. literalinclude:: ../tests/test_blob_samples_service_async.py
:start-after: [START get_blob_service_account_info]
:end-before: [END get_blob_service_account_info]
:language: python
Expand Down Expand Up @@ -156,7 +156,7 @@ async def get_service_stats(self, timeout=None, **kwargs): # type: ignore
:rtype: ~azure.storage.blob._generated.models.StorageServiceStats

Example:
.. literalinclude:: ../tests/test_blob_samples_service.py
.. literalinclude:: ../tests/test_blob_samples_service_async.py
:start-after: [START get_blob_service_stats]
:end-before: [END get_blob_service_stats]
:language: python
Expand All @@ -179,7 +179,7 @@ async def get_service_properties(self, timeout=None, **kwargs):
:rtype: ~azure.storage.blob._generated.models.StorageServiceProperties

Example:
.. literalinclude:: ../tests/test_blob_samples_service.py
.. literalinclude:: ../tests/test_blob_samples_service_async.py
:start-after: [START get_blob_service_properties]
:end-before: [END get_blob_service_properties]
:language: python
Expand Down Expand Up @@ -246,7 +246,7 @@ async def set_service_properties(
:rtype: None

Example:
.. literalinclude:: ../tests/test_blob_samples_service.py
.. literalinclude:: ../tests/test_blob_samples_service_async.py
:start-after: [START set_blob_service_properties]
:end-before: [END set_blob_service_properties]
:language: python
Expand Down Expand Up @@ -295,7 +295,7 @@ def list_containers(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.models.ContainerProperties]

Example:
.. literalinclude:: ../tests/test_blob_samples_service.py
.. literalinclude:: ../tests/test_blob_samples_service_async.py
:start-after: [START bsc_list_containers]
:end-before: [END bsc_list_containers]
:language: python
Expand Down Expand Up @@ -343,7 +343,7 @@ async def create_container(
:rtype: ~azure.storage.blob.container_client.ContainerClient

Example:
.. literalinclude:: ../tests/test_blob_samples_service.py
.. literalinclude:: ../tests/test_blob_samples_service_async.py
:start-after: [START bsc_create_container]
:end-before: [END bsc_create_container]
:language: python
Expand Down Expand Up @@ -401,7 +401,7 @@ async def delete_container(
:rtype: None

Example:
.. literalinclude:: ../tests/test_blob_samples_service.py
.. literalinclude:: ../tests/test_blob_samples_service_async.py
:start-after: [START bsc_delete_container]
:end-before: [END bsc_delete_container]
:language: python
Expand All @@ -428,7 +428,7 @@ def get_container_client(self, container):
:rtype: ~azure.core.blob.container_client.ContainerClient

Example:
.. literalinclude:: ../tests/test_blob_samples_service.py
.. literalinclude:: ../tests/test_blob_samples_service_async.py
:start-after: [START bsc_get_container_client]
:end-before: [END bsc_get_container_client]
:language: python
Expand Down Expand Up @@ -468,7 +468,7 @@ def get_blob_client(
:rtype: ~azure.storage.blob.blob_client.BlobClient

Example:
.. literalinclude:: ../tests/test_blob_samples_service.py
.. literalinclude:: ../tests/test_blob_samples_service_async.py
:start-after: [START bsc_get_blob_client]
:end-before: [END bsc_get_blob_client]
:language: python
Expand Down
Loading