@@ -104,10 +104,12 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
104104 :param credential:
105105 The credentials with which to authenticate. This is optional if the
106106 account URL already has a SAS token. The value can be a SAS token string,
107- an instance of a AzureSasCredential from azure.core.credentials, an account
108- shared access key, or an instance of a TokenCredentials class from azure.identity.
107+ an instance of a AzureSasCredential or AzureNamedKeyCredential from azure.core.credentials,
108+ an account shared access key, or an instance of a TokenCredentials class from azure.identity.
109109 If the resource URI already contains a SAS token, this will be ignored in favor of an explicit credential
110110 - except in the case of AzureSasCredential, where the conflicting SAS tokens will raise a ValueError.
111+ If using an instance of AzureNamedKeyCredential, "name" should be the storage account name, and "key"
112+ should be the storage account key.
111113 :keyword str api_version:
112114 The Storage API version to use for requests. Default value is the most recent service version that is
113115 compatible with the current SDK. Setting to an older version may result in reduced feature compatibility.
@@ -151,7 +153,7 @@ def __init__(
151153 container_name , # type: str
152154 blob_name , # type: str
153155 snapshot = None , # type: Optional[Union[str, Dict[str, Any]]]
154- credential = None , # type: Optional[Any]
156+ credential = None , # type: Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, "TokenCredential"]] # pylint: disable=line-too-long
155157 ** kwargs # type: Any
156158 ):
157159 # type: (...) -> None
@@ -210,8 +212,13 @@ def _encode_source_url(self, source_url):
210212 return '?' .join (result )
211213
212214 @classmethod
213- def from_blob_url (cls , blob_url , credential = None , snapshot = None , ** kwargs ):
214- # type: (Type[ClassType], str, Optional[Any], Optional[Union[str, Dict[str, Any]]], Any) -> ClassType
215+ def from_blob_url (
216+ cls , # type: Type[ClassType]
217+ blob_url , # type: str
218+ credential = None , # type: Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, "TokenCredential"]] # pylint: disable=line-too-long
219+ snapshot = None , # type: Optional[Union[str, Dict[str, Any]]]
220+ ** kwargs # type: Any
221+ ): # type: (...) -> ClassType
215222 """Create BlobClient from a blob url. This doesn't support customized blob url with '/' in blob name.
216223
217224 :param str blob_url:
@@ -222,10 +229,12 @@ def from_blob_url(cls, blob_url, credential=None, snapshot=None, **kwargs):
222229 The credentials with which to authenticate. This is optional if the
223230 account URL already has a SAS token, or the connection string already has shared
224231 access key values. The value can be a SAS token string,
225- an instance of a AzureSasCredential from azure.core.credentials, an account shared access
226- key, or an instance of a TokenCredentials class from azure.identity.
232+ an instance of a AzureSasCredential or AzureNamedKeyCredential from azure.core.credentials,
233+ an account shared access key, or an instance of a TokenCredentials class from azure.identity.
227234 If the resource URI already contains a SAS token, this will be ignored in favor of an explicit credential
228235 - except in the case of AzureSasCredential, where the conflicting SAS tokens will raise a ValueError.
236+ If using an instance of AzureNamedKeyCredential, "name" should be the storage account name, and "key"
237+ should be the storage account key.
229238 :param str snapshot:
230239 The optional blob snapshot on which to operate. This can be the snapshot ID string
231240 or the response returned from :func:`create_snapshot`. If specified, this will override
@@ -291,7 +300,7 @@ def from_connection_string(
291300 container_name , # type: str
292301 blob_name , # type: str
293302 snapshot = None , # type: Optional[str]
294- credential = None , # type: Optional[Any]
303+ credential = None , # type: Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, "TokenCredential"]] # pylint: disable=line-too-long
295304 ** kwargs # type: Any
296305 ): # type: (...) -> ClassType
297306 """Create BlobClient from a Connection String.
@@ -309,9 +318,11 @@ def from_connection_string(
309318 The credentials with which to authenticate. This is optional if the
310319 account URL already has a SAS token, or the connection string already has shared
311320 access key values. The value can be a SAS token string,
312- an instance of a AzureSasCredential from azure.core.credentials, an account shared access
313- key, or an instance of a TokenCredentials class from azure.identity.
321+ an instance of a AzureSasCredential or AzureNamedKeyCredential from azure.core.credentials,
322+ an account shared access key, or an instance of a TokenCredentials class from azure.identity.
314323 Credentials provided here will take precedence over those in the connection string.
324+ If using an instance of AzureNamedKeyCredential, "name" should be the storage account name, and "key"
325+ should be the storage account key.
315326 :returns: A Blob client.
316327 :rtype: ~azure.storage.blob.BlobClient
317328
0 commit comments