Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ class BlobClient(AsyncStorageAccountHostsMixin, BlobClientBase): # pylint: disa
:ivar str location_mode:
The location mode that the client is currently using. By default
this will be "primary". Options include "primary" and "secondary".
:param str account_url: The full URI to the account.
:param str account_url:
The URI to the storage account. In order to create a client given the full URI to the blob,
use the `from_blob_url` classmethod.
:param container_name: The container for the blob.
:type container_name: str
:param blob_name: The mame of the blob with which to interact.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase):
:ivar str location_mode:
The location mode that the client is currently using. By default
this will be "primary". Options include "primary" and "secondary".
:param str container_url:
The full URI to the container. This can also be a URL to the storage
account, in which case the blob container must also be specified.
:param str account_url:
The URI to the storage account. In order to create a client given the full URI to the container,
use the from_container_url classmethod.
:param container_name:
The name of the container for the blob.
:type container_name: str or ~azure.storage.blob.ContainerProperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ class BlobClient(StorageAccountHostsMixin): # pylint: disable=too-many-public-m
:ivar str location_mode:
The location mode that the client is currently using. By default
this will be "primary". Options include "primary" and "secondary".
:param str account_url: The full URI to the account. This can also be a URL to the storage account
or container, in which case the blob and/or container must also be specified.
:param str account_url:
The URI to the storage account. In order to create a client given the full URI to the blob,
use the `from_blob_url` classmethod.
:param container_name: The container for the blob.
:type container_name: str
:param blob_name: The blob with which to interact. If specified, this value will override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class ContainerClient(StorageAccountHostsMixin):
The location mode that the client is currently using. By default
this will be "primary". Options include "primary" and "secondary".
:param str account_url:
The full URI to the storage account.
The URI to the storage account. In order to create a client given the full URI to the container,
use the from_container_url classmethod.
:param container_name:
The container for the blob.
:type container_name: str
Expand Down
6 changes: 6 additions & 0 deletions sdk/storage/azure-storage-file/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

**Breaking changes**

- `ShareClient` now accepts only `account_url` with mandatory a string param `share_name`.
To use a share_url, the method `from_share_url` must be used.
- `DirectoryClient` now accepts only `account_url` with mandatory string params `share_name` and `directory_path`.
To use a directory_url, the method `from_directory_url` must be used.
- `FileClient` now accepts only `account_url` with mandatory string params `share_name` and
`file_path`. To use a file_url, the method `from_file_url` must be used.
- `file_permission_key` parameter has been renamed to `permission_key`
- `set_share_access_policy` has required parameter `signed_identifiers`.
- NoRetry policy has been removed. Use keyword argument `retry_total=0` for no retries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ class DirectoryClient(AsyncStorageAccountHostsMixin, DirectoryClientBase):
:ivar str location_mode:
The location mode that the client is currently using. By default
this will be "primary". Options include "primary" and "secondary".
:param str directory_url:
The full URI to the directory. This can also be a URL to the storage account
or share, in which case the directory and/or share must also be specified.
:param share: The share for the directory. If specified, this value will override
a share value specified in the directory URL.
:type share: str or ~azure.storage.file.ShareProperties
:param str account_url:
The URI to the storage account. In order to create a client given the full URI to the
directory, use the from_directory_url classmethod.
:param share_name:
The name of the share for the directory.
:type share_name: str
:param str directory_path:

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.

Why does this still have a "if specified" clause in the documentation?

The directory path for the directory with which to interact.
If specified, this value will override a directory value specified in the directory URL.
Expand All @@ -76,9 +76,9 @@ class DirectoryClient(AsyncStorageAccountHostsMixin, DirectoryClientBase):
shared access key.
"""
def __init__( # type: ignore
self, directory_url, # type: str
share=None, # type: Optional[Union[str, ShareProperties]]
directory_path=None, # type: Optional[str]
self, account_url, # type: str
share_name, # type: str
directory_path, # type: str
snapshot=None, # type: Optional[Union[str, Dict[str, Any]]]
credential=None, # type: Optional[Any]
loop=None, # type: Any
Expand All @@ -87,8 +87,8 @@ def __init__( # type: ignore
# type: (...) -> None
kwargs['retry_policy'] = kwargs.get('retry_policy') or ExponentialRetry(**kwargs)
super(DirectoryClient, self).__init__(
directory_url,
share=share,
account_url,
share_name=share_name,
directory_path=directory_path,
snapshot=snapshot,
credential=credential,
Expand All @@ -111,9 +111,9 @@ def get_file_client(self, file_name, **kwargs):
if self.directory_path:
file_name = self.directory_path.rstrip('/') + "/" + file_name
return FileClient(
self.url, file_path=file_name, snapshot=self.snapshot, credential=self.credential,
_hosts=self._hosts, _configuration=self._config, _pipeline=self._pipeline,
_location_mode=self._location_mode, loop=self._loop, **kwargs)
self.url, file_path=file_name, share_name=self.share_name, snapshot=self.snapshot,
credential=self.credential, _hosts=self._hosts, _configuration=self._config,
_pipeline=self._pipeline, _location_mode=self._location_mode, loop=self._loop, **kwargs)

def get_subdirectory_client(self, directory_name, **kwargs):
# type: (str, Any) -> DirectoryClient
Expand All @@ -137,9 +137,9 @@ def get_subdirectory_client(self, directory_name, **kwargs):
"""
directory_path = self.directory_path.rstrip('/') + "/" + directory_name
return DirectoryClient(
self.url, directory_path=directory_path, snapshot=self.snapshot, credential=self.credential,
_hosts=self._hosts, _configuration=self._config, _pipeline=self._pipeline,
_location_mode=self._location_mode, loop=self._loop, **kwargs)
self.url, share_name=self.share_name, directory_path=directory_path, snapshot=self.snapshot,
credential=self.credential, _hosts=self._hosts, _configuration=self._config,
_pipeline=self._pipeline, _location_mode=self._location_mode, loop=self._loop, **kwargs)

@distributed_trace_async
async def create_directory( # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ class FileClient(AsyncStorageAccountHostsMixin, FileClientBase):
:ivar str location_mode:
The location mode that the client is currently using. By default
this will be "primary". Options include "primary" and "secondary".
:param str file_url: The full URI to the file. This can also be a URL to the storage account
or share, in which case the file and/or share must also be specified.
:param share: The share for the file. If specified, this value will override
a share value specified in the file URL.
:type share: str or ~azure.storage.file.ShareProperties
:param str account_url:
The URI to the storage account. In order to create a client given the full URI to the
file, use the from_file_url classmethod.
:param share_name:
The name of the share for the file.
:type share_name: str
:param str file_path:
The file path to the file with which to interact. If specified, this value will override
a file value specified in the file URL.
Expand All @@ -125,9 +126,9 @@ class FileClient(AsyncStorageAccountHostsMixin, FileClientBase):

def __init__( # type: ignore
self,
file_url, # type: str
share=None, # type: Optional[Union[str, ShareProperties]]
file_path=None, # type: Optional[str]
account_url, # type: str
share_name, # type: str
file_path, # type: str
snapshot=None, # type: Optional[Union[str, Dict[str, Any]]]
credential=None, # type: Optional[Any]
loop=None, # type: Any
Expand All @@ -136,7 +137,8 @@ def __init__( # type: ignore
# type: (...) -> None
kwargs["retry_policy"] = kwargs.get("retry_policy") or ExponentialRetry(**kwargs)
super(FileClient, self).__init__(
file_url, share=share, file_path=file_path, snapshot=snapshot, credential=credential, loop=loop, **kwargs
account_url, share_name=share_name, file_path=file_path, snapshot=snapshot,
credential=credential, loop=loop, **kwargs
)
self._client = AzureFileStorage(version=VERSION, url=self.url, pipeline=self._pipeline, loop=loop)
self._loop = loop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ def get_share_client(self, share, snapshot=None):
:dedent: 8
:caption: Gets the share client.
"""
try:
share_name = share.name
except AttributeError:
share_name = share
return ShareClient(
self.url, share=share, snapshot=snapshot, credential=self.credential, _hosts=self._hosts,
self.url, share_name=share_name, snapshot=snapshot, credential=self.credential, _hosts=self._hosts,
_configuration=self._config, _pipeline=self._pipeline, _location_mode=self._location_mode, loop=self._loop)
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ class ShareClient(AsyncStorageAccountHostsMixin, ShareClientBase):
:ivar str location_mode:
The location mode that the client is currently using. By default
this will be "primary". Options include "primary" and "secondary".
:param str share_url: The full URI to the share.
:param share: The share with which to interact. If specified, this value will override
a share value specified in the share URL.
:type share: str or ~azure.storage.file.ShareProperties
:param str account_url:
The URI to the storage account. In order to create a client given the full URI to the
share, use the from_share_url classmethod.
:param share_name:
The name of the share with which to interact.
:type share_name: str
:param str snapshot:
An optional share snapshot on which to operate.
:param credential:
Expand All @@ -69,8 +71,8 @@ class ShareClient(AsyncStorageAccountHostsMixin, ShareClientBase):
shared access key.
"""
def __init__( # type: ignore
self, share_url, # type: str
share=None, # type: Optional[Union[str, ShareProperties]]
self, account_url, # type: str
share_name, # type: str
snapshot=None, # type: Optional[Union[str, Dict[str, Any]]]
credential=None, # type: Optional[Any]
loop=None, # type: Any
Expand All @@ -79,8 +81,8 @@ def __init__( # type: ignore
# type: (...) -> None
kwargs['retry_policy'] = kwargs.get('retry_policy') or ExponentialRetry(**kwargs)
super(ShareClient, self).__init__(
share_url,
share=share,
account_url,
share_name=share_name,
snapshot=snapshot,
credential=credential,
loop=loop,
Expand All @@ -99,8 +101,8 @@ def get_directory_client(self, directory_path=None):
:rtype: ~azure.storage.file.aio.directory_client_async.DirectoryClient
"""
return DirectoryClient(
self.url, directory_path=directory_path or "", snapshot=self.snapshot, credential=self.credential,
_hosts=self._hosts, _configuration=self._config, _pipeline=self._pipeline,
self.url, share_name=self.share_name, directory_path=directory_path or "", snapshot=self.snapshot,
credential=self.credential, _hosts=self._hosts, _configuration=self._config, _pipeline=self._pipeline,
_location_mode=self._location_mode, loop=self._loop)

def get_file_client(self, file_path):
Expand All @@ -114,8 +116,9 @@ def get_file_client(self, file_path):
:rtype: ~azure.storage.file.aio.file_client_async.FileClient
"""
return FileClient(
self.url, file_path=file_path, snapshot=self.snapshot, credential=self.credential, _hosts=self._hosts,
_configuration=self._config, _pipeline=self._pipeline, _location_mode=self._location_mode, loop=self._loop)
self.url, share_name=self.share_name, file_path=file_path, snapshot=self.snapshot,
credential=self.credential, _hosts=self._hosts, _configuration=self._config,
_pipeline=self._pipeline, _location_mode=self._location_mode, loop=self._loop)

@distributed_trace_async
async def create_share( # type: ignore
Expand Down
Loading