@@ -104,10 +104,12 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
104
104
:param credential:
105
105
The credentials with which to authenticate. This is optional if the
106
106
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.
109
109
If the resource URI already contains a SAS token, this will be ignored in favor of an explicit credential
110
110
- 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.
111
113
:keyword str api_version:
112
114
The Storage API version to use for requests. Default value is the most recent service version that is
113
115
compatible with the current SDK. Setting to an older version may result in reduced feature compatibility.
@@ -151,7 +153,7 @@ def __init__(
151
153
container_name , # type: str
152
154
blob_name , # type: str
153
155
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
155
157
** kwargs # type: Any
156
158
):
157
159
# type: (...) -> None
@@ -210,8 +212,13 @@ def _encode_source_url(self, source_url):
210
212
return '?' .join (result )
211
213
212
214
@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
215
222
"""Create BlobClient from a blob url. This doesn't support customized blob url with '/' in blob name.
216
223
217
224
:param str blob_url:
@@ -222,10 +229,12 @@ def from_blob_url(cls, blob_url, credential=None, snapshot=None, **kwargs):
222
229
The credentials with which to authenticate. This is optional if the
223
230
account URL already has a SAS token, or the connection string already has shared
224
231
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.
227
234
If the resource URI already contains a SAS token, this will be ignored in favor of an explicit credential
228
235
- 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.
229
238
:param str snapshot:
230
239
The optional blob snapshot on which to operate. This can be the snapshot ID string
231
240
or the response returned from :func:`create_snapshot`. If specified, this will override
@@ -291,7 +300,7 @@ def from_connection_string(
291
300
container_name , # type: str
292
301
blob_name , # type: str
293
302
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
295
304
** kwargs # type: Any
296
305
): # type: (...) -> ClassType
297
306
"""Create BlobClient from a Connection String.
@@ -309,9 +318,11 @@ def from_connection_string(
309
318
The credentials with which to authenticate. This is optional if the
310
319
account URL already has a SAS token, or the connection string already has shared
311
320
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.
314
323
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.
315
326
:returns: A Blob client.
316
327
:rtype: ~azure.storage.blob.BlobClient
317
328
0 commit comments