1# coding=utf-8 2# -------------------------------------------------------------------------- 3# Copyright (c) Microsoft Corporation. All rights reserved. 4# Licensed under the MIT License. See License.txt in the project root for 5# license information. 6# 7# Code generated by Microsoft (R) AutoRest Code Generator. 8# Changes may cause incorrect behavior and will be lost if the code is 9# regenerated. 10# -------------------------------------------------------------------------- 11 12from azure.core.exceptions import map_error 13 14from ... import models 15 16 17class BlobOperations: 18 """BlobOperations async operations. 19 20 You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. 21 22 :param client: Client for service requests. 23 :param config: Configuration of service client. 24 :param serializer: An object model serializer. 25 :param deserializer: An object model deserializer. 26 :ivar x_ms_requires_sync: . Constant value: "true". 27 :ivar x_ms_copy_action: . Constant value: "abort". 28 :ivar restype: . Constant value: "account". 29 """ 30 31 models = models 32 33 def __init__(self, client, config, serializer, deserializer) -> None: 34 35 self._client = client 36 self._serialize = serializer 37 self._deserialize = deserializer 38 39 self._config = config 40 self.x_ms_requires_sync = "true" 41 self.x_ms_copy_action = "abort" 42 self.restype = "account" 43 44 async def download(self, snapshot=None, version_id=None, timeout=None, range=None, range_get_content_md5=None, range_get_content_crc64=None, request_id=None, lease_access_conditions=None, cpk_info=None, modified_access_conditions=None, *, cls=None, **kwargs): 45 """The Download operation reads or downloads a blob from the system, 46 including its metadata and properties. You can also call Download to 47 read a snapshot. 48 49 :param snapshot: The snapshot parameter is an opaque DateTime value 50 that, when present, specifies the blob snapshot to retrieve. For more 51 information on working with blob snapshots, see <a 52 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating 53 a Snapshot of a Blob.</a> 54 :type snapshot: str 55 :param version_id: The version id parameter is an opaque DateTime 56 value that, when present, specifies the version of the blob to operate 57 on. It's for service version 2019-10-10 and newer. 58 :type version_id: str 59 :param timeout: The timeout parameter is expressed in seconds. For 60 more information, see <a 61 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 62 Timeouts for Blob Service Operations.</a> 63 :type timeout: int 64 :param range: Return only the bytes of the blob in the specified 65 range. 66 :type range: str 67 :param range_get_content_md5: When set to true and specified together 68 with the Range, the service returns the MD5 hash for the range, as 69 long as the range is less than or equal to 4 MB in size. 70 :type range_get_content_md5: bool 71 :param range_get_content_crc64: When set to true and specified 72 together with the Range, the service returns the CRC64 hash for the 73 range, as long as the range is less than or equal to 4 MB in size. 74 :type range_get_content_crc64: bool 75 :param request_id: Provides a client-generated, opaque value with a 1 76 KB character limit that is recorded in the analytics logs when storage 77 analytics logging is enabled. 78 :type request_id: str 79 :param lease_access_conditions: Additional parameters for the 80 operation 81 :type lease_access_conditions: 82 ~azure.storage.blob.models.LeaseAccessConditions 83 :param cpk_info: Additional parameters for the operation 84 :type cpk_info: ~azure.storage.blob.models.CpkInfo 85 :param modified_access_conditions: Additional parameters for the 86 operation 87 :type modified_access_conditions: 88 ~azure.storage.blob.models.ModifiedAccessConditions 89 :param callable cls: A custom type or function that will be passed the 90 direct response 91 :return: object or the result of cls(response) 92 :rtype: Generator 93 :raises: 94 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 95 """ 96 error_map = kwargs.pop('error_map', None) 97 lease_id = None 98 if lease_access_conditions is not None: 99 lease_id = lease_access_conditions.lease_id 100 encryption_key = None 101 if cpk_info is not None: 102 encryption_key = cpk_info.encryption_key 103 encryption_key_sha256 = None 104 if cpk_info is not None: 105 encryption_key_sha256 = cpk_info.encryption_key_sha256 106 encryption_algorithm = None 107 if cpk_info is not None: 108 encryption_algorithm = cpk_info.encryption_algorithm 109 if_modified_since = None 110 if modified_access_conditions is not None: 111 if_modified_since = modified_access_conditions.if_modified_since 112 if_unmodified_since = None 113 if modified_access_conditions is not None: 114 if_unmodified_since = modified_access_conditions.if_unmodified_since 115 if_match = None 116 if modified_access_conditions is not None: 117 if_match = modified_access_conditions.if_match 118 if_none_match = None 119 if modified_access_conditions is not None: 120 if_none_match = modified_access_conditions.if_none_match 121 if_tags = None 122 if modified_access_conditions is not None: 123 if_tags = modified_access_conditions.if_tags 124 125 # Construct URL 126 url = self.download.metadata['url'] 127 path_format_arguments = { 128 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 129 } 130 url = self._client.format_url(url, **path_format_arguments) 131 132 # Construct parameters 133 query_parameters = {} 134 if snapshot is not None: 135 query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') 136 if version_id is not None: 137 query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') 138 if timeout is not None: 139 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 140 141 # Construct headers 142 header_parameters = {} 143 header_parameters['Accept'] = 'application/xml' 144 if range is not None: 145 header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') 146 if range_get_content_md5 is not None: 147 header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("range_get_content_md5", range_get_content_md5, 'bool') 148 if range_get_content_crc64 is not None: 149 header_parameters['x-ms-range-get-content-crc64'] = self._serialize.header("range_get_content_crc64", range_get_content_crc64, 'bool') 150 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 151 if request_id is not None: 152 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 153 if lease_id is not None: 154 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 155 if encryption_key is not None: 156 header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", encryption_key, 'str') 157 if encryption_key_sha256 is not None: 158 header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", encryption_key_sha256, 'str') 159 if encryption_algorithm is not None: 160 header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'EncryptionAlgorithmType') 161 if if_modified_since is not None: 162 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 163 if if_unmodified_since is not None: 164 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 165 if if_match is not None: 166 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 167 if if_none_match is not None: 168 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 169 if if_tags is not None: 170 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 171 172 # Construct and send request 173 request = self._client.get(url, query_parameters, header_parameters) 174 pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) 175 response = pipeline_response.http_response 176 177 if response.status_code not in [200, 206]: 178 await response.load_body() 179 map_error(status_code=response.status_code, response=response, error_map=error_map) 180 raise models.StorageErrorException(response, self._deserialize) 181 182 header_dict = {} 183 deserialized = None 184 if response.status_code == 200: 185 deserialized = response.stream_download(self._client._pipeline) 186 header_dict = { 187 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 188 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')), 189 'x-ms-or-policy-id': self._deserialize('str', response.headers.get('x-ms-or-policy-id')), 190 'x-ms-or': self._deserialize('{str}', response.headers.get('x-ms-or')), 191 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')), 192 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')), 193 'Content-Range': self._deserialize('str', response.headers.get('Content-Range')), 194 'ETag': self._deserialize('str', response.headers.get('ETag')), 195 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')), 196 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')), 197 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')), 198 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')), 199 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')), 200 'x-ms-blob-sequence-number': self._deserialize('long', response.headers.get('x-ms-blob-sequence-number')), 201 'x-ms-blob-type': self._deserialize(models.BlobType, response.headers.get('x-ms-blob-type')), 202 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')), 203 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')), 204 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 205 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')), 206 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')), 207 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')), 208 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')), 209 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')), 210 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')), 211 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 212 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 213 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 214 'x-ms-version-id': self._deserialize('str', response.headers.get('x-ms-version-id')), 215 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')), 216 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 217 'x-ms-blob-committed-block-count': self._deserialize('int', response.headers.get('x-ms-blob-committed-block-count')), 218 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')), 219 'x-ms-encryption-key-sha256': self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')), 220 'x-ms-encryption-scope': self._deserialize('str', response.headers.get('x-ms-encryption-scope')), 221 'x-ms-blob-content-md5': self._deserialize('bytearray', response.headers.get('x-ms-blob-content-md5')), 222 'x-ms-tag-count': self._deserialize('long', response.headers.get('x-ms-tag-count')), 223 'x-ms-blob-sealed': self._deserialize('bool', response.headers.get('x-ms-blob-sealed')), 224 'x-ms-content-crc64': self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')), 225 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 226 } 227 if response.status_code == 206: 228 deserialized = response.stream_download(self._client._pipeline) 229 header_dict = { 230 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 231 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')), 232 'x-ms-or-policy-id': self._deserialize('str', response.headers.get('x-ms-or-policy-id')), 233 'x-ms-or': self._deserialize('{str}', response.headers.get('x-ms-or')), 234 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')), 235 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')), 236 'Content-Range': self._deserialize('str', response.headers.get('Content-Range')), 237 'ETag': self._deserialize('str', response.headers.get('ETag')), 238 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')), 239 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')), 240 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')), 241 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')), 242 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')), 243 'x-ms-blob-sequence-number': self._deserialize('long', response.headers.get('x-ms-blob-sequence-number')), 244 'x-ms-blob-type': self._deserialize(models.BlobType, response.headers.get('x-ms-blob-type')), 245 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')), 246 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')), 247 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 248 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')), 249 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')), 250 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')), 251 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')), 252 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')), 253 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')), 254 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 255 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 256 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 257 'x-ms-version-id': self._deserialize('str', response.headers.get('x-ms-version-id')), 258 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')), 259 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 260 'x-ms-blob-committed-block-count': self._deserialize('int', response.headers.get('x-ms-blob-committed-block-count')), 261 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')), 262 'x-ms-encryption-key-sha256': self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')), 263 'x-ms-encryption-scope': self._deserialize('str', response.headers.get('x-ms-encryption-scope')), 264 'x-ms-blob-content-md5': self._deserialize('bytearray', response.headers.get('x-ms-blob-content-md5')), 265 'x-ms-tag-count': self._deserialize('long', response.headers.get('x-ms-tag-count')), 266 'x-ms-blob-sealed': self._deserialize('bool', response.headers.get('x-ms-blob-sealed')), 267 'x-ms-content-crc64': self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')), 268 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 269 } 270 271 if cls: 272 return cls(response, deserialized, header_dict) 273 274 return deserialized 275 download.metadata = {'url': '/{containerName}/{blob}'} 276 277 async def get_properties(self, snapshot=None, version_id=None, timeout=None, request_id=None, lease_access_conditions=None, cpk_info=None, modified_access_conditions=None, *, cls=None, **kwargs): 278 """The Get Properties operation returns all user-defined metadata, 279 standard HTTP properties, and system properties for the blob. It does 280 not return the content of the blob. 281 282 :param snapshot: The snapshot parameter is an opaque DateTime value 283 that, when present, specifies the blob snapshot to retrieve. For more 284 information on working with blob snapshots, see <a 285 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating 286 a Snapshot of a Blob.</a> 287 :type snapshot: str 288 :param version_id: The version id parameter is an opaque DateTime 289 value that, when present, specifies the version of the blob to operate 290 on. It's for service version 2019-10-10 and newer. 291 :type version_id: str 292 :param timeout: The timeout parameter is expressed in seconds. For 293 more information, see <a 294 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 295 Timeouts for Blob Service Operations.</a> 296 :type timeout: int 297 :param request_id: Provides a client-generated, opaque value with a 1 298 KB character limit that is recorded in the analytics logs when storage 299 analytics logging is enabled. 300 :type request_id: str 301 :param lease_access_conditions: Additional parameters for the 302 operation 303 :type lease_access_conditions: 304 ~azure.storage.blob.models.LeaseAccessConditions 305 :param cpk_info: Additional parameters for the operation 306 :type cpk_info: ~azure.storage.blob.models.CpkInfo 307 :param modified_access_conditions: Additional parameters for the 308 operation 309 :type modified_access_conditions: 310 ~azure.storage.blob.models.ModifiedAccessConditions 311 :param callable cls: A custom type or function that will be passed the 312 direct response 313 :return: None or the result of cls(response) 314 :rtype: None 315 :raises: 316 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 317 """ 318 error_map = kwargs.pop('error_map', None) 319 lease_id = None 320 if lease_access_conditions is not None: 321 lease_id = lease_access_conditions.lease_id 322 encryption_key = None 323 if cpk_info is not None: 324 encryption_key = cpk_info.encryption_key 325 encryption_key_sha256 = None 326 if cpk_info is not None: 327 encryption_key_sha256 = cpk_info.encryption_key_sha256 328 encryption_algorithm = None 329 if cpk_info is not None: 330 encryption_algorithm = cpk_info.encryption_algorithm 331 if_modified_since = None 332 if modified_access_conditions is not None: 333 if_modified_since = modified_access_conditions.if_modified_since 334 if_unmodified_since = None 335 if modified_access_conditions is not None: 336 if_unmodified_since = modified_access_conditions.if_unmodified_since 337 if_match = None 338 if modified_access_conditions is not None: 339 if_match = modified_access_conditions.if_match 340 if_none_match = None 341 if modified_access_conditions is not None: 342 if_none_match = modified_access_conditions.if_none_match 343 if_tags = None 344 if modified_access_conditions is not None: 345 if_tags = modified_access_conditions.if_tags 346 347 # Construct URL 348 url = self.get_properties.metadata['url'] 349 path_format_arguments = { 350 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 351 } 352 url = self._client.format_url(url, **path_format_arguments) 353 354 # Construct parameters 355 query_parameters = {} 356 if snapshot is not None: 357 query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') 358 if version_id is not None: 359 query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') 360 if timeout is not None: 361 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 362 363 # Construct headers 364 header_parameters = {} 365 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 366 if request_id is not None: 367 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 368 if lease_id is not None: 369 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 370 if encryption_key is not None: 371 header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", encryption_key, 'str') 372 if encryption_key_sha256 is not None: 373 header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", encryption_key_sha256, 'str') 374 if encryption_algorithm is not None: 375 header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'EncryptionAlgorithmType') 376 if if_modified_since is not None: 377 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 378 if if_unmodified_since is not None: 379 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 380 if if_match is not None: 381 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 382 if if_none_match is not None: 383 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 384 if if_tags is not None: 385 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 386 387 # Construct and send request 388 request = self._client.head(url, query_parameters, header_parameters) 389 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 390 response = pipeline_response.http_response 391 392 if response.status_code not in [200]: 393 map_error(status_code=response.status_code, response=response, error_map=error_map) 394 raise models.StorageErrorException(response, self._deserialize) 395 396 if cls: 397 response_headers = { 398 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 399 'x-ms-creation-time': self._deserialize('rfc-1123', response.headers.get('x-ms-creation-time')), 400 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')), 401 'x-ms-or-policy-id': self._deserialize('str', response.headers.get('x-ms-or-policy-id')), 402 'x-ms-or': self._deserialize('{str}', response.headers.get('x-ms-or')), 403 'x-ms-blob-type': self._deserialize(models.BlobType, response.headers.get('x-ms-blob-type')), 404 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')), 405 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')), 406 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 407 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')), 408 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')), 409 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')), 410 'x-ms-incremental-copy': self._deserialize('bool', response.headers.get('x-ms-incremental-copy')), 411 'x-ms-copy-destination-snapshot': self._deserialize('str', response.headers.get('x-ms-copy-destination-snapshot')), 412 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')), 413 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')), 414 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')), 415 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')), 416 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')), 417 'ETag': self._deserialize('str', response.headers.get('ETag')), 418 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')), 419 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')), 420 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')), 421 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')), 422 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')), 423 'x-ms-blob-sequence-number': self._deserialize('long', response.headers.get('x-ms-blob-sequence-number')), 424 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 425 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 426 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 427 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 428 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')), 429 'x-ms-blob-committed-block-count': self._deserialize('int', response.headers.get('x-ms-blob-committed-block-count')), 430 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')), 431 'x-ms-encryption-key-sha256': self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')), 432 'x-ms-encryption-scope': self._deserialize('str', response.headers.get('x-ms-encryption-scope')), 433 'x-ms-access-tier': self._deserialize('str', response.headers.get('x-ms-access-tier')), 434 'x-ms-access-tier-inferred': self._deserialize('bool', response.headers.get('x-ms-access-tier-inferred')), 435 'x-ms-archive-status': self._deserialize('str', response.headers.get('x-ms-archive-status')), 436 'x-ms-access-tier-change-time': self._deserialize('rfc-1123', response.headers.get('x-ms-access-tier-change-time')), 437 'x-ms-version-id': self._deserialize('str', response.headers.get('x-ms-version-id')), 438 'x-ms-is-current-version': self._deserialize('bool', response.headers.get('x-ms-is-current-version')), 439 'x-ms-tag-count': self._deserialize('long', response.headers.get('x-ms-tag-count')), 440 'x-ms-expiry-time': self._deserialize('rfc-1123', response.headers.get('x-ms-expiry-time')), 441 'x-ms-blob-sealed': self._deserialize('bool', response.headers.get('x-ms-blob-sealed')), 442 'x-ms-rehydrate-priority': self._deserialize('str', response.headers.get('x-ms-rehydrate-priority')), 443 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 444 } 445 return cls(response, None, response_headers) 446 get_properties.metadata = {'url': '/{containerName}/{blob}'} 447 448 async def delete(self, snapshot=None, version_id=None, timeout=None, delete_snapshots=None, request_id=None, lease_access_conditions=None, modified_access_conditions=None, *, cls=None, **kwargs): 449 """If the storage account's soft delete feature is disabled then, when a 450 blob is deleted, it is permanently removed from the storage account. If 451 the storage account's soft delete feature is enabled, then, when a blob 452 is deleted, it is marked for deletion and becomes inaccessible 453 immediately. However, the blob service retains the blob or snapshot for 454 the number of days specified by the DeleteRetentionPolicy section of 455 [Storage service properties] (Set-Blob-Service-Properties.md). After 456 the specified number of days has passed, the blob's data is permanently 457 removed from the storage account. Note that you continue to be charged 458 for the soft-deleted blob's storage until it is permanently removed. 459 Use the List Blobs API and specify the "include=deleted" query 460 parameter to discover which blobs and snapshots have been soft deleted. 461 You can then use the Undelete Blob API to restore a soft-deleted blob. 462 All other operations on a soft-deleted blob or snapshot causes the 463 service to return an HTTP status code of 404 (ResourceNotFound). 464 465 :param snapshot: The snapshot parameter is an opaque DateTime value 466 that, when present, specifies the blob snapshot to retrieve. For more 467 information on working with blob snapshots, see <a 468 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating 469 a Snapshot of a Blob.</a> 470 :type snapshot: str 471 :param version_id: The version id parameter is an opaque DateTime 472 value that, when present, specifies the version of the blob to operate 473 on. It's for service version 2019-10-10 and newer. 474 :type version_id: str 475 :param timeout: The timeout parameter is expressed in seconds. For 476 more information, see <a 477 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 478 Timeouts for Blob Service Operations.</a> 479 :type timeout: int 480 :param delete_snapshots: Required if the blob has associated 481 snapshots. Specify one of the following two options: include: Delete 482 the base blob and all of its snapshots. only: Delete only the blob's 483 snapshots and not the blob itself. Possible values include: 'include', 484 'only' 485 :type delete_snapshots: str or 486 ~azure.storage.blob.models.DeleteSnapshotsOptionType 487 :param request_id: Provides a client-generated, opaque value with a 1 488 KB character limit that is recorded in the analytics logs when storage 489 analytics logging is enabled. 490 :type request_id: str 491 :param lease_access_conditions: Additional parameters for the 492 operation 493 :type lease_access_conditions: 494 ~azure.storage.blob.models.LeaseAccessConditions 495 :param modified_access_conditions: Additional parameters for the 496 operation 497 :type modified_access_conditions: 498 ~azure.storage.blob.models.ModifiedAccessConditions 499 :param callable cls: A custom type or function that will be passed the 500 direct response 501 :return: None or the result of cls(response) 502 :rtype: None 503 :raises: 504 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 505 """ 506 error_map = kwargs.pop('error_map', None) 507 lease_id = None 508 if lease_access_conditions is not None: 509 lease_id = lease_access_conditions.lease_id 510 if_modified_since = None 511 if modified_access_conditions is not None: 512 if_modified_since = modified_access_conditions.if_modified_since 513 if_unmodified_since = None 514 if modified_access_conditions is not None: 515 if_unmodified_since = modified_access_conditions.if_unmodified_since 516 if_match = None 517 if modified_access_conditions is not None: 518 if_match = modified_access_conditions.if_match 519 if_none_match = None 520 if modified_access_conditions is not None: 521 if_none_match = modified_access_conditions.if_none_match 522 if_tags = None 523 if modified_access_conditions is not None: 524 if_tags = modified_access_conditions.if_tags 525 526 # Construct URL 527 url = self.delete.metadata['url'] 528 path_format_arguments = { 529 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 530 } 531 url = self._client.format_url(url, **path_format_arguments) 532 533 # Construct parameters 534 query_parameters = {} 535 if snapshot is not None: 536 query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') 537 if version_id is not None: 538 query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') 539 if timeout is not None: 540 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 541 542 # Construct headers 543 header_parameters = {} 544 if delete_snapshots is not None: 545 header_parameters['x-ms-delete-snapshots'] = self._serialize.header("delete_snapshots", delete_snapshots, 'DeleteSnapshotsOptionType') 546 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 547 if request_id is not None: 548 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 549 if lease_id is not None: 550 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 551 if if_modified_since is not None: 552 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 553 if if_unmodified_since is not None: 554 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 555 if if_match is not None: 556 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 557 if if_none_match is not None: 558 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 559 if if_tags is not None: 560 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 561 562 # Construct and send request 563 request = self._client.delete(url, query_parameters, header_parameters) 564 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 565 response = pipeline_response.http_response 566 567 if response.status_code not in [202]: 568 map_error(status_code=response.status_code, response=response, error_map=error_map) 569 raise models.StorageErrorException(response, self._deserialize) 570 571 if cls: 572 response_headers = { 573 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 574 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 575 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 576 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 577 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 578 } 579 return cls(response, None, response_headers) 580 delete.metadata = {'url': '/{containerName}/{blob}'} 581 582 async def set_access_control(self, timeout=None, owner=None, group=None, posix_permissions=None, posix_acl=None, request_id=None, lease_access_conditions=None, modified_access_conditions=None, *, cls=None, **kwargs): 583 """Set the owner, group, permissions, or access control list for a blob. 584 585 :param timeout: The timeout parameter is expressed in seconds. For 586 more information, see <a 587 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 588 Timeouts for Blob Service Operations.</a> 589 :type timeout: int 590 :param owner: Optional. The owner of the blob or directory. 591 :type owner: str 592 :param group: Optional. The owning group of the blob or directory. 593 :type group: str 594 :param posix_permissions: Optional and only valid if Hierarchical 595 Namespace is enabled for the account. Sets POSIX access permissions 596 for the file owner, the file owning group, and others. Each class may 597 be granted read, write, or execute permission. The sticky bit is also 598 supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 599 0766) are supported. 600 :type posix_permissions: str 601 :param posix_acl: Sets POSIX access control rights on files and 602 directories. The value is a comma-separated list of access control 603 entries. Each access control entry (ACE) consists of a scope, a type, 604 a user or group identifier, and permissions in the format 605 "[scope:][type]:[id]:[permissions]". 606 :type posix_acl: str 607 :param request_id: Provides a client-generated, opaque value with a 1 608 KB character limit that is recorded in the analytics logs when storage 609 analytics logging is enabled. 610 :type request_id: str 611 :param lease_access_conditions: Additional parameters for the 612 operation 613 :type lease_access_conditions: 614 ~azure.storage.blob.models.LeaseAccessConditions 615 :param modified_access_conditions: Additional parameters for the 616 operation 617 :type modified_access_conditions: 618 ~azure.storage.blob.models.ModifiedAccessConditions 619 :param callable cls: A custom type or function that will be passed the 620 direct response 621 :return: None or the result of cls(response) 622 :rtype: None 623 :raises: 624 :class:`DataLakeStorageErrorException<azure.storage.blob.models.DataLakeStorageErrorException>` 625 """ 626 error_map = kwargs.pop('error_map', None) 627 lease_id = None 628 if lease_access_conditions is not None: 629 lease_id = lease_access_conditions.lease_id 630 if_match = None 631 if modified_access_conditions is not None: 632 if_match = modified_access_conditions.if_match 633 if_none_match = None 634 if modified_access_conditions is not None: 635 if_none_match = modified_access_conditions.if_none_match 636 if_modified_since = None 637 if modified_access_conditions is not None: 638 if_modified_since = modified_access_conditions.if_modified_since 639 if_unmodified_since = None 640 if modified_access_conditions is not None: 641 if_unmodified_since = modified_access_conditions.if_unmodified_since 642 643 action = "setAccessControl" 644 645 # Construct URL 646 url = self.set_access_control.metadata['url'] 647 path_format_arguments = { 648 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 649 } 650 url = self._client.format_url(url, **path_format_arguments) 651 652 # Construct parameters 653 query_parameters = {} 654 if timeout is not None: 655 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 656 query_parameters['action'] = self._serialize.query("action", action, 'str') 657 658 # Construct headers 659 header_parameters = {} 660 if owner is not None: 661 header_parameters['x-ms-owner'] = self._serialize.header("owner", owner, 'str') 662 if group is not None: 663 header_parameters['x-ms-group'] = self._serialize.header("group", group, 'str') 664 if posix_permissions is not None: 665 header_parameters['x-ms-permissions'] = self._serialize.header("posix_permissions", posix_permissions, 'str') 666 if posix_acl is not None: 667 header_parameters['x-ms-acl'] = self._serialize.header("posix_acl", posix_acl, 'str') 668 if request_id is not None: 669 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 670 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 671 if lease_id is not None: 672 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 673 if if_match is not None: 674 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 675 if if_none_match is not None: 676 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 677 if if_modified_since is not None: 678 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 679 if if_unmodified_since is not None: 680 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 681 682 # Construct and send request 683 request = self._client.patch(url, query_parameters, header_parameters) 684 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 685 response = pipeline_response.http_response 686 687 if response.status_code not in [200]: 688 map_error(status_code=response.status_code, response=response, error_map=error_map) 689 raise models.DataLakeStorageErrorException(response, self._deserialize) 690 691 if cls: 692 response_headers = { 693 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 694 'ETag': self._deserialize('str', response.headers.get('ETag')), 695 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 696 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 697 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 698 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 699 } 700 return cls(response, None, response_headers) 701 set_access_control.metadata = {'url': '/{filesystem}/{path}'} 702 703 async def get_access_control(self, timeout=None, upn=None, request_id=None, lease_access_conditions=None, modified_access_conditions=None, *, cls=None, **kwargs): 704 """Get the owner, group, permissions, or access control list for a blob. 705 706 :param timeout: The timeout parameter is expressed in seconds. For 707 more information, see <a 708 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 709 Timeouts for Blob Service Operations.</a> 710 :type timeout: int 711 :param upn: Optional. Valid only when Hierarchical Namespace is 712 enabled for the account. If "true", the identity values returned in 713 the x-ms-owner, x-ms-group, and x-ms-acl response headers will be 714 transformed from Azure Active Directory Object IDs to User Principal 715 Names. If "false", the values will be returned as Azure Active 716 Directory Object IDs. The default value is false. 717 :type upn: bool 718 :param request_id: Provides a client-generated, opaque value with a 1 719 KB character limit that is recorded in the analytics logs when storage 720 analytics logging is enabled. 721 :type request_id: str 722 :param lease_access_conditions: Additional parameters for the 723 operation 724 :type lease_access_conditions: 725 ~azure.storage.blob.models.LeaseAccessConditions 726 :param modified_access_conditions: Additional parameters for the 727 operation 728 :type modified_access_conditions: 729 ~azure.storage.blob.models.ModifiedAccessConditions 730 :param callable cls: A custom type or function that will be passed the 731 direct response 732 :return: None or the result of cls(response) 733 :rtype: None 734 :raises: 735 :class:`DataLakeStorageErrorException<azure.storage.blob.models.DataLakeStorageErrorException>` 736 """ 737 error_map = kwargs.pop('error_map', None) 738 lease_id = None 739 if lease_access_conditions is not None: 740 lease_id = lease_access_conditions.lease_id 741 if_match = None 742 if modified_access_conditions is not None: 743 if_match = modified_access_conditions.if_match 744 if_none_match = None 745 if modified_access_conditions is not None: 746 if_none_match = modified_access_conditions.if_none_match 747 if_modified_since = None 748 if modified_access_conditions is not None: 749 if_modified_since = modified_access_conditions.if_modified_since 750 if_unmodified_since = None 751 if modified_access_conditions is not None: 752 if_unmodified_since = modified_access_conditions.if_unmodified_since 753 754 action = "getAccessControl" 755 756 # Construct URL 757 url = self.get_access_control.metadata['url'] 758 path_format_arguments = { 759 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 760 } 761 url = self._client.format_url(url, **path_format_arguments) 762 763 # Construct parameters 764 query_parameters = {} 765 if timeout is not None: 766 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 767 if upn is not None: 768 query_parameters['upn'] = self._serialize.query("upn", upn, 'bool') 769 query_parameters['action'] = self._serialize.query("action", action, 'str') 770 771 # Construct headers 772 header_parameters = {} 773 if request_id is not None: 774 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 775 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 776 if lease_id is not None: 777 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 778 if if_match is not None: 779 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 780 if if_none_match is not None: 781 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 782 if if_modified_since is not None: 783 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 784 if if_unmodified_since is not None: 785 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 786 787 # Construct and send request 788 request = self._client.head(url, query_parameters, header_parameters) 789 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 790 response = pipeline_response.http_response 791 792 if response.status_code not in [200]: 793 map_error(status_code=response.status_code, response=response, error_map=error_map) 794 raise models.DataLakeStorageErrorException(response, self._deserialize) 795 796 if cls: 797 response_headers = { 798 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 799 'ETag': self._deserialize('str', response.headers.get('ETag')), 800 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 801 'x-ms-owner': self._deserialize('str', response.headers.get('x-ms-owner')), 802 'x-ms-group': self._deserialize('str', response.headers.get('x-ms-group')), 803 'x-ms-permissions': self._deserialize('str', response.headers.get('x-ms-permissions')), 804 'x-ms-acl': self._deserialize('str', response.headers.get('x-ms-acl')), 805 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 806 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 807 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 808 } 809 return cls(response, None, response_headers) 810 get_access_control.metadata = {'url': '/{filesystem}/{path}'} 811 812 async def rename(self, rename_source, timeout=None, path_rename_mode=None, directory_properties=None, posix_permissions=None, posix_umask=None, source_lease_id=None, request_id=None, directory_http_headers=None, lease_access_conditions=None, modified_access_conditions=None, source_modified_access_conditions=None, *, cls=None, **kwargs): 813 """Rename a blob/file. By default, the destination is overwritten and if 814 the destination already exists and has a lease the lease is broken. 815 This operation supports conditional HTTP requests. For more 816 information, see [Specifying Conditional Headers for Blob Service 817 Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). 818 To fail if the destination already exists, use a conditional request 819 with If-None-Match: "*". 820 821 :param rename_source: The file or directory to be renamed. The value 822 must have the following format: "/{filesysystem}/{path}". If 823 "x-ms-properties" is specified, the properties will overwrite the 824 existing properties; otherwise, the existing properties will be 825 preserved. 826 :type rename_source: str 827 :param timeout: The timeout parameter is expressed in seconds. For 828 more information, see <a 829 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 830 Timeouts for Blob Service Operations.</a> 831 :type timeout: int 832 :param path_rename_mode: Determines the behavior of the rename 833 operation. Possible values include: 'legacy', 'posix' 834 :type path_rename_mode: str or 835 ~azure.storage.blob.models.PathRenameMode 836 :param directory_properties: Optional. User-defined properties to be 837 stored with the file or directory, in the format of a comma-separated 838 list of name and value pairs "n1=v1, n2=v2, ...", where each value is 839 base64 encoded. 840 :type directory_properties: str 841 :param posix_permissions: Optional and only valid if Hierarchical 842 Namespace is enabled for the account. Sets POSIX access permissions 843 for the file owner, the file owning group, and others. Each class may 844 be granted read, write, or execute permission. The sticky bit is also 845 supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 846 0766) are supported. 847 :type posix_permissions: str 848 :param posix_umask: Only valid if Hierarchical Namespace is enabled 849 for the account. This umask restricts permission settings for file and 850 directory, and will only be applied when default Acl does not exist in 851 parent directory. If the umask bit has set, it means that the 852 corresponding permission will be disabled. Otherwise the corresponding 853 permission will be determined by the permission. A 4-digit octal 854 notation (e.g. 0022) is supported here. If no umask was specified, a 855 default umask - 0027 will be used. 856 :type posix_umask: str 857 :param source_lease_id: A lease ID for the source path. If specified, 858 the source path must have an active lease and the lease ID must match. 859 :type source_lease_id: str 860 :param request_id: Provides a client-generated, opaque value with a 1 861 KB character limit that is recorded in the analytics logs when storage 862 analytics logging is enabled. 863 :type request_id: str 864 :param directory_http_headers: Additional parameters for the operation 865 :type directory_http_headers: 866 ~azure.storage.blob.models.DirectoryHttpHeaders 867 :param lease_access_conditions: Additional parameters for the 868 operation 869 :type lease_access_conditions: 870 ~azure.storage.blob.models.LeaseAccessConditions 871 :param modified_access_conditions: Additional parameters for the 872 operation 873 :type modified_access_conditions: 874 ~azure.storage.blob.models.ModifiedAccessConditions 875 :param source_modified_access_conditions: Additional parameters for 876 the operation 877 :type source_modified_access_conditions: 878 ~azure.storage.blob.models.SourceModifiedAccessConditions 879 :param callable cls: A custom type or function that will be passed the 880 direct response 881 :return: None or the result of cls(response) 882 :rtype: None 883 :raises: 884 :class:`DataLakeStorageErrorException<azure.storage.blob.models.DataLakeStorageErrorException>` 885 """ 886 error_map = kwargs.pop('error_map', None) 887 cache_control = None 888 if directory_http_headers is not None: 889 cache_control = directory_http_headers.cache_control 890 content_type = None 891 if directory_http_headers is not None: 892 content_type = directory_http_headers.content_type 893 content_encoding = None 894 if directory_http_headers is not None: 895 content_encoding = directory_http_headers.content_encoding 896 content_language = None 897 if directory_http_headers is not None: 898 content_language = directory_http_headers.content_language 899 content_disposition = None 900 if directory_http_headers is not None: 901 content_disposition = directory_http_headers.content_disposition 902 lease_id = None 903 if lease_access_conditions is not None: 904 lease_id = lease_access_conditions.lease_id 905 if_modified_since = None 906 if modified_access_conditions is not None: 907 if_modified_since = modified_access_conditions.if_modified_since 908 if_unmodified_since = None 909 if modified_access_conditions is not None: 910 if_unmodified_since = modified_access_conditions.if_unmodified_since 911 if_match = None 912 if modified_access_conditions is not None: 913 if_match = modified_access_conditions.if_match 914 if_none_match = None 915 if modified_access_conditions is not None: 916 if_none_match = modified_access_conditions.if_none_match 917 source_if_modified_since = None 918 if source_modified_access_conditions is not None: 919 source_if_modified_since = source_modified_access_conditions.source_if_modified_since 920 source_if_unmodified_since = None 921 if source_modified_access_conditions is not None: 922 source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since 923 source_if_match = None 924 if source_modified_access_conditions is not None: 925 source_if_match = source_modified_access_conditions.source_if_match 926 source_if_none_match = None 927 if source_modified_access_conditions is not None: 928 source_if_none_match = source_modified_access_conditions.source_if_none_match 929 930 # Construct URL 931 url = self.rename.metadata['url'] 932 path_format_arguments = { 933 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 934 } 935 url = self._client.format_url(url, **path_format_arguments) 936 937 # Construct parameters 938 query_parameters = {} 939 if timeout is not None: 940 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 941 if path_rename_mode is not None: 942 query_parameters['mode'] = self._serialize.query("path_rename_mode", path_rename_mode, 'PathRenameMode') 943 944 # Construct headers 945 header_parameters = {} 946 header_parameters['x-ms-rename-source'] = self._serialize.header("rename_source", rename_source, 'str') 947 if directory_properties is not None: 948 header_parameters['x-ms-properties'] = self._serialize.header("directory_properties", directory_properties, 'str') 949 if posix_permissions is not None: 950 header_parameters['x-ms-permissions'] = self._serialize.header("posix_permissions", posix_permissions, 'str') 951 if posix_umask is not None: 952 header_parameters['x-ms-umask'] = self._serialize.header("posix_umask", posix_umask, 'str') 953 if source_lease_id is not None: 954 header_parameters['x-ms-source-lease-id'] = self._serialize.header("source_lease_id", source_lease_id, 'str') 955 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 956 if request_id is not None: 957 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 958 if cache_control is not None: 959 header_parameters['x-ms-cache-control'] = self._serialize.header("cache_control", cache_control, 'str') 960 if content_type is not None: 961 header_parameters['x-ms-content-type'] = self._serialize.header("content_type", content_type, 'str') 962 if content_encoding is not None: 963 header_parameters['x-ms-content-encoding'] = self._serialize.header("content_encoding", content_encoding, 'str') 964 if content_language is not None: 965 header_parameters['x-ms-content-language'] = self._serialize.header("content_language", content_language, 'str') 966 if content_disposition is not None: 967 header_parameters['x-ms-content-disposition'] = self._serialize.header("content_disposition", content_disposition, 'str') 968 if lease_id is not None: 969 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 970 if if_modified_since is not None: 971 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 972 if if_unmodified_since is not None: 973 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 974 if if_match is not None: 975 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 976 if if_none_match is not None: 977 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 978 if source_if_modified_since is not None: 979 header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') 980 if source_if_unmodified_since is not None: 981 header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') 982 if source_if_match is not None: 983 header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", source_if_match, 'str') 984 if source_if_none_match is not None: 985 header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", source_if_none_match, 'str') 986 987 # Construct and send request 988 request = self._client.put(url, query_parameters, header_parameters) 989 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 990 response = pipeline_response.http_response 991 992 if response.status_code not in [201]: 993 map_error(status_code=response.status_code, response=response, error_map=error_map) 994 raise models.DataLakeStorageErrorException(response, self._deserialize) 995 996 if cls: 997 response_headers = { 998 'ETag': self._deserialize('str', response.headers.get('ETag')), 999 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1000 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1001 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1002 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1003 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')), 1004 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1005 } 1006 return cls(response, None, response_headers) 1007 rename.metadata = {'url': '/{filesystem}/{path}'} 1008 1009 async def undelete(self, timeout=None, request_id=None, *, cls=None, **kwargs): 1010 """Undelete a blob that was previously soft deleted. 1011 1012 :param timeout: The timeout parameter is expressed in seconds. For 1013 more information, see <a 1014 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1015 Timeouts for Blob Service Operations.</a> 1016 :type timeout: int 1017 :param request_id: Provides a client-generated, opaque value with a 1 1018 KB character limit that is recorded in the analytics logs when storage 1019 analytics logging is enabled. 1020 :type request_id: str 1021 :param callable cls: A custom type or function that will be passed the 1022 direct response 1023 :return: None or the result of cls(response) 1024 :rtype: None 1025 :raises: 1026 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1027 """ 1028 error_map = kwargs.pop('error_map', None) 1029 comp = "undelete" 1030 1031 # Construct URL 1032 url = self.undelete.metadata['url'] 1033 path_format_arguments = { 1034 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1035 } 1036 url = self._client.format_url(url, **path_format_arguments) 1037 1038 # Construct parameters 1039 query_parameters = {} 1040 if timeout is not None: 1041 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1042 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1043 1044 # Construct headers 1045 header_parameters = {} 1046 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1047 if request_id is not None: 1048 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1049 1050 # Construct and send request 1051 request = self._client.put(url, query_parameters, header_parameters) 1052 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1053 response = pipeline_response.http_response 1054 1055 if response.status_code not in [200]: 1056 map_error(status_code=response.status_code, response=response, error_map=error_map) 1057 raise models.StorageErrorException(response, self._deserialize) 1058 1059 if cls: 1060 response_headers = { 1061 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1062 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1063 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1064 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1065 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1066 } 1067 return cls(response, None, response_headers) 1068 undelete.metadata = {'url': '/{containerName}/{blob}'} 1069 1070 async def set_expiry(self, expiry_options, timeout=None, request_id=None, expires_on=None, *, cls=None, **kwargs): 1071 """Sets the time a blob will expire and be deleted. 1072 1073 :param expiry_options: Required. Indicates mode of the expiry time. 1074 Possible values include: 'NeverExpire', 'RelativeToCreation', 1075 'RelativeToNow', 'Absolute' 1076 :type expiry_options: str or 1077 ~azure.storage.blob.models.BlobExpiryOptions 1078 :param timeout: The timeout parameter is expressed in seconds. For 1079 more information, see <a 1080 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1081 Timeouts for Blob Service Operations.</a> 1082 :type timeout: int 1083 :param request_id: Provides a client-generated, opaque value with a 1 1084 KB character limit that is recorded in the analytics logs when storage 1085 analytics logging is enabled. 1086 :type request_id: str 1087 :param expires_on: The time to set the blob to expiry 1088 :type expires_on: str 1089 :param callable cls: A custom type or function that will be passed the 1090 direct response 1091 :return: None or the result of cls(response) 1092 :rtype: None 1093 :raises: 1094 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1095 """ 1096 error_map = kwargs.pop('error_map', None) 1097 comp = "expiry" 1098 1099 # Construct URL 1100 url = self.set_expiry.metadata['url'] 1101 path_format_arguments = { 1102 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1103 } 1104 url = self._client.format_url(url, **path_format_arguments) 1105 1106 # Construct parameters 1107 query_parameters = {} 1108 if timeout is not None: 1109 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1110 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1111 1112 # Construct headers 1113 header_parameters = {} 1114 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1115 if request_id is not None: 1116 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1117 header_parameters['x-ms-expiry-option'] = self._serialize.header("expiry_options", expiry_options, 'str') 1118 if expires_on is not None: 1119 header_parameters['x-ms-expiry-time'] = self._serialize.header("expires_on", expires_on, 'str') 1120 1121 # Construct and send request 1122 request = self._client.put(url, query_parameters, header_parameters) 1123 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1124 response = pipeline_response.http_response 1125 1126 if response.status_code not in [200]: 1127 map_error(status_code=response.status_code, response=response, error_map=error_map) 1128 raise models.StorageErrorException(response, self._deserialize) 1129 1130 if cls: 1131 response_headers = { 1132 'ETag': self._deserialize('str', response.headers.get('ETag')), 1133 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1134 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1135 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1136 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1137 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1138 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1139 } 1140 return cls(response, None, response_headers) 1141 set_expiry.metadata = {'url': '/{containerName}/{blob}'} 1142 1143 async def set_http_headers(self, timeout=None, request_id=None, blob_http_headers=None, lease_access_conditions=None, modified_access_conditions=None, *, cls=None, **kwargs): 1144 """The Set HTTP Headers operation sets system properties on the blob. 1145 1146 :param timeout: The timeout parameter is expressed in seconds. For 1147 more information, see <a 1148 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1149 Timeouts for Blob Service Operations.</a> 1150 :type timeout: int 1151 :param request_id: Provides a client-generated, opaque value with a 1 1152 KB character limit that is recorded in the analytics logs when storage 1153 analytics logging is enabled. 1154 :type request_id: str 1155 :param blob_http_headers: Additional parameters for the operation 1156 :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders 1157 :param lease_access_conditions: Additional parameters for the 1158 operation 1159 :type lease_access_conditions: 1160 ~azure.storage.blob.models.LeaseAccessConditions 1161 :param modified_access_conditions: Additional parameters for the 1162 operation 1163 :type modified_access_conditions: 1164 ~azure.storage.blob.models.ModifiedAccessConditions 1165 :param callable cls: A custom type or function that will be passed the 1166 direct response 1167 :return: None or the result of cls(response) 1168 :rtype: None 1169 :raises: 1170 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1171 """ 1172 error_map = kwargs.pop('error_map', None) 1173 blob_cache_control = None 1174 if blob_http_headers is not None: 1175 blob_cache_control = blob_http_headers.blob_cache_control 1176 blob_content_type = None 1177 if blob_http_headers is not None: 1178 blob_content_type = blob_http_headers.blob_content_type 1179 blob_content_md5 = None 1180 if blob_http_headers is not None: 1181 blob_content_md5 = blob_http_headers.blob_content_md5 1182 blob_content_encoding = None 1183 if blob_http_headers is not None: 1184 blob_content_encoding = blob_http_headers.blob_content_encoding 1185 blob_content_language = None 1186 if blob_http_headers is not None: 1187 blob_content_language = blob_http_headers.blob_content_language 1188 blob_content_disposition = None 1189 if blob_http_headers is not None: 1190 blob_content_disposition = blob_http_headers.blob_content_disposition 1191 lease_id = None 1192 if lease_access_conditions is not None: 1193 lease_id = lease_access_conditions.lease_id 1194 if_modified_since = None 1195 if modified_access_conditions is not None: 1196 if_modified_since = modified_access_conditions.if_modified_since 1197 if_unmodified_since = None 1198 if modified_access_conditions is not None: 1199 if_unmodified_since = modified_access_conditions.if_unmodified_since 1200 if_match = None 1201 if modified_access_conditions is not None: 1202 if_match = modified_access_conditions.if_match 1203 if_none_match = None 1204 if modified_access_conditions is not None: 1205 if_none_match = modified_access_conditions.if_none_match 1206 if_tags = None 1207 if modified_access_conditions is not None: 1208 if_tags = modified_access_conditions.if_tags 1209 1210 comp = "properties" 1211 1212 # Construct URL 1213 url = self.set_http_headers.metadata['url'] 1214 path_format_arguments = { 1215 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1216 } 1217 url = self._client.format_url(url, **path_format_arguments) 1218 1219 # Construct parameters 1220 query_parameters = {} 1221 if timeout is not None: 1222 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1223 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1224 1225 # Construct headers 1226 header_parameters = {} 1227 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1228 if request_id is not None: 1229 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1230 if blob_cache_control is not None: 1231 header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", blob_cache_control, 'str') 1232 if blob_content_type is not None: 1233 header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", blob_content_type, 'str') 1234 if blob_content_md5 is not None: 1235 header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", blob_content_md5, 'bytearray') 1236 if blob_content_encoding is not None: 1237 header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", blob_content_encoding, 'str') 1238 if blob_content_language is not None: 1239 header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", blob_content_language, 'str') 1240 if blob_content_disposition is not None: 1241 header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", blob_content_disposition, 'str') 1242 if lease_id is not None: 1243 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1244 if if_modified_since is not None: 1245 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1246 if if_unmodified_since is not None: 1247 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1248 if if_match is not None: 1249 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1250 if if_none_match is not None: 1251 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1252 if if_tags is not None: 1253 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 1254 1255 # Construct and send request 1256 request = self._client.put(url, query_parameters, header_parameters) 1257 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1258 response = pipeline_response.http_response 1259 1260 if response.status_code not in [200]: 1261 map_error(status_code=response.status_code, response=response, error_map=error_map) 1262 raise models.StorageErrorException(response, self._deserialize) 1263 1264 if cls: 1265 response_headers = { 1266 'ETag': self._deserialize('str', response.headers.get('ETag')), 1267 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1268 'x-ms-blob-sequence-number': self._deserialize('long', response.headers.get('x-ms-blob-sequence-number')), 1269 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1270 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1271 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1272 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1273 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1274 } 1275 return cls(response, None, response_headers) 1276 set_http_headers.metadata = {'url': '/{containerName}/{blob}'} 1277 1278 async def set_metadata(self, timeout=None, metadata=None, request_id=None, lease_access_conditions=None, cpk_info=None, cpk_scope_info=None, modified_access_conditions=None, *, cls=None, **kwargs): 1279 """The Set Blob Metadata operation sets user-defined metadata for the 1280 specified blob as one or more name-value pairs. 1281 1282 :param timeout: The timeout parameter is expressed in seconds. For 1283 more information, see <a 1284 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1285 Timeouts for Blob Service Operations.</a> 1286 :type timeout: int 1287 :param metadata: Optional. Specifies a user-defined name-value pair 1288 associated with the blob. If no name-value pairs are specified, the 1289 operation will copy the metadata from the source blob or file to the 1290 destination blob. If one or more name-value pairs are specified, the 1291 destination blob is created with the specified metadata, and metadata 1292 is not copied from the source blob or file. Note that beginning with 1293 version 2009-09-19, metadata names must adhere to the naming rules for 1294 C# identifiers. See Naming and Referencing Containers, Blobs, and 1295 Metadata for more information. 1296 :type metadata: str 1297 :param request_id: Provides a client-generated, opaque value with a 1 1298 KB character limit that is recorded in the analytics logs when storage 1299 analytics logging is enabled. 1300 :type request_id: str 1301 :param lease_access_conditions: Additional parameters for the 1302 operation 1303 :type lease_access_conditions: 1304 ~azure.storage.blob.models.LeaseAccessConditions 1305 :param cpk_info: Additional parameters for the operation 1306 :type cpk_info: ~azure.storage.blob.models.CpkInfo 1307 :param cpk_scope_info: Additional parameters for the operation 1308 :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo 1309 :param modified_access_conditions: Additional parameters for the 1310 operation 1311 :type modified_access_conditions: 1312 ~azure.storage.blob.models.ModifiedAccessConditions 1313 :param callable cls: A custom type or function that will be passed the 1314 direct response 1315 :return: None or the result of cls(response) 1316 :rtype: None 1317 :raises: 1318 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1319 """ 1320 error_map = kwargs.pop('error_map', None) 1321 lease_id = None 1322 if lease_access_conditions is not None: 1323 lease_id = lease_access_conditions.lease_id 1324 encryption_key = None 1325 if cpk_info is not None: 1326 encryption_key = cpk_info.encryption_key 1327 encryption_key_sha256 = None 1328 if cpk_info is not None: 1329 encryption_key_sha256 = cpk_info.encryption_key_sha256 1330 encryption_algorithm = None 1331 if cpk_info is not None: 1332 encryption_algorithm = cpk_info.encryption_algorithm 1333 encryption_scope = None 1334 if cpk_scope_info is not None: 1335 encryption_scope = cpk_scope_info.encryption_scope 1336 if_modified_since = None 1337 if modified_access_conditions is not None: 1338 if_modified_since = modified_access_conditions.if_modified_since 1339 if_unmodified_since = None 1340 if modified_access_conditions is not None: 1341 if_unmodified_since = modified_access_conditions.if_unmodified_since 1342 if_match = None 1343 if modified_access_conditions is not None: 1344 if_match = modified_access_conditions.if_match 1345 if_none_match = None 1346 if modified_access_conditions is not None: 1347 if_none_match = modified_access_conditions.if_none_match 1348 if_tags = None 1349 if modified_access_conditions is not None: 1350 if_tags = modified_access_conditions.if_tags 1351 1352 comp = "metadata" 1353 1354 # Construct URL 1355 url = self.set_metadata.metadata['url'] 1356 path_format_arguments = { 1357 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1358 } 1359 url = self._client.format_url(url, **path_format_arguments) 1360 1361 # Construct parameters 1362 query_parameters = {} 1363 if timeout is not None: 1364 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1365 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1366 1367 # Construct headers 1368 header_parameters = {} 1369 if metadata is not None: 1370 header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') 1371 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1372 if request_id is not None: 1373 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1374 if lease_id is not None: 1375 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1376 if encryption_key is not None: 1377 header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", encryption_key, 'str') 1378 if encryption_key_sha256 is not None: 1379 header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", encryption_key_sha256, 'str') 1380 if encryption_algorithm is not None: 1381 header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'EncryptionAlgorithmType') 1382 if encryption_scope is not None: 1383 header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", encryption_scope, 'str') 1384 if if_modified_since is not None: 1385 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1386 if if_unmodified_since is not None: 1387 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1388 if if_match is not None: 1389 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1390 if if_none_match is not None: 1391 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1392 if if_tags is not None: 1393 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 1394 1395 # Construct and send request 1396 request = self._client.put(url, query_parameters, header_parameters) 1397 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1398 response = pipeline_response.http_response 1399 1400 if response.status_code not in [200]: 1401 map_error(status_code=response.status_code, response=response, error_map=error_map) 1402 raise models.StorageErrorException(response, self._deserialize) 1403 1404 if cls: 1405 response_headers = { 1406 'ETag': self._deserialize('str', response.headers.get('ETag')), 1407 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1408 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1409 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1410 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1411 'x-ms-version-id': self._deserialize('str', response.headers.get('x-ms-version-id')), 1412 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1413 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')), 1414 'x-ms-encryption-key-sha256': self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')), 1415 'x-ms-encryption-scope': self._deserialize('str', response.headers.get('x-ms-encryption-scope')), 1416 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1417 } 1418 return cls(response, None, response_headers) 1419 set_metadata.metadata = {'url': '/{containerName}/{blob}'} 1420 1421 async def acquire_lease(self, timeout=None, duration=None, proposed_lease_id=None, request_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 1422 """[Update] The Lease Blob operation establishes and manages a lock on a 1423 blob for write and delete operations. 1424 1425 :param timeout: The timeout parameter is expressed in seconds. For 1426 more information, see <a 1427 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1428 Timeouts for Blob Service Operations.</a> 1429 :type timeout: int 1430 :param duration: Specifies the duration of the lease, in seconds, or 1431 negative one (-1) for a lease that never expires. A non-infinite lease 1432 can be between 15 and 60 seconds. A lease duration cannot be changed 1433 using renew or change. 1434 :type duration: int 1435 :param proposed_lease_id: Proposed lease ID, in a GUID string format. 1436 The Blob service returns 400 (Invalid request) if the proposed lease 1437 ID is not in the correct format. See Guid Constructor (String) for a 1438 list of valid GUID string formats. 1439 :type proposed_lease_id: str 1440 :param request_id: Provides a client-generated, opaque value with a 1 1441 KB character limit that is recorded in the analytics logs when storage 1442 analytics logging is enabled. 1443 :type request_id: str 1444 :param modified_access_conditions: Additional parameters for the 1445 operation 1446 :type modified_access_conditions: 1447 ~azure.storage.blob.models.ModifiedAccessConditions 1448 :param callable cls: A custom type or function that will be passed the 1449 direct response 1450 :return: None or the result of cls(response) 1451 :rtype: None 1452 :raises: 1453 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1454 """ 1455 error_map = kwargs.pop('error_map', None) 1456 if_modified_since = None 1457 if modified_access_conditions is not None: 1458 if_modified_since = modified_access_conditions.if_modified_since 1459 if_unmodified_since = None 1460 if modified_access_conditions is not None: 1461 if_unmodified_since = modified_access_conditions.if_unmodified_since 1462 if_match = None 1463 if modified_access_conditions is not None: 1464 if_match = modified_access_conditions.if_match 1465 if_none_match = None 1466 if modified_access_conditions is not None: 1467 if_none_match = modified_access_conditions.if_none_match 1468 if_tags = None 1469 if modified_access_conditions is not None: 1470 if_tags = modified_access_conditions.if_tags 1471 1472 comp = "lease" 1473 action = "acquire" 1474 1475 # Construct URL 1476 url = self.acquire_lease.metadata['url'] 1477 path_format_arguments = { 1478 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1479 } 1480 url = self._client.format_url(url, **path_format_arguments) 1481 1482 # Construct parameters 1483 query_parameters = {} 1484 if timeout is not None: 1485 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1486 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1487 1488 # Construct headers 1489 header_parameters = {} 1490 if duration is not None: 1491 header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int') 1492 if proposed_lease_id is not None: 1493 header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') 1494 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1495 if request_id is not None: 1496 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1497 header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') 1498 if if_modified_since is not None: 1499 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1500 if if_unmodified_since is not None: 1501 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1502 if if_match is not None: 1503 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1504 if if_none_match is not None: 1505 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1506 if if_tags is not None: 1507 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 1508 1509 # Construct and send request 1510 request = self._client.put(url, query_parameters, header_parameters) 1511 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1512 response = pipeline_response.http_response 1513 1514 if response.status_code not in [201]: 1515 map_error(status_code=response.status_code, response=response, error_map=error_map) 1516 raise models.StorageErrorException(response, self._deserialize) 1517 1518 if cls: 1519 response_headers = { 1520 'ETag': self._deserialize('str', response.headers.get('ETag')), 1521 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1522 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')), 1523 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1524 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1525 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1526 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1527 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1528 } 1529 return cls(response, None, response_headers) 1530 acquire_lease.metadata = {'url': '/{containerName}/{blob}'} 1531 1532 async def release_lease(self, lease_id, timeout=None, request_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 1533 """[Update] The Lease Blob operation establishes and manages a lock on a 1534 blob for write and delete operations. 1535 1536 :param lease_id: Specifies the current lease ID on the resource. 1537 :type lease_id: str 1538 :param timeout: The timeout parameter is expressed in seconds. For 1539 more information, see <a 1540 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1541 Timeouts for Blob Service Operations.</a> 1542 :type timeout: int 1543 :param request_id: Provides a client-generated, opaque value with a 1 1544 KB character limit that is recorded in the analytics logs when storage 1545 analytics logging is enabled. 1546 :type request_id: str 1547 :param modified_access_conditions: Additional parameters for the 1548 operation 1549 :type modified_access_conditions: 1550 ~azure.storage.blob.models.ModifiedAccessConditions 1551 :param callable cls: A custom type or function that will be passed the 1552 direct response 1553 :return: None or the result of cls(response) 1554 :rtype: None 1555 :raises: 1556 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1557 """ 1558 error_map = kwargs.pop('error_map', None) 1559 if_modified_since = None 1560 if modified_access_conditions is not None: 1561 if_modified_since = modified_access_conditions.if_modified_since 1562 if_unmodified_since = None 1563 if modified_access_conditions is not None: 1564 if_unmodified_since = modified_access_conditions.if_unmodified_since 1565 if_match = None 1566 if modified_access_conditions is not None: 1567 if_match = modified_access_conditions.if_match 1568 if_none_match = None 1569 if modified_access_conditions is not None: 1570 if_none_match = modified_access_conditions.if_none_match 1571 if_tags = None 1572 if modified_access_conditions is not None: 1573 if_tags = modified_access_conditions.if_tags 1574 1575 comp = "lease" 1576 action = "release" 1577 1578 # Construct URL 1579 url = self.release_lease.metadata['url'] 1580 path_format_arguments = { 1581 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1582 } 1583 url = self._client.format_url(url, **path_format_arguments) 1584 1585 # Construct parameters 1586 query_parameters = {} 1587 if timeout is not None: 1588 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1589 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1590 1591 # Construct headers 1592 header_parameters = {} 1593 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1594 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1595 if request_id is not None: 1596 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1597 header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') 1598 if if_modified_since is not None: 1599 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1600 if if_unmodified_since is not None: 1601 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1602 if if_match is not None: 1603 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1604 if if_none_match is not None: 1605 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1606 if if_tags is not None: 1607 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 1608 1609 # Construct and send request 1610 request = self._client.put(url, query_parameters, header_parameters) 1611 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1612 response = pipeline_response.http_response 1613 1614 if response.status_code not in [200]: 1615 map_error(status_code=response.status_code, response=response, error_map=error_map) 1616 raise models.StorageErrorException(response, self._deserialize) 1617 1618 if cls: 1619 response_headers = { 1620 'ETag': self._deserialize('str', response.headers.get('ETag')), 1621 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1622 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1623 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1624 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1625 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1626 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1627 } 1628 return cls(response, None, response_headers) 1629 release_lease.metadata = {'url': '/{containerName}/{blob}'} 1630 1631 async def renew_lease(self, lease_id, timeout=None, request_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 1632 """[Update] The Lease Blob operation establishes and manages a lock on a 1633 blob for write and delete operations. 1634 1635 :param lease_id: Specifies the current lease ID on the resource. 1636 :type lease_id: str 1637 :param timeout: The timeout parameter is expressed in seconds. For 1638 more information, see <a 1639 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1640 Timeouts for Blob Service Operations.</a> 1641 :type timeout: int 1642 :param request_id: Provides a client-generated, opaque value with a 1 1643 KB character limit that is recorded in the analytics logs when storage 1644 analytics logging is enabled. 1645 :type request_id: str 1646 :param modified_access_conditions: Additional parameters for the 1647 operation 1648 :type modified_access_conditions: 1649 ~azure.storage.blob.models.ModifiedAccessConditions 1650 :param callable cls: A custom type or function that will be passed the 1651 direct response 1652 :return: None or the result of cls(response) 1653 :rtype: None 1654 :raises: 1655 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1656 """ 1657 error_map = kwargs.pop('error_map', None) 1658 if_modified_since = None 1659 if modified_access_conditions is not None: 1660 if_modified_since = modified_access_conditions.if_modified_since 1661 if_unmodified_since = None 1662 if modified_access_conditions is not None: 1663 if_unmodified_since = modified_access_conditions.if_unmodified_since 1664 if_match = None 1665 if modified_access_conditions is not None: 1666 if_match = modified_access_conditions.if_match 1667 if_none_match = None 1668 if modified_access_conditions is not None: 1669 if_none_match = modified_access_conditions.if_none_match 1670 if_tags = None 1671 if modified_access_conditions is not None: 1672 if_tags = modified_access_conditions.if_tags 1673 1674 comp = "lease" 1675 action = "renew" 1676 1677 # Construct URL 1678 url = self.renew_lease.metadata['url'] 1679 path_format_arguments = { 1680 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1681 } 1682 url = self._client.format_url(url, **path_format_arguments) 1683 1684 # Construct parameters 1685 query_parameters = {} 1686 if timeout is not None: 1687 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1688 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1689 1690 # Construct headers 1691 header_parameters = {} 1692 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1693 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1694 if request_id is not None: 1695 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1696 header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') 1697 if if_modified_since is not None: 1698 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1699 if if_unmodified_since is not None: 1700 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1701 if if_match is not None: 1702 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1703 if if_none_match is not None: 1704 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1705 if if_tags is not None: 1706 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 1707 1708 # Construct and send request 1709 request = self._client.put(url, query_parameters, header_parameters) 1710 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1711 response = pipeline_response.http_response 1712 1713 if response.status_code not in [200]: 1714 map_error(status_code=response.status_code, response=response, error_map=error_map) 1715 raise models.StorageErrorException(response, self._deserialize) 1716 1717 if cls: 1718 response_headers = { 1719 'ETag': self._deserialize('str', response.headers.get('ETag')), 1720 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1721 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')), 1722 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1723 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1724 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1725 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1726 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1727 } 1728 return cls(response, None, response_headers) 1729 renew_lease.metadata = {'url': '/{containerName}/{blob}'} 1730 1731 async def change_lease(self, lease_id, proposed_lease_id, timeout=None, request_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 1732 """[Update] The Lease Blob operation establishes and manages a lock on a 1733 blob for write and delete operations. 1734 1735 :param lease_id: Specifies the current lease ID on the resource. 1736 :type lease_id: str 1737 :param proposed_lease_id: Proposed lease ID, in a GUID string format. 1738 The Blob service returns 400 (Invalid request) if the proposed lease 1739 ID is not in the correct format. See Guid Constructor (String) for a 1740 list of valid GUID string formats. 1741 :type proposed_lease_id: str 1742 :param timeout: The timeout parameter is expressed in seconds. For 1743 more information, see <a 1744 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1745 Timeouts for Blob Service Operations.</a> 1746 :type timeout: int 1747 :param request_id: Provides a client-generated, opaque value with a 1 1748 KB character limit that is recorded in the analytics logs when storage 1749 analytics logging is enabled. 1750 :type request_id: str 1751 :param modified_access_conditions: Additional parameters for the 1752 operation 1753 :type modified_access_conditions: 1754 ~azure.storage.blob.models.ModifiedAccessConditions 1755 :param callable cls: A custom type or function that will be passed the 1756 direct response 1757 :return: None or the result of cls(response) 1758 :rtype: None 1759 :raises: 1760 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1761 """ 1762 error_map = kwargs.pop('error_map', None) 1763 if_modified_since = None 1764 if modified_access_conditions is not None: 1765 if_modified_since = modified_access_conditions.if_modified_since 1766 if_unmodified_since = None 1767 if modified_access_conditions is not None: 1768 if_unmodified_since = modified_access_conditions.if_unmodified_since 1769 if_match = None 1770 if modified_access_conditions is not None: 1771 if_match = modified_access_conditions.if_match 1772 if_none_match = None 1773 if modified_access_conditions is not None: 1774 if_none_match = modified_access_conditions.if_none_match 1775 if_tags = None 1776 if modified_access_conditions is not None: 1777 if_tags = modified_access_conditions.if_tags 1778 1779 comp = "lease" 1780 action = "change" 1781 1782 # Construct URL 1783 url = self.change_lease.metadata['url'] 1784 path_format_arguments = { 1785 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1786 } 1787 url = self._client.format_url(url, **path_format_arguments) 1788 1789 # Construct parameters 1790 query_parameters = {} 1791 if timeout is not None: 1792 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1793 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1794 1795 # Construct headers 1796 header_parameters = {} 1797 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1798 header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') 1799 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1800 if request_id is not None: 1801 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1802 header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') 1803 if if_modified_since is not None: 1804 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1805 if if_unmodified_since is not None: 1806 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1807 if if_match is not None: 1808 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1809 if if_none_match is not None: 1810 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1811 if if_tags is not None: 1812 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 1813 1814 # Construct and send request 1815 request = self._client.put(url, query_parameters, header_parameters) 1816 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1817 response = pipeline_response.http_response 1818 1819 if response.status_code not in [200]: 1820 map_error(status_code=response.status_code, response=response, error_map=error_map) 1821 raise models.StorageErrorException(response, self._deserialize) 1822 1823 if cls: 1824 response_headers = { 1825 'ETag': self._deserialize('str', response.headers.get('ETag')), 1826 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1827 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1828 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1829 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')), 1830 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1831 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1832 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1833 } 1834 return cls(response, None, response_headers) 1835 change_lease.metadata = {'url': '/{containerName}/{blob}'} 1836 1837 async def break_lease(self, timeout=None, break_period=None, request_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 1838 """[Update] The Lease Blob operation establishes and manages a lock on a 1839 blob for write and delete operations. 1840 1841 :param timeout: The timeout parameter is expressed in seconds. For 1842 more information, see <a 1843 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1844 Timeouts for Blob Service Operations.</a> 1845 :type timeout: int 1846 :param break_period: For a break operation, proposed duration the 1847 lease should continue before it is broken, in seconds, between 0 and 1848 60. This break period is only used if it is shorter than the time 1849 remaining on the lease. If longer, the time remaining on the lease is 1850 used. A new lease will not be available before the break period has 1851 expired, but the lease may be held for longer than the break period. 1852 If this header does not appear with a break operation, a 1853 fixed-duration lease breaks after the remaining lease period elapses, 1854 and an infinite lease breaks immediately. 1855 :type break_period: int 1856 :param request_id: Provides a client-generated, opaque value with a 1 1857 KB character limit that is recorded in the analytics logs when storage 1858 analytics logging is enabled. 1859 :type request_id: str 1860 :param modified_access_conditions: Additional parameters for the 1861 operation 1862 :type modified_access_conditions: 1863 ~azure.storage.blob.models.ModifiedAccessConditions 1864 :param callable cls: A custom type or function that will be passed the 1865 direct response 1866 :return: None or the result of cls(response) 1867 :rtype: None 1868 :raises: 1869 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1870 """ 1871 error_map = kwargs.pop('error_map', None) 1872 if_modified_since = None 1873 if modified_access_conditions is not None: 1874 if_modified_since = modified_access_conditions.if_modified_since 1875 if_unmodified_since = None 1876 if modified_access_conditions is not None: 1877 if_unmodified_since = modified_access_conditions.if_unmodified_since 1878 if_match = None 1879 if modified_access_conditions is not None: 1880 if_match = modified_access_conditions.if_match 1881 if_none_match = None 1882 if modified_access_conditions is not None: 1883 if_none_match = modified_access_conditions.if_none_match 1884 if_tags = None 1885 if modified_access_conditions is not None: 1886 if_tags = modified_access_conditions.if_tags 1887 1888 comp = "lease" 1889 action = "break" 1890 1891 # Construct URL 1892 url = self.break_lease.metadata['url'] 1893 path_format_arguments = { 1894 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1895 } 1896 url = self._client.format_url(url, **path_format_arguments) 1897 1898 # Construct parameters 1899 query_parameters = {} 1900 if timeout is not None: 1901 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1902 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1903 1904 # Construct headers 1905 header_parameters = {} 1906 if break_period is not None: 1907 header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int') 1908 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1909 if request_id is not None: 1910 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1911 header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') 1912 if if_modified_since is not None: 1913 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1914 if if_unmodified_since is not None: 1915 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1916 if if_match is not None: 1917 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1918 if if_none_match is not None: 1919 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1920 if if_tags is not None: 1921 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 1922 1923 # Construct and send request 1924 request = self._client.put(url, query_parameters, header_parameters) 1925 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1926 response = pipeline_response.http_response 1927 1928 if response.status_code not in [202]: 1929 map_error(status_code=response.status_code, response=response, error_map=error_map) 1930 raise models.StorageErrorException(response, self._deserialize) 1931 1932 if cls: 1933 response_headers = { 1934 'ETag': self._deserialize('str', response.headers.get('ETag')), 1935 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1936 'x-ms-lease-time': self._deserialize('int', response.headers.get('x-ms-lease-time')), 1937 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1938 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1939 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1940 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1941 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1942 } 1943 return cls(response, None, response_headers) 1944 break_lease.metadata = {'url': '/{containerName}/{blob}'} 1945 1946 async def create_snapshot(self, timeout=None, metadata=None, request_id=None, cpk_info=None, cpk_scope_info=None, modified_access_conditions=None, lease_access_conditions=None, *, cls=None, **kwargs): 1947 """The Create Snapshot operation creates a read-only snapshot of a blob. 1948 1949 :param timeout: The timeout parameter is expressed in seconds. For 1950 more information, see <a 1951 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1952 Timeouts for Blob Service Operations.</a> 1953 :type timeout: int 1954 :param metadata: Optional. Specifies a user-defined name-value pair 1955 associated with the blob. If no name-value pairs are specified, the 1956 operation will copy the metadata from the source blob or file to the 1957 destination blob. If one or more name-value pairs are specified, the 1958 destination blob is created with the specified metadata, and metadata 1959 is not copied from the source blob or file. Note that beginning with 1960 version 2009-09-19, metadata names must adhere to the naming rules for 1961 C# identifiers. See Naming and Referencing Containers, Blobs, and 1962 Metadata for more information. 1963 :type metadata: str 1964 :param request_id: Provides a client-generated, opaque value with a 1 1965 KB character limit that is recorded in the analytics logs when storage 1966 analytics logging is enabled. 1967 :type request_id: str 1968 :param cpk_info: Additional parameters for the operation 1969 :type cpk_info: ~azure.storage.blob.models.CpkInfo 1970 :param cpk_scope_info: Additional parameters for the operation 1971 :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo 1972 :param modified_access_conditions: Additional parameters for the 1973 operation 1974 :type modified_access_conditions: 1975 ~azure.storage.blob.models.ModifiedAccessConditions 1976 :param lease_access_conditions: Additional parameters for the 1977 operation 1978 :type lease_access_conditions: 1979 ~azure.storage.blob.models.LeaseAccessConditions 1980 :param callable cls: A custom type or function that will be passed the 1981 direct response 1982 :return: None or the result of cls(response) 1983 :rtype: None 1984 :raises: 1985 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1986 """ 1987 error_map = kwargs.pop('error_map', None) 1988 encryption_key = None 1989 if cpk_info is not None: 1990 encryption_key = cpk_info.encryption_key 1991 encryption_key_sha256 = None 1992 if cpk_info is not None: 1993 encryption_key_sha256 = cpk_info.encryption_key_sha256 1994 encryption_algorithm = None 1995 if cpk_info is not None: 1996 encryption_algorithm = cpk_info.encryption_algorithm 1997 encryption_scope = None 1998 if cpk_scope_info is not None: 1999 encryption_scope = cpk_scope_info.encryption_scope 2000 if_modified_since = None 2001 if modified_access_conditions is not None: 2002 if_modified_since = modified_access_conditions.if_modified_since 2003 if_unmodified_since = None 2004 if modified_access_conditions is not None: 2005 if_unmodified_since = modified_access_conditions.if_unmodified_since 2006 if_match = None 2007 if modified_access_conditions is not None: 2008 if_match = modified_access_conditions.if_match 2009 if_none_match = None 2010 if modified_access_conditions is not None: 2011 if_none_match = modified_access_conditions.if_none_match 2012 if_tags = None 2013 if modified_access_conditions is not None: 2014 if_tags = modified_access_conditions.if_tags 2015 lease_id = None 2016 if lease_access_conditions is not None: 2017 lease_id = lease_access_conditions.lease_id 2018 2019 comp = "snapshot" 2020 2021 # Construct URL 2022 url = self.create_snapshot.metadata['url'] 2023 path_format_arguments = { 2024 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2025 } 2026 url = self._client.format_url(url, **path_format_arguments) 2027 2028 # Construct parameters 2029 query_parameters = {} 2030 if timeout is not None: 2031 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2032 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 2033 2034 # Construct headers 2035 header_parameters = {} 2036 if metadata is not None: 2037 header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') 2038 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2039 if request_id is not None: 2040 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2041 if encryption_key is not None: 2042 header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", encryption_key, 'str') 2043 if encryption_key_sha256 is not None: 2044 header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", encryption_key_sha256, 'str') 2045 if encryption_algorithm is not None: 2046 header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'EncryptionAlgorithmType') 2047 if encryption_scope is not None: 2048 header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", encryption_scope, 'str') 2049 if if_modified_since is not None: 2050 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 2051 if if_unmodified_since is not None: 2052 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 2053 if if_match is not None: 2054 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 2055 if if_none_match is not None: 2056 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 2057 if if_tags is not None: 2058 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 2059 if lease_id is not None: 2060 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 2061 2062 # Construct and send request 2063 request = self._client.put(url, query_parameters, header_parameters) 2064 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2065 response = pipeline_response.http_response 2066 2067 if response.status_code not in [201]: 2068 map_error(status_code=response.status_code, response=response, error_map=error_map) 2069 raise models.StorageErrorException(response, self._deserialize) 2070 2071 if cls: 2072 response_headers = { 2073 'x-ms-snapshot': self._deserialize('str', response.headers.get('x-ms-snapshot')), 2074 'ETag': self._deserialize('str', response.headers.get('ETag')), 2075 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 2076 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2077 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2078 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2079 'x-ms-version-id': self._deserialize('str', response.headers.get('x-ms-version-id')), 2080 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2081 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')), 2082 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2083 } 2084 return cls(response, None, response_headers) 2085 create_snapshot.metadata = {'url': '/{containerName}/{blob}'} 2086 2087 async def start_copy_from_url(self, copy_source, timeout=None, metadata=None, tier=None, rehydrate_priority=None, request_id=None, blob_tags_string=None, seal_blob=None, source_modified_access_conditions=None, modified_access_conditions=None, lease_access_conditions=None, *, cls=None, **kwargs): 2088 """The Start Copy From URL operation copies a blob or an internet resource 2089 to a new blob. 2090 2091 :param copy_source: Specifies the name of the source page blob 2092 snapshot. This value is a URL of up to 2 KB in length that specifies a 2093 page blob snapshot. The value should be URL-encoded as it would appear 2094 in a request URI. The source blob must either be public or must be 2095 authenticated via a shared access signature. 2096 :type copy_source: str 2097 :param timeout: The timeout parameter is expressed in seconds. For 2098 more information, see <a 2099 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 2100 Timeouts for Blob Service Operations.</a> 2101 :type timeout: int 2102 :param metadata: Optional. Specifies a user-defined name-value pair 2103 associated with the blob. If no name-value pairs are specified, the 2104 operation will copy the metadata from the source blob or file to the 2105 destination blob. If one or more name-value pairs are specified, the 2106 destination blob is created with the specified metadata, and metadata 2107 is not copied from the source blob or file. Note that beginning with 2108 version 2009-09-19, metadata names must adhere to the naming rules for 2109 C# identifiers. See Naming and Referencing Containers, Blobs, and 2110 Metadata for more information. 2111 :type metadata: str 2112 :param tier: Optional. Indicates the tier to be set on the blob. 2113 Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 2114 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive' 2115 :type tier: str or ~azure.storage.blob.models.AccessTierOptional 2116 :param rehydrate_priority: Optional: Indicates the priority with which 2117 to rehydrate an archived blob. Possible values include: 'High', 2118 'Standard' 2119 :type rehydrate_priority: str or 2120 ~azure.storage.blob.models.RehydratePriority 2121 :param request_id: Provides a client-generated, opaque value with a 1 2122 KB character limit that is recorded in the analytics logs when storage 2123 analytics logging is enabled. 2124 :type request_id: str 2125 :param blob_tags_string: Optional. Used to set blob tags in various 2126 blob operations. 2127 :type blob_tags_string: str 2128 :param seal_blob: Overrides the sealed state of the destination blob. 2129 Service version 2019-12-12 and newer. 2130 :type seal_blob: bool 2131 :param source_modified_access_conditions: Additional parameters for 2132 the operation 2133 :type source_modified_access_conditions: 2134 ~azure.storage.blob.models.SourceModifiedAccessConditions 2135 :param modified_access_conditions: Additional parameters for the 2136 operation 2137 :type modified_access_conditions: 2138 ~azure.storage.blob.models.ModifiedAccessConditions 2139 :param lease_access_conditions: Additional parameters for the 2140 operation 2141 :type lease_access_conditions: 2142 ~azure.storage.blob.models.LeaseAccessConditions 2143 :param callable cls: A custom type or function that will be passed the 2144 direct response 2145 :return: None or the result of cls(response) 2146 :rtype: None 2147 :raises: 2148 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 2149 """ 2150 error_map = kwargs.pop('error_map', None) 2151 source_if_modified_since = None 2152 if source_modified_access_conditions is not None: 2153 source_if_modified_since = source_modified_access_conditions.source_if_modified_since 2154 source_if_unmodified_since = None 2155 if source_modified_access_conditions is not None: 2156 source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since 2157 source_if_match = None 2158 if source_modified_access_conditions is not None: 2159 source_if_match = source_modified_access_conditions.source_if_match 2160 source_if_none_match = None 2161 if source_modified_access_conditions is not None: 2162 source_if_none_match = source_modified_access_conditions.source_if_none_match 2163 source_if_tags = None 2164 if source_modified_access_conditions is not None: 2165 source_if_tags = source_modified_access_conditions.source_if_tags 2166 if_modified_since = None 2167 if modified_access_conditions is not None: 2168 if_modified_since = modified_access_conditions.if_modified_since 2169 if_unmodified_since = None 2170 if modified_access_conditions is not None: 2171 if_unmodified_since = modified_access_conditions.if_unmodified_since 2172 if_match = None 2173 if modified_access_conditions is not None: 2174 if_match = modified_access_conditions.if_match 2175 if_none_match = None 2176 if modified_access_conditions is not None: 2177 if_none_match = modified_access_conditions.if_none_match 2178 if_tags = None 2179 if modified_access_conditions is not None: 2180 if_tags = modified_access_conditions.if_tags 2181 lease_id = None 2182 if lease_access_conditions is not None: 2183 lease_id = lease_access_conditions.lease_id 2184 2185 # Construct URL 2186 url = self.start_copy_from_url.metadata['url'] 2187 path_format_arguments = { 2188 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2189 } 2190 url = self._client.format_url(url, **path_format_arguments) 2191 2192 # Construct parameters 2193 query_parameters = {} 2194 if timeout is not None: 2195 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2196 2197 # Construct headers 2198 header_parameters = {} 2199 if metadata is not None: 2200 header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') 2201 if tier is not None: 2202 header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') 2203 if rehydrate_priority is not None: 2204 header_parameters['x-ms-rehydrate-priority'] = self._serialize.header("rehydrate_priority", rehydrate_priority, 'str') 2205 header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') 2206 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2207 if request_id is not None: 2208 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2209 if blob_tags_string is not None: 2210 header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') 2211 if seal_blob is not None: 2212 header_parameters['x-ms-seal-blob'] = self._serialize.header("seal_blob", seal_blob, 'bool') 2213 if source_if_modified_since is not None: 2214 header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') 2215 if source_if_unmodified_since is not None: 2216 header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') 2217 if source_if_match is not None: 2218 header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", source_if_match, 'str') 2219 if source_if_none_match is not None: 2220 header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", source_if_none_match, 'str') 2221 if source_if_tags is not None: 2222 header_parameters['x-ms-source-if-tags'] = self._serialize.header("source_if_tags", source_if_tags, 'str') 2223 if if_modified_since is not None: 2224 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 2225 if if_unmodified_since is not None: 2226 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 2227 if if_match is not None: 2228 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 2229 if if_none_match is not None: 2230 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 2231 if if_tags is not None: 2232 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 2233 if lease_id is not None: 2234 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 2235 2236 # Construct and send request 2237 request = self._client.put(url, query_parameters, header_parameters) 2238 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2239 response = pipeline_response.http_response 2240 2241 if response.status_code not in [202]: 2242 map_error(status_code=response.status_code, response=response, error_map=error_map) 2243 raise models.StorageErrorException(response, self._deserialize) 2244 2245 if cls: 2246 response_headers = { 2247 'ETag': self._deserialize('str', response.headers.get('ETag')), 2248 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 2249 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2250 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2251 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2252 'x-ms-version-id': self._deserialize('str', response.headers.get('x-ms-version-id')), 2253 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2254 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 2255 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')), 2256 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2257 } 2258 return cls(response, None, response_headers) 2259 start_copy_from_url.metadata = {'url': '/{containerName}/{blob}'} 2260 2261 async def copy_from_url(self, copy_source, timeout=None, metadata=None, tier=None, request_id=None, source_content_md5=None, blob_tags_string=None, source_modified_access_conditions=None, modified_access_conditions=None, lease_access_conditions=None, *, cls=None, **kwargs): 2262 """The Copy From URL operation copies a blob or an internet resource to a 2263 new blob. It will not return a response until the copy is complete. 2264 2265 :param copy_source: Specifies the name of the source page blob 2266 snapshot. This value is a URL of up to 2 KB in length that specifies a 2267 page blob snapshot. The value should be URL-encoded as it would appear 2268 in a request URI. The source blob must either be public or must be 2269 authenticated via a shared access signature. 2270 :type copy_source: str 2271 :param timeout: The timeout parameter is expressed in seconds. For 2272 more information, see <a 2273 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 2274 Timeouts for Blob Service Operations.</a> 2275 :type timeout: int 2276 :param metadata: Optional. Specifies a user-defined name-value pair 2277 associated with the blob. If no name-value pairs are specified, the 2278 operation will copy the metadata from the source blob or file to the 2279 destination blob. If one or more name-value pairs are specified, the 2280 destination blob is created with the specified metadata, and metadata 2281 is not copied from the source blob or file. Note that beginning with 2282 version 2009-09-19, metadata names must adhere to the naming rules for 2283 C# identifiers. See Naming and Referencing Containers, Blobs, and 2284 Metadata for more information. 2285 :type metadata: str 2286 :param tier: Optional. Indicates the tier to be set on the blob. 2287 Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 2288 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive' 2289 :type tier: str or ~azure.storage.blob.models.AccessTierOptional 2290 :param request_id: Provides a client-generated, opaque value with a 1 2291 KB character limit that is recorded in the analytics logs when storage 2292 analytics logging is enabled. 2293 :type request_id: str 2294 :param source_content_md5: Specify the md5 calculated for the range of 2295 bytes that must be read from the copy source. 2296 :type source_content_md5: bytearray 2297 :param blob_tags_string: Optional. Used to set blob tags in various 2298 blob operations. 2299 :type blob_tags_string: str 2300 :param source_modified_access_conditions: Additional parameters for 2301 the operation 2302 :type source_modified_access_conditions: 2303 ~azure.storage.blob.models.SourceModifiedAccessConditions 2304 :param modified_access_conditions: Additional parameters for the 2305 operation 2306 :type modified_access_conditions: 2307 ~azure.storage.blob.models.ModifiedAccessConditions 2308 :param lease_access_conditions: Additional parameters for the 2309 operation 2310 :type lease_access_conditions: 2311 ~azure.storage.blob.models.LeaseAccessConditions 2312 :param callable cls: A custom type or function that will be passed the 2313 direct response 2314 :return: None or the result of cls(response) 2315 :rtype: None 2316 :raises: 2317 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 2318 """ 2319 error_map = kwargs.pop('error_map', None) 2320 source_if_modified_since = None 2321 if source_modified_access_conditions is not None: 2322 source_if_modified_since = source_modified_access_conditions.source_if_modified_since 2323 source_if_unmodified_since = None 2324 if source_modified_access_conditions is not None: 2325 source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since 2326 source_if_match = None 2327 if source_modified_access_conditions is not None: 2328 source_if_match = source_modified_access_conditions.source_if_match 2329 source_if_none_match = None 2330 if source_modified_access_conditions is not None: 2331 source_if_none_match = source_modified_access_conditions.source_if_none_match 2332 if_modified_since = None 2333 if modified_access_conditions is not None: 2334 if_modified_since = modified_access_conditions.if_modified_since 2335 if_unmodified_since = None 2336 if modified_access_conditions is not None: 2337 if_unmodified_since = modified_access_conditions.if_unmodified_since 2338 if_match = None 2339 if modified_access_conditions is not None: 2340 if_match = modified_access_conditions.if_match 2341 if_none_match = None 2342 if modified_access_conditions is not None: 2343 if_none_match = modified_access_conditions.if_none_match 2344 if_tags = None 2345 if modified_access_conditions is not None: 2346 if_tags = modified_access_conditions.if_tags 2347 lease_id = None 2348 if lease_access_conditions is not None: 2349 lease_id = lease_access_conditions.lease_id 2350 2351 # Construct URL 2352 url = self.copy_from_url.metadata['url'] 2353 path_format_arguments = { 2354 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2355 } 2356 url = self._client.format_url(url, **path_format_arguments) 2357 2358 # Construct parameters 2359 query_parameters = {} 2360 if timeout is not None: 2361 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2362 2363 # Construct headers 2364 header_parameters = {} 2365 if metadata is not None: 2366 header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') 2367 if tier is not None: 2368 header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') 2369 header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') 2370 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2371 if request_id is not None: 2372 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2373 if source_content_md5 is not None: 2374 header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') 2375 if blob_tags_string is not None: 2376 header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') 2377 header_parameters['x-ms-requires-sync'] = self._serialize.header("self.x_ms_requires_sync", self.x_ms_requires_sync, 'str') 2378 if source_if_modified_since is not None: 2379 header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') 2380 if source_if_unmodified_since is not None: 2381 header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') 2382 if source_if_match is not None: 2383 header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", source_if_match, 'str') 2384 if source_if_none_match is not None: 2385 header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", source_if_none_match, 'str') 2386 if if_modified_since is not None: 2387 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 2388 if if_unmodified_since is not None: 2389 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 2390 if if_match is not None: 2391 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 2392 if if_none_match is not None: 2393 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 2394 if if_tags is not None: 2395 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 2396 if lease_id is not None: 2397 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 2398 2399 # Construct and send request 2400 request = self._client.put(url, query_parameters, header_parameters) 2401 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2402 response = pipeline_response.http_response 2403 2404 if response.status_code not in [202]: 2405 map_error(status_code=response.status_code, response=response, error_map=error_map) 2406 raise models.StorageErrorException(response, self._deserialize) 2407 2408 if cls: 2409 response_headers = { 2410 'ETag': self._deserialize('str', response.headers.get('ETag')), 2411 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 2412 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2413 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2414 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2415 'x-ms-version-id': self._deserialize('str', response.headers.get('x-ms-version-id')), 2416 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2417 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 2418 'x-ms-copy-status': self._deserialize(models.SyncCopyStatusType, response.headers.get('x-ms-copy-status')), 2419 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')), 2420 'x-ms-content-crc64': self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')), 2421 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2422 } 2423 return cls(response, None, response_headers) 2424 copy_from_url.metadata = {'url': '/{containerName}/{blob}'} 2425 2426 async def abort_copy_from_url(self, copy_id, timeout=None, request_id=None, lease_access_conditions=None, *, cls=None, **kwargs): 2427 """The Abort Copy From URL operation aborts a pending Copy From URL 2428 operation, and leaves a destination blob with zero length and full 2429 metadata. 2430 2431 :param copy_id: The copy identifier provided in the x-ms-copy-id 2432 header of the original Copy Blob operation. 2433 :type copy_id: str 2434 :param timeout: The timeout parameter is expressed in seconds. For 2435 more information, see <a 2436 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 2437 Timeouts for Blob Service Operations.</a> 2438 :type timeout: int 2439 :param request_id: Provides a client-generated, opaque value with a 1 2440 KB character limit that is recorded in the analytics logs when storage 2441 analytics logging is enabled. 2442 :type request_id: str 2443 :param lease_access_conditions: Additional parameters for the 2444 operation 2445 :type lease_access_conditions: 2446 ~azure.storage.blob.models.LeaseAccessConditions 2447 :param callable cls: A custom type or function that will be passed the 2448 direct response 2449 :return: None or the result of cls(response) 2450 :rtype: None 2451 :raises: 2452 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 2453 """ 2454 error_map = kwargs.pop('error_map', None) 2455 lease_id = None 2456 if lease_access_conditions is not None: 2457 lease_id = lease_access_conditions.lease_id 2458 2459 comp = "copy" 2460 2461 # Construct URL 2462 url = self.abort_copy_from_url.metadata['url'] 2463 path_format_arguments = { 2464 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2465 } 2466 url = self._client.format_url(url, **path_format_arguments) 2467 2468 # Construct parameters 2469 query_parameters = {} 2470 query_parameters['copyid'] = self._serialize.query("copy_id", copy_id, 'str') 2471 if timeout is not None: 2472 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2473 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 2474 2475 # Construct headers 2476 header_parameters = {} 2477 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2478 if request_id is not None: 2479 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2480 header_parameters['x-ms-copy-action'] = self._serialize.header("self.x_ms_copy_action", self.x_ms_copy_action, 'str') 2481 if lease_id is not None: 2482 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 2483 2484 # Construct and send request 2485 request = self._client.put(url, query_parameters, header_parameters) 2486 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2487 response = pipeline_response.http_response 2488 2489 if response.status_code not in [204]: 2490 map_error(status_code=response.status_code, response=response, error_map=error_map) 2491 raise models.StorageErrorException(response, self._deserialize) 2492 2493 if cls: 2494 response_headers = { 2495 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2496 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2497 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2498 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2499 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2500 } 2501 return cls(response, None, response_headers) 2502 abort_copy_from_url.metadata = {'url': '/{containerName}/{blob}'} 2503 2504 async def set_tier(self, tier, snapshot=None, version_id=None, timeout=None, rehydrate_priority=None, request_id=None, lease_access_conditions=None, modified_access_conditions=None, *, cls=None, **kwargs): 2505 """The Set Tier operation sets the tier on a blob. The operation is 2506 allowed on a page blob in a premium storage account and on a block blob 2507 in a blob storage account (locally redundant storage only). A premium 2508 page blob's tier determines the allowed size, IOPS, and bandwidth of 2509 the blob. A block blob's tier determines Hot/Cool/Archive storage type. 2510 This operation does not update the blob's ETag. 2511 2512 :param tier: Indicates the tier to be set on the blob. Possible values 2513 include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 2514 'P70', 'P80', 'Hot', 'Cool', 'Archive' 2515 :type tier: str or ~azure.storage.blob.models.AccessTierRequired 2516 :param snapshot: The snapshot parameter is an opaque DateTime value 2517 that, when present, specifies the blob snapshot to retrieve. For more 2518 information on working with blob snapshots, see <a 2519 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating 2520 a Snapshot of a Blob.</a> 2521 :type snapshot: str 2522 :param version_id: The version id parameter is an opaque DateTime 2523 value that, when present, specifies the version of the blob to operate 2524 on. It's for service version 2019-10-10 and newer. 2525 :type version_id: str 2526 :param timeout: The timeout parameter is expressed in seconds. For 2527 more information, see <a 2528 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 2529 Timeouts for Blob Service Operations.</a> 2530 :type timeout: int 2531 :param rehydrate_priority: Optional: Indicates the priority with which 2532 to rehydrate an archived blob. Possible values include: 'High', 2533 'Standard' 2534 :type rehydrate_priority: str or 2535 ~azure.storage.blob.models.RehydratePriority 2536 :param request_id: Provides a client-generated, opaque value with a 1 2537 KB character limit that is recorded in the analytics logs when storage 2538 analytics logging is enabled. 2539 :type request_id: str 2540 :param lease_access_conditions: Additional parameters for the 2541 operation 2542 :type lease_access_conditions: 2543 ~azure.storage.blob.models.LeaseAccessConditions 2544 :param modified_access_conditions: Additional parameters for the 2545 operation 2546 :type modified_access_conditions: 2547 ~azure.storage.blob.models.ModifiedAccessConditions 2548 :param callable cls: A custom type or function that will be passed the 2549 direct response 2550 :return: None or the result of cls(response) 2551 :rtype: None 2552 :raises: 2553 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 2554 """ 2555 error_map = kwargs.pop('error_map', None) 2556 lease_id = None 2557 if lease_access_conditions is not None: 2558 lease_id = lease_access_conditions.lease_id 2559 if_tags = None 2560 if modified_access_conditions is not None: 2561 if_tags = modified_access_conditions.if_tags 2562 2563 comp = "tier" 2564 2565 # Construct URL 2566 url = self.set_tier.metadata['url'] 2567 path_format_arguments = { 2568 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2569 } 2570 url = self._client.format_url(url, **path_format_arguments) 2571 2572 # Construct parameters 2573 query_parameters = {} 2574 if snapshot is not None: 2575 query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') 2576 if version_id is not None: 2577 query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') 2578 if timeout is not None: 2579 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2580 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 2581 2582 # Construct headers 2583 header_parameters = {} 2584 header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') 2585 if rehydrate_priority is not None: 2586 header_parameters['x-ms-rehydrate-priority'] = self._serialize.header("rehydrate_priority", rehydrate_priority, 'str') 2587 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2588 if request_id is not None: 2589 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2590 if lease_id is not None: 2591 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 2592 if if_tags is not None: 2593 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 2594 2595 # Construct and send request 2596 request = self._client.put(url, query_parameters, header_parameters) 2597 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2598 response = pipeline_response.http_response 2599 2600 if response.status_code not in [200, 202]: 2601 map_error(status_code=response.status_code, response=response, error_map=error_map) 2602 raise models.StorageErrorException(response, self._deserialize) 2603 2604 if cls: 2605 response_headers = { 2606 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2607 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2608 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2609 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2610 } 2611 return cls(response, None, response_headers) 2612 set_tier.metadata = {'url': '/{containerName}/{blob}'} 2613 2614 async def get_account_info(self, *, cls=None, **kwargs): 2615 """Returns the sku name and account kind . 2616 2617 :param callable cls: A custom type or function that will be passed the 2618 direct response 2619 :return: None or the result of cls(response) 2620 :rtype: None 2621 :raises: 2622 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 2623 """ 2624 error_map = kwargs.pop('error_map', None) 2625 comp = "properties" 2626 2627 # Construct URL 2628 url = self.get_account_info.metadata['url'] 2629 path_format_arguments = { 2630 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2631 } 2632 url = self._client.format_url(url, **path_format_arguments) 2633 2634 # Construct parameters 2635 query_parameters = {} 2636 query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str') 2637 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 2638 2639 # Construct headers 2640 header_parameters = {} 2641 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2642 2643 # Construct and send request 2644 request = self._client.get(url, query_parameters, header_parameters) 2645 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2646 response = pipeline_response.http_response 2647 2648 if response.status_code not in [200]: 2649 map_error(status_code=response.status_code, response=response, error_map=error_map) 2650 raise models.StorageErrorException(response, self._deserialize) 2651 2652 if cls: 2653 response_headers = { 2654 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2655 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2656 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2657 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2658 'x-ms-sku-name': self._deserialize(models.SkuName, response.headers.get('x-ms-sku-name')), 2659 'x-ms-account-kind': self._deserialize(models.AccountKind, response.headers.get('x-ms-account-kind')), 2660 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2661 } 2662 return cls(response, None, response_headers) 2663 get_account_info.metadata = {'url': '/{containerName}/{blob}'} 2664 2665 async def query(self, query_request=None, snapshot=None, timeout=None, request_id=None, lease_access_conditions=None, cpk_info=None, modified_access_conditions=None, *, cls=None, **kwargs): 2666 """The Query operation enables users to select/project on blob data by 2667 providing simple query expressions. 2668 2669 :param query_request: the query request 2670 :type query_request: ~azure.storage.blob.models.QueryRequest 2671 :param snapshot: The snapshot parameter is an opaque DateTime value 2672 that, when present, specifies the blob snapshot to retrieve. For more 2673 information on working with blob snapshots, see <a 2674 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating 2675 a Snapshot of a Blob.</a> 2676 :type snapshot: str 2677 :param timeout: The timeout parameter is expressed in seconds. For 2678 more information, see <a 2679 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 2680 Timeouts for Blob Service Operations.</a> 2681 :type timeout: int 2682 :param request_id: Provides a client-generated, opaque value with a 1 2683 KB character limit that is recorded in the analytics logs when storage 2684 analytics logging is enabled. 2685 :type request_id: str 2686 :param lease_access_conditions: Additional parameters for the 2687 operation 2688 :type lease_access_conditions: 2689 ~azure.storage.blob.models.LeaseAccessConditions 2690 :param cpk_info: Additional parameters for the operation 2691 :type cpk_info: ~azure.storage.blob.models.CpkInfo 2692 :param modified_access_conditions: Additional parameters for the 2693 operation 2694 :type modified_access_conditions: 2695 ~azure.storage.blob.models.ModifiedAccessConditions 2696 :param callable cls: A custom type or function that will be passed the 2697 direct response 2698 :return: object or the result of cls(response) 2699 :rtype: Generator 2700 :raises: 2701 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 2702 """ 2703 error_map = kwargs.pop('error_map', None) 2704 lease_id = None 2705 if lease_access_conditions is not None: 2706 lease_id = lease_access_conditions.lease_id 2707 encryption_key = None 2708 if cpk_info is not None: 2709 encryption_key = cpk_info.encryption_key 2710 encryption_key_sha256 = None 2711 if cpk_info is not None: 2712 encryption_key_sha256 = cpk_info.encryption_key_sha256 2713 encryption_algorithm = None 2714 if cpk_info is not None: 2715 encryption_algorithm = cpk_info.encryption_algorithm 2716 if_modified_since = None 2717 if modified_access_conditions is not None: 2718 if_modified_since = modified_access_conditions.if_modified_since 2719 if_unmodified_since = None 2720 if modified_access_conditions is not None: 2721 if_unmodified_since = modified_access_conditions.if_unmodified_since 2722 if_match = None 2723 if modified_access_conditions is not None: 2724 if_match = modified_access_conditions.if_match 2725 if_none_match = None 2726 if modified_access_conditions is not None: 2727 if_none_match = modified_access_conditions.if_none_match 2728 if_tags = None 2729 if modified_access_conditions is not None: 2730 if_tags = modified_access_conditions.if_tags 2731 2732 comp = "query" 2733 2734 # Construct URL 2735 url = self.query.metadata['url'] 2736 path_format_arguments = { 2737 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2738 } 2739 url = self._client.format_url(url, **path_format_arguments) 2740 2741 # Construct parameters 2742 query_parameters = {} 2743 if snapshot is not None: 2744 query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') 2745 if timeout is not None: 2746 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2747 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 2748 2749 # Construct headers 2750 header_parameters = {} 2751 header_parameters['Accept'] = 'application/xml' 2752 header_parameters['Content-Type'] = 'application/xml; charset=utf-8' 2753 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2754 if request_id is not None: 2755 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2756 if lease_id is not None: 2757 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 2758 if encryption_key is not None: 2759 header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", encryption_key, 'str') 2760 if encryption_key_sha256 is not None: 2761 header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", encryption_key_sha256, 'str') 2762 if encryption_algorithm is not None: 2763 header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'EncryptionAlgorithmType') 2764 if if_modified_since is not None: 2765 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 2766 if if_unmodified_since is not None: 2767 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 2768 if if_match is not None: 2769 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 2770 if if_none_match is not None: 2771 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 2772 if if_tags is not None: 2773 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 2774 2775 # Construct body 2776 if query_request is not None: 2777 body_content = self._serialize.body(query_request, 'QueryRequest') 2778 else: 2779 body_content = None 2780 2781 # Construct and send request 2782 request = self._client.post(url, query_parameters, header_parameters, body_content) 2783 pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) 2784 response = pipeline_response.http_response 2785 2786 if response.status_code not in [200, 206]: 2787 await response.load_body() 2788 map_error(status_code=response.status_code, response=response, error_map=error_map) 2789 raise models.StorageErrorException(response, self._deserialize) 2790 2791 header_dict = {} 2792 deserialized = None 2793 if response.status_code == 200: 2794 deserialized = response.stream_download(self._client._pipeline) 2795 header_dict = { 2796 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 2797 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')), 2798 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')), 2799 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')), 2800 'Content-Range': self._deserialize('str', response.headers.get('Content-Range')), 2801 'ETag': self._deserialize('str', response.headers.get('ETag')), 2802 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')), 2803 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')), 2804 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')), 2805 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')), 2806 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')), 2807 'x-ms-blob-sequence-number': self._deserialize('long', response.headers.get('x-ms-blob-sequence-number')), 2808 'x-ms-blob-type': self._deserialize(models.BlobType, response.headers.get('x-ms-blob-type')), 2809 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')), 2810 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')), 2811 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 2812 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')), 2813 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')), 2814 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')), 2815 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')), 2816 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')), 2817 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')), 2818 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2819 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2820 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2821 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')), 2822 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2823 'x-ms-blob-committed-block-count': self._deserialize('int', response.headers.get('x-ms-blob-committed-block-count')), 2824 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')), 2825 'x-ms-encryption-key-sha256': self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')), 2826 'x-ms-encryption-scope': self._deserialize('str', response.headers.get('x-ms-encryption-scope')), 2827 'x-ms-blob-content-md5': self._deserialize('bytearray', response.headers.get('x-ms-blob-content-md5')), 2828 'x-ms-content-crc64': self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')), 2829 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2830 } 2831 if response.status_code == 206: 2832 deserialized = response.stream_download(self._client._pipeline) 2833 header_dict = { 2834 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 2835 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')), 2836 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')), 2837 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')), 2838 'Content-Range': self._deserialize('str', response.headers.get('Content-Range')), 2839 'ETag': self._deserialize('str', response.headers.get('ETag')), 2840 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')), 2841 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')), 2842 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')), 2843 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')), 2844 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')), 2845 'x-ms-blob-sequence-number': self._deserialize('long', response.headers.get('x-ms-blob-sequence-number')), 2846 'x-ms-blob-type': self._deserialize(models.BlobType, response.headers.get('x-ms-blob-type')), 2847 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')), 2848 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')), 2849 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 2850 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')), 2851 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')), 2852 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')), 2853 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')), 2854 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')), 2855 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')), 2856 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2857 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2858 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2859 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')), 2860 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2861 'x-ms-blob-committed-block-count': self._deserialize('int', response.headers.get('x-ms-blob-committed-block-count')), 2862 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')), 2863 'x-ms-encryption-key-sha256': self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')), 2864 'x-ms-encryption-scope': self._deserialize('str', response.headers.get('x-ms-encryption-scope')), 2865 'x-ms-blob-content-md5': self._deserialize('bytearray', response.headers.get('x-ms-blob-content-md5')), 2866 'x-ms-content-crc64': self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')), 2867 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2868 } 2869 2870 if cls: 2871 return cls(response, deserialized, header_dict) 2872 2873 return deserialized 2874 query.metadata = {'url': '/{containerName}/{blob}'} 2875 2876 async def get_tags(self, timeout=None, request_id=None, snapshot=None, version_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 2877 """The Get Tags operation enables users to get the tags associated with a 2878 blob. 2879 2880 :param timeout: The timeout parameter is expressed in seconds. For 2881 more information, see <a 2882 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 2883 Timeouts for Blob Service Operations.</a> 2884 :type timeout: int 2885 :param request_id: Provides a client-generated, opaque value with a 1 2886 KB character limit that is recorded in the analytics logs when storage 2887 analytics logging is enabled. 2888 :type request_id: str 2889 :param snapshot: The snapshot parameter is an opaque DateTime value 2890 that, when present, specifies the blob snapshot to retrieve. For more 2891 information on working with blob snapshots, see <a 2892 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating 2893 a Snapshot of a Blob.</a> 2894 :type snapshot: str 2895 :param version_id: The version id parameter is an opaque DateTime 2896 value that, when present, specifies the version of the blob to operate 2897 on. It's for service version 2019-10-10 and newer. 2898 :type version_id: str 2899 :param modified_access_conditions: Additional parameters for the 2900 operation 2901 :type modified_access_conditions: 2902 ~azure.storage.blob.models.ModifiedAccessConditions 2903 :param callable cls: A custom type or function that will be passed the 2904 direct response 2905 :return: BlobTags or the result of cls(response) 2906 :rtype: ~azure.storage.blob.models.BlobTags 2907 :raises: 2908 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 2909 """ 2910 error_map = kwargs.pop('error_map', None) 2911 if_tags = None 2912 if modified_access_conditions is not None: 2913 if_tags = modified_access_conditions.if_tags 2914 2915 comp = "tags" 2916 2917 # Construct URL 2918 url = self.get_tags.metadata['url'] 2919 path_format_arguments = { 2920 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2921 } 2922 url = self._client.format_url(url, **path_format_arguments) 2923 2924 # Construct parameters 2925 query_parameters = {} 2926 if timeout is not None: 2927 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2928 if snapshot is not None: 2929 query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') 2930 if version_id is not None: 2931 query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') 2932 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 2933 2934 # Construct headers 2935 header_parameters = {} 2936 header_parameters['Accept'] = 'application/xml' 2937 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2938 if request_id is not None: 2939 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2940 if if_tags is not None: 2941 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 2942 2943 # Construct and send request 2944 request = self._client.get(url, query_parameters, header_parameters) 2945 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2946 response = pipeline_response.http_response 2947 2948 if response.status_code not in [200]: 2949 map_error(status_code=response.status_code, response=response, error_map=error_map) 2950 raise models.StorageErrorException(response, self._deserialize) 2951 2952 header_dict = {} 2953 deserialized = None 2954 if response.status_code == 200: 2955 deserialized = self._deserialize('BlobTags', response) 2956 header_dict = { 2957 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2958 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2959 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2960 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2961 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2962 } 2963 2964 if cls: 2965 return cls(response, deserialized, header_dict) 2966 2967 return deserialized 2968 get_tags.metadata = {'url': '/{containerName}/{blob}'} 2969 2970 async def set_tags(self, timeout=None, version_id=None, transactional_content_md5=None, transactional_content_crc64=None, request_id=None, tags=None, modified_access_conditions=None, *, cls=None, **kwargs): 2971 """The Set Tags operation enables users to set tags on a blob. 2972 2973 :param timeout: The timeout parameter is expressed in seconds. For 2974 more information, see <a 2975 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 2976 Timeouts for Blob Service Operations.</a> 2977 :type timeout: int 2978 :param version_id: The version id parameter is an opaque DateTime 2979 value that, when present, specifies the version of the blob to operate 2980 on. It's for service version 2019-10-10 and newer. 2981 :type version_id: str 2982 :param transactional_content_md5: Specify the transactional md5 for 2983 the body, to be validated by the service. 2984 :type transactional_content_md5: bytearray 2985 :param transactional_content_crc64: Specify the transactional crc64 2986 for the body, to be validated by the service. 2987 :type transactional_content_crc64: bytearray 2988 :param request_id: Provides a client-generated, opaque value with a 1 2989 KB character limit that is recorded in the analytics logs when storage 2990 analytics logging is enabled. 2991 :type request_id: str 2992 :param tags: Blob tags 2993 :type tags: ~azure.storage.blob.models.BlobTags 2994 :param modified_access_conditions: Additional parameters for the 2995 operation 2996 :type modified_access_conditions: 2997 ~azure.storage.blob.models.ModifiedAccessConditions 2998 :param callable cls: A custom type or function that will be passed the 2999 direct response 3000 :return: None or the result of cls(response) 3001 :rtype: None 3002 :raises: 3003 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 3004 """ 3005 error_map = kwargs.pop('error_map', None) 3006 if_tags = None 3007 if modified_access_conditions is not None: 3008 if_tags = modified_access_conditions.if_tags 3009 3010 comp = "tags" 3011 3012 # Construct URL 3013 url = self.set_tags.metadata['url'] 3014 path_format_arguments = { 3015 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 3016 } 3017 url = self._client.format_url(url, **path_format_arguments) 3018 3019 # Construct parameters 3020 query_parameters = {} 3021 if timeout is not None: 3022 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 3023 if version_id is not None: 3024 query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') 3025 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 3026 3027 # Construct headers 3028 header_parameters = {} 3029 header_parameters['Content-Type'] = 'application/xml; charset=utf-8' 3030 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 3031 if transactional_content_md5 is not None: 3032 header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') 3033 if transactional_content_crc64 is not None: 3034 header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') 3035 if request_id is not None: 3036 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 3037 if if_tags is not None: 3038 header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str') 3039 3040 # Construct body 3041 if tags is not None: 3042 body_content = self._serialize.body(tags, 'BlobTags') 3043 else: 3044 body_content = None 3045 3046 # Construct and send request 3047 request = self._client.put(url, query_parameters, header_parameters, body_content) 3048 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 3049 response = pipeline_response.http_response 3050 3051 if response.status_code not in [204]: 3052 map_error(status_code=response.status_code, response=response, error_map=error_map) 3053 raise models.StorageErrorException(response, self._deserialize) 3054 3055 if cls: 3056 response_headers = { 3057 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 3058 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 3059 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 3060 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 3061 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 3062 } 3063 return cls(response, None, response_headers) 3064 set_tags.metadata = {'url': '/{containerName}/{blob}'} 3065