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, 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 timeout: The timeout parameter is expressed in seconds. For 56 more information, see <a 57 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 58 Timeouts for Blob Service Operations.</a> 59 :type timeout: int 60 :param range: Return only the bytes of the blob in the specified 61 range. 62 :type range: str 63 :param range_get_content_md5: When set to true and specified together 64 with the Range, the service returns the MD5 hash for the range, as 65 long as the range is less than or equal to 4 MB in size. 66 :type range_get_content_md5: bool 67 :param range_get_content_crc64: When set to true and specified 68 together with the Range, the service returns the CRC64 hash for the 69 range, as long as the range is less than or equal to 4 MB in size. 70 :type range_get_content_crc64: bool 71 :param request_id: Provides a client-generated, opaque value with a 1 72 KB character limit that is recorded in the analytics logs when storage 73 analytics logging is enabled. 74 :type request_id: str 75 :param lease_access_conditions: Additional parameters for the 76 operation 77 :type lease_access_conditions: 78 ~azure.storage.blob.models.LeaseAccessConditions 79 :param cpk_info: Additional parameters for the operation 80 :type cpk_info: ~azure.storage.blob.models.CpkInfo 81 :param modified_access_conditions: Additional parameters for the 82 operation 83 :type modified_access_conditions: 84 ~azure.storage.blob.models.ModifiedAccessConditions 85 :param callable cls: A custom type or function that will be passed the 86 direct response 87 :return: object or the result of cls(response) 88 :rtype: Generator 89 :raises: 90 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 91 """ 92 error_map = kwargs.pop('error_map', None) 93 lease_id = None 94 if lease_access_conditions is not None: 95 lease_id = lease_access_conditions.lease_id 96 encryption_key = None 97 if cpk_info is not None: 98 encryption_key = cpk_info.encryption_key 99 encryption_key_sha256 = None 100 if cpk_info is not None: 101 encryption_key_sha256 = cpk_info.encryption_key_sha256 102 encryption_algorithm = None 103 if cpk_info is not None: 104 encryption_algorithm = cpk_info.encryption_algorithm 105 if_modified_since = None 106 if modified_access_conditions is not None: 107 if_modified_since = modified_access_conditions.if_modified_since 108 if_unmodified_since = None 109 if modified_access_conditions is not None: 110 if_unmodified_since = modified_access_conditions.if_unmodified_since 111 if_match = None 112 if modified_access_conditions is not None: 113 if_match = modified_access_conditions.if_match 114 if_none_match = None 115 if modified_access_conditions is not None: 116 if_none_match = modified_access_conditions.if_none_match 117 118 # Construct URL 119 url = self.download.metadata['url'] 120 path_format_arguments = { 121 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 122 } 123 url = self._client.format_url(url, **path_format_arguments) 124 125 # Construct parameters 126 query_parameters = {} 127 if snapshot is not None: 128 query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') 129 if timeout is not None: 130 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 131 132 # Construct headers 133 header_parameters = {} 134 header_parameters['Accept'] = 'application/xml' 135 if range is not None: 136 header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') 137 if range_get_content_md5 is not None: 138 header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("range_get_content_md5", range_get_content_md5, 'bool') 139 if range_get_content_crc64 is not None: 140 header_parameters['x-ms-range-get-content-crc64'] = self._serialize.header("range_get_content_crc64", range_get_content_crc64, 'bool') 141 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 142 if request_id is not None: 143 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 144 if lease_id is not None: 145 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 146 if encryption_key is not None: 147 header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", encryption_key, 'str') 148 if encryption_key_sha256 is not None: 149 header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", encryption_key_sha256, 'str') 150 if encryption_algorithm is not None: 151 header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'EncryptionAlgorithmType') 152 if if_modified_since is not None: 153 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 154 if if_unmodified_since is not None: 155 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 156 if if_match is not None: 157 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 158 if if_none_match is not None: 159 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 160 161 # Construct and send request 162 request = self._client.get(url, query_parameters, header_parameters) 163 pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) 164 response = pipeline_response.http_response 165 166 if response.status_code not in [200, 206]: 167 await response.load_body() 168 map_error(status_code=response.status_code, response=response, error_map=error_map) 169 raise models.StorageErrorException(response, self._deserialize) 170 171 header_dict = {} 172 deserialized = None 173 if response.status_code == 200: 174 deserialized = response.stream_download(self._client._pipeline) 175 header_dict = { 176 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 177 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')), 178 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')), 179 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')), 180 'Content-Range': self._deserialize('str', response.headers.get('Content-Range')), 181 'ETag': self._deserialize('str', response.headers.get('ETag')), 182 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')), 183 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')), 184 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')), 185 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')), 186 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')), 187 'x-ms-blob-sequence-number': self._deserialize('long', response.headers.get('x-ms-blob-sequence-number')), 188 'x-ms-blob-type': self._deserialize(models.BlobType, response.headers.get('x-ms-blob-type')), 189 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')), 190 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')), 191 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 192 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')), 193 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')), 194 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')), 195 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')), 196 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')), 197 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')), 198 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 199 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 200 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 201 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')), 202 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 203 'x-ms-blob-committed-block-count': self._deserialize('int', response.headers.get('x-ms-blob-committed-block-count')), 204 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')), 205 'x-ms-encryption-key-sha256': self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')), 206 'x-ms-blob-content-md5': self._deserialize('bytearray', response.headers.get('x-ms-blob-content-md5')), 207 'x-ms-content-crc64': self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')), 208 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 209 } 210 if response.status_code == 206: 211 deserialized = response.stream_download(self._client._pipeline) 212 header_dict = { 213 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 214 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')), 215 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')), 216 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')), 217 'Content-Range': self._deserialize('str', response.headers.get('Content-Range')), 218 'ETag': self._deserialize('str', response.headers.get('ETag')), 219 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')), 220 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')), 221 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')), 222 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')), 223 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')), 224 'x-ms-blob-sequence-number': self._deserialize('long', response.headers.get('x-ms-blob-sequence-number')), 225 'x-ms-blob-type': self._deserialize(models.BlobType, response.headers.get('x-ms-blob-type')), 226 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')), 227 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')), 228 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 229 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')), 230 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')), 231 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')), 232 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')), 233 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')), 234 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')), 235 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 236 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 237 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 238 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')), 239 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 240 'x-ms-blob-committed-block-count': self._deserialize('int', response.headers.get('x-ms-blob-committed-block-count')), 241 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')), 242 'x-ms-encryption-key-sha256': self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')), 243 'x-ms-blob-content-md5': self._deserialize('bytearray', response.headers.get('x-ms-blob-content-md5')), 244 'x-ms-content-crc64': self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')), 245 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 246 } 247 248 if cls: 249 return cls(response, deserialized, header_dict) 250 251 return deserialized 252 download.metadata = {'url': '/{containerName}/{blob}'} 253 254 async def get_properties(self, snapshot=None, timeout=None, request_id=None, lease_access_conditions=None, cpk_info=None, modified_access_conditions=None, *, cls=None, **kwargs): 255 """The Get Properties operation returns all user-defined metadata, 256 standard HTTP properties, and system properties for the blob. It does 257 not return the content of the blob. 258 259 :param snapshot: The snapshot parameter is an opaque DateTime value 260 that, when present, specifies the blob snapshot to retrieve. For more 261 information on working with blob snapshots, see <a 262 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating 263 a Snapshot of a Blob.</a> 264 :type snapshot: str 265 :param timeout: The timeout parameter is expressed in seconds. For 266 more information, see <a 267 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 268 Timeouts for Blob Service Operations.</a> 269 :type timeout: int 270 :param request_id: Provides a client-generated, opaque value with a 1 271 KB character limit that is recorded in the analytics logs when storage 272 analytics logging is enabled. 273 :type request_id: str 274 :param lease_access_conditions: Additional parameters for the 275 operation 276 :type lease_access_conditions: 277 ~azure.storage.blob.models.LeaseAccessConditions 278 :param cpk_info: Additional parameters for the operation 279 :type cpk_info: ~azure.storage.blob.models.CpkInfo 280 :param modified_access_conditions: Additional parameters for the 281 operation 282 :type modified_access_conditions: 283 ~azure.storage.blob.models.ModifiedAccessConditions 284 :param callable cls: A custom type or function that will be passed the 285 direct response 286 :return: None or the result of cls(response) 287 :rtype: None 288 :raises: 289 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 290 """ 291 error_map = kwargs.pop('error_map', None) 292 lease_id = None 293 if lease_access_conditions is not None: 294 lease_id = lease_access_conditions.lease_id 295 encryption_key = None 296 if cpk_info is not None: 297 encryption_key = cpk_info.encryption_key 298 encryption_key_sha256 = None 299 if cpk_info is not None: 300 encryption_key_sha256 = cpk_info.encryption_key_sha256 301 encryption_algorithm = None 302 if cpk_info is not None: 303 encryption_algorithm = cpk_info.encryption_algorithm 304 if_modified_since = None 305 if modified_access_conditions is not None: 306 if_modified_since = modified_access_conditions.if_modified_since 307 if_unmodified_since = None 308 if modified_access_conditions is not None: 309 if_unmodified_since = modified_access_conditions.if_unmodified_since 310 if_match = None 311 if modified_access_conditions is not None: 312 if_match = modified_access_conditions.if_match 313 if_none_match = None 314 if modified_access_conditions is not None: 315 if_none_match = modified_access_conditions.if_none_match 316 317 # Construct URL 318 url = self.get_properties.metadata['url'] 319 path_format_arguments = { 320 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 321 } 322 url = self._client.format_url(url, **path_format_arguments) 323 324 # Construct parameters 325 query_parameters = {} 326 if snapshot is not None: 327 query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') 328 if timeout is not None: 329 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 330 331 # Construct headers 332 header_parameters = {} 333 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 334 if request_id is not None: 335 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 336 if lease_id is not None: 337 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 338 if encryption_key is not None: 339 header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", encryption_key, 'str') 340 if encryption_key_sha256 is not None: 341 header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", encryption_key_sha256, 'str') 342 if encryption_algorithm is not None: 343 header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'EncryptionAlgorithmType') 344 if if_modified_since is not None: 345 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 346 if if_unmodified_since is not None: 347 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 348 if if_match is not None: 349 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 350 if if_none_match is not None: 351 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 352 353 # Construct and send request 354 request = self._client.head(url, query_parameters, header_parameters) 355 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 356 response = pipeline_response.http_response 357 358 if response.status_code not in [200]: 359 map_error(status_code=response.status_code, response=response, error_map=error_map) 360 raise models.StorageErrorException(response, self._deserialize) 361 362 if cls: 363 response_headers = { 364 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 365 'x-ms-creation-time': self._deserialize('rfc-1123', response.headers.get('x-ms-creation-time')), 366 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')), 367 'x-ms-blob-type': self._deserialize(models.BlobType, response.headers.get('x-ms-blob-type')), 368 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')), 369 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')), 370 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 371 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')), 372 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')), 373 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')), 374 'x-ms-incremental-copy': self._deserialize('bool', response.headers.get('x-ms-incremental-copy')), 375 'x-ms-copy-destination-snapshot': self._deserialize('str', response.headers.get('x-ms-copy-destination-snapshot')), 376 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')), 377 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')), 378 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')), 379 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')), 380 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')), 381 'ETag': self._deserialize('str', response.headers.get('ETag')), 382 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')), 383 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')), 384 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')), 385 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')), 386 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')), 387 'x-ms-blob-sequence-number': self._deserialize('long', response.headers.get('x-ms-blob-sequence-number')), 388 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 389 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 390 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 391 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 392 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')), 393 'x-ms-blob-committed-block-count': self._deserialize('int', response.headers.get('x-ms-blob-committed-block-count')), 394 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')), 395 'x-ms-encryption-key-sha256': self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')), 396 'x-ms-access-tier': self._deserialize('str', response.headers.get('x-ms-access-tier')), 397 'x-ms-access-tier-inferred': self._deserialize('bool', response.headers.get('x-ms-access-tier-inferred')), 398 'x-ms-archive-status': self._deserialize('str', response.headers.get('x-ms-archive-status')), 399 'x-ms-access-tier-change-time': self._deserialize('rfc-1123', response.headers.get('x-ms-access-tier-change-time')), 400 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 401 } 402 return cls(response, None, response_headers) 403 get_properties.metadata = {'url': '/{containerName}/{blob}'} 404 405 async def delete(self, snapshot=None, timeout=None, delete_snapshots=None, request_id=None, lease_access_conditions=None, modified_access_conditions=None, *, cls=None, **kwargs): 406 """If the storage account's soft delete feature is disabled then, when a 407 blob is deleted, it is permanently removed from the storage account. If 408 the storage account's soft delete feature is enabled, then, when a blob 409 is deleted, it is marked for deletion and becomes inaccessible 410 immediately. However, the blob service retains the blob or snapshot for 411 the number of days specified by the DeleteRetentionPolicy section of 412 [Storage service properties] (Set-Blob-Service-Properties.md). After 413 the specified number of days has passed, the blob's data is permanently 414 removed from the storage account. Note that you continue to be charged 415 for the soft-deleted blob's storage until it is permanently removed. 416 Use the List Blobs API and specify the "include=deleted" query 417 parameter to discover which blobs and snapshots have been soft deleted. 418 You can then use the Undelete Blob API to restore a soft-deleted blob. 419 All other operations on a soft-deleted blob or snapshot causes the 420 service to return an HTTP status code of 404 (ResourceNotFound). 421 422 :param snapshot: The snapshot parameter is an opaque DateTime value 423 that, when present, specifies the blob snapshot to retrieve. For more 424 information on working with blob snapshots, see <a 425 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating 426 a Snapshot of a Blob.</a> 427 :type snapshot: str 428 :param timeout: The timeout parameter is expressed in seconds. For 429 more information, see <a 430 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 431 Timeouts for Blob Service Operations.</a> 432 :type timeout: int 433 :param delete_snapshots: Required if the blob has associated 434 snapshots. Specify one of the following two options: include: Delete 435 the base blob and all of its snapshots. only: Delete only the blob's 436 snapshots and not the blob itself. Possible values include: 'include', 437 'only' 438 :type delete_snapshots: str or 439 ~azure.storage.blob.models.DeleteSnapshotsOptionType 440 :param request_id: Provides a client-generated, opaque value with a 1 441 KB character limit that is recorded in the analytics logs when storage 442 analytics logging is enabled. 443 :type request_id: str 444 :param lease_access_conditions: Additional parameters for the 445 operation 446 :type lease_access_conditions: 447 ~azure.storage.blob.models.LeaseAccessConditions 448 :param modified_access_conditions: Additional parameters for the 449 operation 450 :type modified_access_conditions: 451 ~azure.storage.blob.models.ModifiedAccessConditions 452 :param callable cls: A custom type or function that will be passed the 453 direct response 454 :return: None or the result of cls(response) 455 :rtype: None 456 :raises: 457 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 458 """ 459 error_map = kwargs.pop('error_map', None) 460 lease_id = None 461 if lease_access_conditions is not None: 462 lease_id = lease_access_conditions.lease_id 463 if_modified_since = None 464 if modified_access_conditions is not None: 465 if_modified_since = modified_access_conditions.if_modified_since 466 if_unmodified_since = None 467 if modified_access_conditions is not None: 468 if_unmodified_since = modified_access_conditions.if_unmodified_since 469 if_match = None 470 if modified_access_conditions is not None: 471 if_match = modified_access_conditions.if_match 472 if_none_match = None 473 if modified_access_conditions is not None: 474 if_none_match = modified_access_conditions.if_none_match 475 476 # Construct URL 477 url = self.delete.metadata['url'] 478 path_format_arguments = { 479 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 480 } 481 url = self._client.format_url(url, **path_format_arguments) 482 483 # Construct parameters 484 query_parameters = {} 485 if snapshot is not None: 486 query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') 487 if timeout is not None: 488 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 489 490 # Construct headers 491 header_parameters = {} 492 if delete_snapshots is not None: 493 header_parameters['x-ms-delete-snapshots'] = self._serialize.header("delete_snapshots", delete_snapshots, 'DeleteSnapshotsOptionType') 494 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 495 if request_id is not None: 496 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 497 if lease_id is not None: 498 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 499 if if_modified_since is not None: 500 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 501 if if_unmodified_since is not None: 502 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 503 if if_match is not None: 504 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 505 if if_none_match is not None: 506 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 507 508 # Construct and send request 509 request = self._client.delete(url, query_parameters, header_parameters) 510 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 511 response = pipeline_response.http_response 512 513 if response.status_code not in [202]: 514 map_error(status_code=response.status_code, response=response, error_map=error_map) 515 raise models.StorageErrorException(response, self._deserialize) 516 517 if cls: 518 response_headers = { 519 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 520 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 521 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 522 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 523 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 524 } 525 return cls(response, None, response_headers) 526 delete.metadata = {'url': '/{containerName}/{blob}'} 527 528 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): 529 """Set the owner, group, permissions, or access control list for a blob. 530 531 :param timeout: The timeout parameter is expressed in seconds. For 532 more information, see <a 533 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 534 Timeouts for Blob Service Operations.</a> 535 :type timeout: int 536 :param owner: Optional. The owner of the blob or directory. 537 :type owner: str 538 :param group: Optional. The owning group of the blob or directory. 539 :type group: str 540 :param posix_permissions: Optional and only valid if Hierarchical 541 Namespace is enabled for the account. Sets POSIX access permissions 542 for the file owner, the file owning group, and others. Each class may 543 be granted read, write, or execute permission. The sticky bit is also 544 supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 545 0766) are supported. 546 :type posix_permissions: str 547 :param posix_acl: Sets POSIX access control rights on files and 548 directories. The value is a comma-separated list of access control 549 entries. Each access control entry (ACE) consists of a scope, a type, 550 a user or group identifier, and permissions in the format 551 "[scope:][type]:[id]:[permissions]". 552 :type posix_acl: str 553 :param request_id: Provides a client-generated, opaque value with a 1 554 KB character limit that is recorded in the analytics logs when storage 555 analytics logging is enabled. 556 :type request_id: str 557 :param lease_access_conditions: Additional parameters for the 558 operation 559 :type lease_access_conditions: 560 ~azure.storage.blob.models.LeaseAccessConditions 561 :param modified_access_conditions: Additional parameters for the 562 operation 563 :type modified_access_conditions: 564 ~azure.storage.blob.models.ModifiedAccessConditions 565 :param callable cls: A custom type or function that will be passed the 566 direct response 567 :return: None or the result of cls(response) 568 :rtype: None 569 :raises: 570 :class:`DataLakeStorageErrorException<azure.storage.blob.models.DataLakeStorageErrorException>` 571 """ 572 error_map = kwargs.pop('error_map', None) 573 lease_id = None 574 if lease_access_conditions is not None: 575 lease_id = lease_access_conditions.lease_id 576 if_match = None 577 if modified_access_conditions is not None: 578 if_match = modified_access_conditions.if_match 579 if_none_match = None 580 if modified_access_conditions is not None: 581 if_none_match = modified_access_conditions.if_none_match 582 if_modified_since = None 583 if modified_access_conditions is not None: 584 if_modified_since = modified_access_conditions.if_modified_since 585 if_unmodified_since = None 586 if modified_access_conditions is not None: 587 if_unmodified_since = modified_access_conditions.if_unmodified_since 588 589 action = "setAccessControl" 590 591 # Construct URL 592 url = self.set_access_control.metadata['url'] 593 path_format_arguments = { 594 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 595 } 596 url = self._client.format_url(url, **path_format_arguments) 597 598 # Construct parameters 599 query_parameters = {} 600 if timeout is not None: 601 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 602 query_parameters['action'] = self._serialize.query("action", action, 'str') 603 604 # Construct headers 605 header_parameters = {} 606 if owner is not None: 607 header_parameters['x-ms-owner'] = self._serialize.header("owner", owner, 'str') 608 if group is not None: 609 header_parameters['x-ms-group'] = self._serialize.header("group", group, 'str') 610 if posix_permissions is not None: 611 header_parameters['x-ms-permissions'] = self._serialize.header("posix_permissions", posix_permissions, 'str') 612 if posix_acl is not None: 613 header_parameters['x-ms-acl'] = self._serialize.header("posix_acl", posix_acl, 'str') 614 if request_id is not None: 615 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 616 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 617 if lease_id is not None: 618 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 619 if if_match is not None: 620 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 621 if if_none_match is not None: 622 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 623 if if_modified_since is not None: 624 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 625 if if_unmodified_since is not None: 626 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 627 628 # Construct and send request 629 request = self._client.patch(url, query_parameters, header_parameters) 630 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 631 response = pipeline_response.http_response 632 633 if response.status_code not in [200]: 634 map_error(status_code=response.status_code, response=response, error_map=error_map) 635 raise models.DataLakeStorageErrorException(response, self._deserialize) 636 637 if cls: 638 response_headers = { 639 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 640 'ETag': self._deserialize('str', response.headers.get('ETag')), 641 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 642 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 643 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 644 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 645 } 646 return cls(response, None, response_headers) 647 set_access_control.metadata = {'url': '/{filesystem}/{path}'} 648 649 async def get_access_control(self, timeout=None, upn=None, request_id=None, lease_access_conditions=None, modified_access_conditions=None, *, cls=None, **kwargs): 650 """Get the owner, group, permissions, or access control list for a blob. 651 652 :param timeout: The timeout parameter is expressed in seconds. For 653 more information, see <a 654 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 655 Timeouts for Blob Service Operations.</a> 656 :type timeout: int 657 :param upn: Optional. Valid only when Hierarchical Namespace is 658 enabled for the account. If "true", the identity values returned in 659 the x-ms-owner, x-ms-group, and x-ms-acl response headers will be 660 transformed from Azure Active Directory Object IDs to User Principal 661 Names. If "false", the values will be returned as Azure Active 662 Directory Object IDs. The default value is false. 663 :type upn: bool 664 :param request_id: Provides a client-generated, opaque value with a 1 665 KB character limit that is recorded in the analytics logs when storage 666 analytics logging is enabled. 667 :type request_id: str 668 :param lease_access_conditions: Additional parameters for the 669 operation 670 :type lease_access_conditions: 671 ~azure.storage.blob.models.LeaseAccessConditions 672 :param modified_access_conditions: Additional parameters for the 673 operation 674 :type modified_access_conditions: 675 ~azure.storage.blob.models.ModifiedAccessConditions 676 :param callable cls: A custom type or function that will be passed the 677 direct response 678 :return: None or the result of cls(response) 679 :rtype: None 680 :raises: 681 :class:`DataLakeStorageErrorException<azure.storage.blob.models.DataLakeStorageErrorException>` 682 """ 683 error_map = kwargs.pop('error_map', None) 684 lease_id = None 685 if lease_access_conditions is not None: 686 lease_id = lease_access_conditions.lease_id 687 if_match = None 688 if modified_access_conditions is not None: 689 if_match = modified_access_conditions.if_match 690 if_none_match = None 691 if modified_access_conditions is not None: 692 if_none_match = modified_access_conditions.if_none_match 693 if_modified_since = None 694 if modified_access_conditions is not None: 695 if_modified_since = modified_access_conditions.if_modified_since 696 if_unmodified_since = None 697 if modified_access_conditions is not None: 698 if_unmodified_since = modified_access_conditions.if_unmodified_since 699 700 action = "getAccessControl" 701 702 # Construct URL 703 url = self.get_access_control.metadata['url'] 704 path_format_arguments = { 705 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 706 } 707 url = self._client.format_url(url, **path_format_arguments) 708 709 # Construct parameters 710 query_parameters = {} 711 if timeout is not None: 712 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 713 if upn is not None: 714 query_parameters['upn'] = self._serialize.query("upn", upn, 'bool') 715 query_parameters['action'] = self._serialize.query("action", action, 'str') 716 717 # Construct headers 718 header_parameters = {} 719 if request_id is not None: 720 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 721 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 722 if lease_id is not None: 723 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 724 if if_match is not None: 725 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 726 if if_none_match is not None: 727 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 728 if if_modified_since is not None: 729 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 730 if if_unmodified_since is not None: 731 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 732 733 # Construct and send request 734 request = self._client.head(url, query_parameters, header_parameters) 735 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 736 response = pipeline_response.http_response 737 738 if response.status_code not in [200]: 739 map_error(status_code=response.status_code, response=response, error_map=error_map) 740 raise models.DataLakeStorageErrorException(response, self._deserialize) 741 742 if cls: 743 response_headers = { 744 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 745 'ETag': self._deserialize('str', response.headers.get('ETag')), 746 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 747 'x-ms-owner': self._deserialize('str', response.headers.get('x-ms-owner')), 748 'x-ms-group': self._deserialize('str', response.headers.get('x-ms-group')), 749 'x-ms-permissions': self._deserialize('str', response.headers.get('x-ms-permissions')), 750 'x-ms-acl': self._deserialize('str', response.headers.get('x-ms-acl')), 751 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 752 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 753 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 754 } 755 return cls(response, None, response_headers) 756 get_access_control.metadata = {'url': '/{filesystem}/{path}'} 757 758 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): 759 """Rename a blob/file. By default, the destination is overwritten and if 760 the destination already exists and has a lease the lease is broken. 761 This operation supports conditional HTTP requests. For more 762 information, see [Specifying Conditional Headers for Blob Service 763 Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). 764 To fail if the destination already exists, use a conditional request 765 with If-None-Match: "*". 766 767 :param rename_source: The file or directory to be renamed. The value 768 must have the following format: "/{filesysystem}/{path}". If 769 "x-ms-properties" is specified, the properties will overwrite the 770 existing properties; otherwise, the existing properties will be 771 preserved. 772 :type rename_source: str 773 :param timeout: The timeout parameter is expressed in seconds. For 774 more information, see <a 775 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 776 Timeouts for Blob Service Operations.</a> 777 :type timeout: int 778 :param path_rename_mode: Determines the behavior of the rename 779 operation. Possible values include: 'legacy', 'posix' 780 :type path_rename_mode: str or 781 ~azure.storage.blob.models.PathRenameMode 782 :param directory_properties: Optional. User-defined properties to be 783 stored with the file or directory, in the format of a comma-separated 784 list of name and value pairs "n1=v1, n2=v2, ...", where each value is 785 base64 encoded. 786 :type directory_properties: str 787 :param posix_permissions: Optional and only valid if Hierarchical 788 Namespace is enabled for the account. Sets POSIX access permissions 789 for the file owner, the file owning group, and others. Each class may 790 be granted read, write, or execute permission. The sticky bit is also 791 supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 792 0766) are supported. 793 :type posix_permissions: str 794 :param posix_umask: Only valid if Hierarchical Namespace is enabled 795 for the account. This umask restricts permission settings for file and 796 directory, and will only be applied when default Acl does not exist in 797 parent directory. If the umask bit has set, it means that the 798 corresponding permission will be disabled. Otherwise the corresponding 799 permission will be determined by the permission. A 4-digit octal 800 notation (e.g. 0022) is supported here. If no umask was specified, a 801 default umask - 0027 will be used. 802 :type posix_umask: str 803 :param source_lease_id: A lease ID for the source path. If specified, 804 the source path must have an active lease and the leaase ID must 805 match. 806 :type source_lease_id: str 807 :param request_id: Provides a client-generated, opaque value with a 1 808 KB character limit that is recorded in the analytics logs when storage 809 analytics logging is enabled. 810 :type request_id: str 811 :param directory_http_headers: Additional parameters for the operation 812 :type directory_http_headers: 813 ~azure.storage.blob.models.DirectoryHttpHeaders 814 :param lease_access_conditions: Additional parameters for the 815 operation 816 :type lease_access_conditions: 817 ~azure.storage.blob.models.LeaseAccessConditions 818 :param modified_access_conditions: Additional parameters for the 819 operation 820 :type modified_access_conditions: 821 ~azure.storage.blob.models.ModifiedAccessConditions 822 :param source_modified_access_conditions: Additional parameters for 823 the operation 824 :type source_modified_access_conditions: 825 ~azure.storage.blob.models.SourceModifiedAccessConditions 826 :param callable cls: A custom type or function that will be passed the 827 direct response 828 :return: None or the result of cls(response) 829 :rtype: None 830 :raises: 831 :class:`DataLakeStorageErrorException<azure.storage.blob.models.DataLakeStorageErrorException>` 832 """ 833 error_map = kwargs.pop('error_map', None) 834 cache_control = None 835 if directory_http_headers is not None: 836 cache_control = directory_http_headers.cache_control 837 content_type = None 838 if directory_http_headers is not None: 839 content_type = directory_http_headers.content_type 840 content_encoding = None 841 if directory_http_headers is not None: 842 content_encoding = directory_http_headers.content_encoding 843 content_language = None 844 if directory_http_headers is not None: 845 content_language = directory_http_headers.content_language 846 content_disposition = None 847 if directory_http_headers is not None: 848 content_disposition = directory_http_headers.content_disposition 849 lease_id = None 850 if lease_access_conditions is not None: 851 lease_id = lease_access_conditions.lease_id 852 if_modified_since = None 853 if modified_access_conditions is not None: 854 if_modified_since = modified_access_conditions.if_modified_since 855 if_unmodified_since = None 856 if modified_access_conditions is not None: 857 if_unmodified_since = modified_access_conditions.if_unmodified_since 858 if_match = None 859 if modified_access_conditions is not None: 860 if_match = modified_access_conditions.if_match 861 if_none_match = None 862 if modified_access_conditions is not None: 863 if_none_match = modified_access_conditions.if_none_match 864 source_if_modified_since = None 865 if source_modified_access_conditions is not None: 866 source_if_modified_since = source_modified_access_conditions.source_if_modified_since 867 source_if_unmodified_since = None 868 if source_modified_access_conditions is not None: 869 source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since 870 source_if_match = None 871 if source_modified_access_conditions is not None: 872 source_if_match = source_modified_access_conditions.source_if_match 873 source_if_none_match = None 874 if source_modified_access_conditions is not None: 875 source_if_none_match = source_modified_access_conditions.source_if_none_match 876 877 # Construct URL 878 url = self.rename.metadata['url'] 879 path_format_arguments = { 880 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 881 } 882 url = self._client.format_url(url, **path_format_arguments) 883 884 # Construct parameters 885 query_parameters = {} 886 if timeout is not None: 887 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 888 if path_rename_mode is not None: 889 query_parameters['mode'] = self._serialize.query("path_rename_mode", path_rename_mode, 'PathRenameMode') 890 891 # Construct headers 892 header_parameters = {} 893 header_parameters['x-ms-rename-source'] = self._serialize.header("rename_source", rename_source, 'str') 894 if directory_properties is not None: 895 header_parameters['x-ms-properties'] = self._serialize.header("directory_properties", directory_properties, 'str') 896 if posix_permissions is not None: 897 header_parameters['x-ms-permissions'] = self._serialize.header("posix_permissions", posix_permissions, 'str') 898 if posix_umask is not None: 899 header_parameters['x-ms-umask'] = self._serialize.header("posix_umask", posix_umask, 'str') 900 if source_lease_id is not None: 901 header_parameters['x-ms-source-lease-id'] = self._serialize.header("source_lease_id", source_lease_id, 'str') 902 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 903 if request_id is not None: 904 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 905 if cache_control is not None: 906 header_parameters['x-ms-cache-control'] = self._serialize.header("cache_control", cache_control, 'str') 907 if content_type is not None: 908 header_parameters['x-ms-content-type'] = self._serialize.header("content_type", content_type, 'str') 909 if content_encoding is not None: 910 header_parameters['x-ms-content-encoding'] = self._serialize.header("content_encoding", content_encoding, 'str') 911 if content_language is not None: 912 header_parameters['x-ms-content-language'] = self._serialize.header("content_language", content_language, 'str') 913 if content_disposition is not None: 914 header_parameters['x-ms-content-disposition'] = self._serialize.header("content_disposition", content_disposition, 'str') 915 if lease_id is not None: 916 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 917 if if_modified_since is not None: 918 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 919 if if_unmodified_since is not None: 920 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 921 if if_match is not None: 922 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 923 if if_none_match is not None: 924 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 925 if source_if_modified_since is not None: 926 header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') 927 if source_if_unmodified_since is not None: 928 header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') 929 if source_if_match is not None: 930 header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", source_if_match, 'str') 931 if source_if_none_match is not None: 932 header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", source_if_none_match, 'str') 933 934 # Construct and send request 935 request = self._client.put(url, query_parameters, header_parameters) 936 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 937 response = pipeline_response.http_response 938 939 if response.status_code not in [201]: 940 map_error(status_code=response.status_code, response=response, error_map=error_map) 941 raise models.DataLakeStorageErrorException(response, self._deserialize) 942 943 if cls: 944 response_headers = { 945 'ETag': self._deserialize('str', response.headers.get('ETag')), 946 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 947 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 948 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 949 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 950 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')), 951 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 952 } 953 return cls(response, None, response_headers) 954 rename.metadata = {'url': '/{filesystem}/{path}'} 955 956 async def undelete(self, timeout=None, request_id=None, *, cls=None, **kwargs): 957 """Undelete a blob that was previously soft deleted. 958 959 :param timeout: The timeout parameter is expressed in seconds. For 960 more information, see <a 961 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 962 Timeouts for Blob Service Operations.</a> 963 :type timeout: int 964 :param request_id: Provides a client-generated, opaque value with a 1 965 KB character limit that is recorded in the analytics logs when storage 966 analytics logging is enabled. 967 :type request_id: str 968 :param callable cls: A custom type or function that will be passed the 969 direct response 970 :return: None or the result of cls(response) 971 :rtype: None 972 :raises: 973 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 974 """ 975 error_map = kwargs.pop('error_map', None) 976 comp = "undelete" 977 978 # Construct URL 979 url = self.undelete.metadata['url'] 980 path_format_arguments = { 981 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 982 } 983 url = self._client.format_url(url, **path_format_arguments) 984 985 # Construct parameters 986 query_parameters = {} 987 if timeout is not None: 988 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 989 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 990 991 # Construct headers 992 header_parameters = {} 993 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 994 if request_id is not None: 995 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 996 997 # Construct and send request 998 request = self._client.put(url, query_parameters, header_parameters) 999 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1000 response = pipeline_response.http_response 1001 1002 if response.status_code not in [200]: 1003 map_error(status_code=response.status_code, response=response, error_map=error_map) 1004 raise models.StorageErrorException(response, self._deserialize) 1005 1006 if cls: 1007 response_headers = { 1008 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1009 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1010 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1011 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1012 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1013 } 1014 return cls(response, None, response_headers) 1015 undelete.metadata = {'url': '/{containerName}/{blob}'} 1016 1017 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): 1018 """The Set HTTP Headers operation sets system properties on the blob. 1019 1020 :param timeout: The timeout parameter is expressed in seconds. For 1021 more information, see <a 1022 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1023 Timeouts for Blob Service Operations.</a> 1024 :type timeout: int 1025 :param request_id: Provides a client-generated, opaque value with a 1 1026 KB character limit that is recorded in the analytics logs when storage 1027 analytics logging is enabled. 1028 :type request_id: str 1029 :param blob_http_headers: Additional parameters for the operation 1030 :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders 1031 :param lease_access_conditions: Additional parameters for the 1032 operation 1033 :type lease_access_conditions: 1034 ~azure.storage.blob.models.LeaseAccessConditions 1035 :param modified_access_conditions: Additional parameters for the 1036 operation 1037 :type modified_access_conditions: 1038 ~azure.storage.blob.models.ModifiedAccessConditions 1039 :param callable cls: A custom type or function that will be passed the 1040 direct response 1041 :return: None or the result of cls(response) 1042 :rtype: None 1043 :raises: 1044 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1045 """ 1046 error_map = kwargs.pop('error_map', None) 1047 blob_cache_control = None 1048 if blob_http_headers is not None: 1049 blob_cache_control = blob_http_headers.blob_cache_control 1050 blob_content_type = None 1051 if blob_http_headers is not None: 1052 blob_content_type = blob_http_headers.blob_content_type 1053 blob_content_md5 = None 1054 if blob_http_headers is not None: 1055 blob_content_md5 = blob_http_headers.blob_content_md5 1056 blob_content_encoding = None 1057 if blob_http_headers is not None: 1058 blob_content_encoding = blob_http_headers.blob_content_encoding 1059 blob_content_language = None 1060 if blob_http_headers is not None: 1061 blob_content_language = blob_http_headers.blob_content_language 1062 blob_content_disposition = None 1063 if blob_http_headers is not None: 1064 blob_content_disposition = blob_http_headers.blob_content_disposition 1065 lease_id = None 1066 if lease_access_conditions is not None: 1067 lease_id = lease_access_conditions.lease_id 1068 if_modified_since = None 1069 if modified_access_conditions is not None: 1070 if_modified_since = modified_access_conditions.if_modified_since 1071 if_unmodified_since = None 1072 if modified_access_conditions is not None: 1073 if_unmodified_since = modified_access_conditions.if_unmodified_since 1074 if_match = None 1075 if modified_access_conditions is not None: 1076 if_match = modified_access_conditions.if_match 1077 if_none_match = None 1078 if modified_access_conditions is not None: 1079 if_none_match = modified_access_conditions.if_none_match 1080 1081 comp = "properties" 1082 1083 # Construct URL 1084 url = self.set_http_headers.metadata['url'] 1085 path_format_arguments = { 1086 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1087 } 1088 url = self._client.format_url(url, **path_format_arguments) 1089 1090 # Construct parameters 1091 query_parameters = {} 1092 if timeout is not None: 1093 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1094 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1095 1096 # Construct headers 1097 header_parameters = {} 1098 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1099 if request_id is not None: 1100 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1101 if blob_cache_control is not None: 1102 header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", blob_cache_control, 'str') 1103 if blob_content_type is not None: 1104 header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", blob_content_type, 'str') 1105 if blob_content_md5 is not None: 1106 header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", blob_content_md5, 'bytearray') 1107 if blob_content_encoding is not None: 1108 header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", blob_content_encoding, 'str') 1109 if blob_content_language is not None: 1110 header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", blob_content_language, 'str') 1111 if blob_content_disposition is not None: 1112 header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", blob_content_disposition, 'str') 1113 if lease_id is not None: 1114 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1115 if if_modified_since is not None: 1116 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1117 if if_unmodified_since is not None: 1118 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1119 if if_match is not None: 1120 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1121 if if_none_match is not None: 1122 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1123 1124 # Construct and send request 1125 request = self._client.put(url, query_parameters, header_parameters) 1126 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1127 response = pipeline_response.http_response 1128 1129 if response.status_code not in [200]: 1130 map_error(status_code=response.status_code, response=response, error_map=error_map) 1131 raise models.StorageErrorException(response, self._deserialize) 1132 1133 if cls: 1134 response_headers = { 1135 'ETag': self._deserialize('str', response.headers.get('ETag')), 1136 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1137 'x-ms-blob-sequence-number': self._deserialize('long', response.headers.get('x-ms-blob-sequence-number')), 1138 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1139 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1140 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1141 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1142 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1143 } 1144 return cls(response, None, response_headers) 1145 set_http_headers.metadata = {'url': '/{containerName}/{blob}'} 1146 1147 async def set_metadata(self, timeout=None, metadata=None, request_id=None, lease_access_conditions=None, cpk_info=None, modified_access_conditions=None, *, cls=None, **kwargs): 1148 """The Set Blob Metadata operation sets user-defined metadata for the 1149 specified blob as one or more name-value pairs. 1150 1151 :param timeout: The timeout parameter is expressed in seconds. For 1152 more information, see <a 1153 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1154 Timeouts for Blob Service Operations.</a> 1155 :type timeout: int 1156 :param metadata: Optional. Specifies a user-defined name-value pair 1157 associated with the blob. If no name-value pairs are specified, the 1158 operation will copy the metadata from the source blob or file to the 1159 destination blob. If one or more name-value pairs are specified, the 1160 destination blob is created with the specified metadata, and metadata 1161 is not copied from the source blob or file. Note that beginning with 1162 version 2009-09-19, metadata names must adhere to the naming rules for 1163 C# identifiers. See Naming and Referencing Containers, Blobs, and 1164 Metadata for more information. 1165 :type metadata: str 1166 :param request_id: Provides a client-generated, opaque value with a 1 1167 KB character limit that is recorded in the analytics logs when storage 1168 analytics logging is enabled. 1169 :type request_id: str 1170 :param lease_access_conditions: Additional parameters for the 1171 operation 1172 :type lease_access_conditions: 1173 ~azure.storage.blob.models.LeaseAccessConditions 1174 :param cpk_info: Additional parameters for the operation 1175 :type cpk_info: ~azure.storage.blob.models.CpkInfo 1176 :param modified_access_conditions: Additional parameters for the 1177 operation 1178 :type modified_access_conditions: 1179 ~azure.storage.blob.models.ModifiedAccessConditions 1180 :param callable cls: A custom type or function that will be passed the 1181 direct response 1182 :return: None or the result of cls(response) 1183 :rtype: None 1184 :raises: 1185 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1186 """ 1187 error_map = kwargs.pop('error_map', None) 1188 lease_id = None 1189 if lease_access_conditions is not None: 1190 lease_id = lease_access_conditions.lease_id 1191 encryption_key = None 1192 if cpk_info is not None: 1193 encryption_key = cpk_info.encryption_key 1194 encryption_key_sha256 = None 1195 if cpk_info is not None: 1196 encryption_key_sha256 = cpk_info.encryption_key_sha256 1197 encryption_algorithm = None 1198 if cpk_info is not None: 1199 encryption_algorithm = cpk_info.encryption_algorithm 1200 if_modified_since = None 1201 if modified_access_conditions is not None: 1202 if_modified_since = modified_access_conditions.if_modified_since 1203 if_unmodified_since = None 1204 if modified_access_conditions is not None: 1205 if_unmodified_since = modified_access_conditions.if_unmodified_since 1206 if_match = None 1207 if modified_access_conditions is not None: 1208 if_match = modified_access_conditions.if_match 1209 if_none_match = None 1210 if modified_access_conditions is not None: 1211 if_none_match = modified_access_conditions.if_none_match 1212 1213 comp = "metadata" 1214 1215 # Construct URL 1216 url = self.set_metadata.metadata['url'] 1217 path_format_arguments = { 1218 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1219 } 1220 url = self._client.format_url(url, **path_format_arguments) 1221 1222 # Construct parameters 1223 query_parameters = {} 1224 if timeout is not None: 1225 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1226 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1227 1228 # Construct headers 1229 header_parameters = {} 1230 if metadata is not None: 1231 header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') 1232 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1233 if request_id is not None: 1234 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1235 if lease_id is not None: 1236 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1237 if encryption_key is not None: 1238 header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", encryption_key, 'str') 1239 if encryption_key_sha256 is not None: 1240 header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", encryption_key_sha256, 'str') 1241 if encryption_algorithm is not None: 1242 header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'EncryptionAlgorithmType') 1243 if if_modified_since is not None: 1244 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1245 if if_unmodified_since is not None: 1246 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1247 if if_match is not None: 1248 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1249 if if_none_match is not None: 1250 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1251 1252 # Construct and send request 1253 request = self._client.put(url, query_parameters, header_parameters) 1254 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1255 response = pipeline_response.http_response 1256 1257 if response.status_code not in [200]: 1258 map_error(status_code=response.status_code, response=response, error_map=error_map) 1259 raise models.StorageErrorException(response, self._deserialize) 1260 1261 if cls: 1262 response_headers = { 1263 'ETag': self._deserialize('str', response.headers.get('ETag')), 1264 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1265 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1266 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1267 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1268 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1269 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')), 1270 'x-ms-encryption-key-sha256': self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')), 1271 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1272 } 1273 return cls(response, None, response_headers) 1274 set_metadata.metadata = {'url': '/{containerName}/{blob}'} 1275 1276 async def acquire_lease(self, timeout=None, duration=None, proposed_lease_id=None, request_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 1277 """[Update] The Lease Blob operation establishes and manages a lock on a 1278 blob for write and delete operations. 1279 1280 :param timeout: The timeout parameter is expressed in seconds. For 1281 more information, see <a 1282 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1283 Timeouts for Blob Service Operations.</a> 1284 :type timeout: int 1285 :param duration: Specifies the duration of the lease, in seconds, or 1286 negative one (-1) for a lease that never expires. A non-infinite lease 1287 can be between 15 and 60 seconds. A lease duration cannot be changed 1288 using renew or change. 1289 :type duration: int 1290 :param proposed_lease_id: Proposed lease ID, in a GUID string format. 1291 The Blob service returns 400 (Invalid request) if the proposed lease 1292 ID is not in the correct format. See Guid Constructor (String) for a 1293 list of valid GUID string formats. 1294 :type proposed_lease_id: str 1295 :param request_id: Provides a client-generated, opaque value with a 1 1296 KB character limit that is recorded in the analytics logs when storage 1297 analytics logging is enabled. 1298 :type request_id: str 1299 :param modified_access_conditions: Additional parameters for the 1300 operation 1301 :type modified_access_conditions: 1302 ~azure.storage.blob.models.ModifiedAccessConditions 1303 :param callable cls: A custom type or function that will be passed the 1304 direct response 1305 :return: None or the result of cls(response) 1306 :rtype: None 1307 :raises: 1308 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1309 """ 1310 error_map = kwargs.pop('error_map', None) 1311 if_modified_since = None 1312 if modified_access_conditions is not None: 1313 if_modified_since = modified_access_conditions.if_modified_since 1314 if_unmodified_since = None 1315 if modified_access_conditions is not None: 1316 if_unmodified_since = modified_access_conditions.if_unmodified_since 1317 if_match = None 1318 if modified_access_conditions is not None: 1319 if_match = modified_access_conditions.if_match 1320 if_none_match = None 1321 if modified_access_conditions is not None: 1322 if_none_match = modified_access_conditions.if_none_match 1323 1324 comp = "lease" 1325 action = "acquire" 1326 1327 # Construct URL 1328 url = self.acquire_lease.metadata['url'] 1329 path_format_arguments = { 1330 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1331 } 1332 url = self._client.format_url(url, **path_format_arguments) 1333 1334 # Construct parameters 1335 query_parameters = {} 1336 if timeout is not None: 1337 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1338 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1339 1340 # Construct headers 1341 header_parameters = {} 1342 if duration is not None: 1343 header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int') 1344 if proposed_lease_id is not None: 1345 header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') 1346 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1347 if request_id is not None: 1348 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1349 header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') 1350 if if_modified_since is not None: 1351 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1352 if if_unmodified_since is not None: 1353 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1354 if if_match is not None: 1355 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1356 if if_none_match is not None: 1357 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1358 1359 # Construct and send request 1360 request = self._client.put(url, query_parameters, header_parameters) 1361 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1362 response = pipeline_response.http_response 1363 1364 if response.status_code not in [201]: 1365 map_error(status_code=response.status_code, response=response, error_map=error_map) 1366 raise models.StorageErrorException(response, self._deserialize) 1367 1368 if cls: 1369 response_headers = { 1370 'ETag': self._deserialize('str', response.headers.get('ETag')), 1371 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1372 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')), 1373 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1374 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1375 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1376 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1377 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1378 } 1379 return cls(response, None, response_headers) 1380 acquire_lease.metadata = {'url': '/{containerName}/{blob}'} 1381 1382 async def release_lease(self, lease_id, timeout=None, request_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 1383 """[Update] The Lease Blob operation establishes and manages a lock on a 1384 blob for write and delete operations. 1385 1386 :param lease_id: Specifies the current lease ID on the resource. 1387 :type lease_id: str 1388 :param timeout: The timeout parameter is expressed in seconds. For 1389 more information, see <a 1390 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1391 Timeouts for Blob Service Operations.</a> 1392 :type timeout: int 1393 :param request_id: Provides a client-generated, opaque value with a 1 1394 KB character limit that is recorded in the analytics logs when storage 1395 analytics logging is enabled. 1396 :type request_id: str 1397 :param modified_access_conditions: Additional parameters for the 1398 operation 1399 :type modified_access_conditions: 1400 ~azure.storage.blob.models.ModifiedAccessConditions 1401 :param callable cls: A custom type or function that will be passed the 1402 direct response 1403 :return: None or the result of cls(response) 1404 :rtype: None 1405 :raises: 1406 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1407 """ 1408 error_map = kwargs.pop('error_map', None) 1409 if_modified_since = None 1410 if modified_access_conditions is not None: 1411 if_modified_since = modified_access_conditions.if_modified_since 1412 if_unmodified_since = None 1413 if modified_access_conditions is not None: 1414 if_unmodified_since = modified_access_conditions.if_unmodified_since 1415 if_match = None 1416 if modified_access_conditions is not None: 1417 if_match = modified_access_conditions.if_match 1418 if_none_match = None 1419 if modified_access_conditions is not None: 1420 if_none_match = modified_access_conditions.if_none_match 1421 1422 comp = "lease" 1423 action = "release" 1424 1425 # Construct URL 1426 url = self.release_lease.metadata['url'] 1427 path_format_arguments = { 1428 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1429 } 1430 url = self._client.format_url(url, **path_format_arguments) 1431 1432 # Construct parameters 1433 query_parameters = {} 1434 if timeout is not None: 1435 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1436 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1437 1438 # Construct headers 1439 header_parameters = {} 1440 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1441 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1442 if request_id is not None: 1443 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1444 header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') 1445 if if_modified_since is not None: 1446 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1447 if if_unmodified_since is not None: 1448 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1449 if if_match is not None: 1450 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1451 if if_none_match is not None: 1452 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1453 1454 # Construct and send request 1455 request = self._client.put(url, query_parameters, header_parameters) 1456 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1457 response = pipeline_response.http_response 1458 1459 if response.status_code not in [200]: 1460 map_error(status_code=response.status_code, response=response, error_map=error_map) 1461 raise models.StorageErrorException(response, self._deserialize) 1462 1463 if cls: 1464 response_headers = { 1465 'ETag': self._deserialize('str', response.headers.get('ETag')), 1466 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1467 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1468 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1469 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1470 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1471 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1472 } 1473 return cls(response, None, response_headers) 1474 release_lease.metadata = {'url': '/{containerName}/{blob}'} 1475 1476 async def renew_lease(self, lease_id, timeout=None, request_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 1477 """[Update] The Lease Blob operation establishes and manages a lock on a 1478 blob for write and delete operations. 1479 1480 :param lease_id: Specifies the current lease ID on the resource. 1481 :type lease_id: str 1482 :param timeout: The timeout parameter is expressed in seconds. For 1483 more information, see <a 1484 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1485 Timeouts for Blob Service Operations.</a> 1486 :type timeout: int 1487 :param request_id: Provides a client-generated, opaque value with a 1 1488 KB character limit that is recorded in the analytics logs when storage 1489 analytics logging is enabled. 1490 :type request_id: str 1491 :param modified_access_conditions: Additional parameters for the 1492 operation 1493 :type modified_access_conditions: 1494 ~azure.storage.blob.models.ModifiedAccessConditions 1495 :param callable cls: A custom type or function that will be passed the 1496 direct response 1497 :return: None or the result of cls(response) 1498 :rtype: None 1499 :raises: 1500 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1501 """ 1502 error_map = kwargs.pop('error_map', None) 1503 if_modified_since = None 1504 if modified_access_conditions is not None: 1505 if_modified_since = modified_access_conditions.if_modified_since 1506 if_unmodified_since = None 1507 if modified_access_conditions is not None: 1508 if_unmodified_since = modified_access_conditions.if_unmodified_since 1509 if_match = None 1510 if modified_access_conditions is not None: 1511 if_match = modified_access_conditions.if_match 1512 if_none_match = None 1513 if modified_access_conditions is not None: 1514 if_none_match = modified_access_conditions.if_none_match 1515 1516 comp = "lease" 1517 action = "renew" 1518 1519 # Construct URL 1520 url = self.renew_lease.metadata['url'] 1521 path_format_arguments = { 1522 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1523 } 1524 url = self._client.format_url(url, **path_format_arguments) 1525 1526 # Construct parameters 1527 query_parameters = {} 1528 if timeout is not None: 1529 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1530 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1531 1532 # Construct headers 1533 header_parameters = {} 1534 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1535 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1536 if request_id is not None: 1537 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1538 header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') 1539 if if_modified_since is not None: 1540 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1541 if if_unmodified_since is not None: 1542 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1543 if if_match is not None: 1544 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1545 if if_none_match is not None: 1546 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1547 1548 # Construct and send request 1549 request = self._client.put(url, query_parameters, header_parameters) 1550 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1551 response = pipeline_response.http_response 1552 1553 if response.status_code not in [200]: 1554 map_error(status_code=response.status_code, response=response, error_map=error_map) 1555 raise models.StorageErrorException(response, self._deserialize) 1556 1557 if cls: 1558 response_headers = { 1559 'ETag': self._deserialize('str', response.headers.get('ETag')), 1560 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1561 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')), 1562 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1563 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1564 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1565 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1566 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1567 } 1568 return cls(response, None, response_headers) 1569 renew_lease.metadata = {'url': '/{containerName}/{blob}'} 1570 1571 async def change_lease(self, lease_id, proposed_lease_id, timeout=None, request_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 1572 """[Update] The Lease Blob operation establishes and manages a lock on a 1573 blob for write and delete operations. 1574 1575 :param lease_id: Specifies the current lease ID on the resource. 1576 :type lease_id: str 1577 :param proposed_lease_id: Proposed lease ID, in a GUID string format. 1578 The Blob service returns 400 (Invalid request) if the proposed lease 1579 ID is not in the correct format. See Guid Constructor (String) for a 1580 list of valid GUID string formats. 1581 :type proposed_lease_id: str 1582 :param timeout: The timeout parameter is expressed in seconds. For 1583 more information, see <a 1584 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1585 Timeouts for Blob Service Operations.</a> 1586 :type timeout: int 1587 :param request_id: Provides a client-generated, opaque value with a 1 1588 KB character limit that is recorded in the analytics logs when storage 1589 analytics logging is enabled. 1590 :type request_id: str 1591 :param modified_access_conditions: Additional parameters for the 1592 operation 1593 :type modified_access_conditions: 1594 ~azure.storage.blob.models.ModifiedAccessConditions 1595 :param callable cls: A custom type or function that will be passed the 1596 direct response 1597 :return: None or the result of cls(response) 1598 :rtype: None 1599 :raises: 1600 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1601 """ 1602 error_map = kwargs.pop('error_map', None) 1603 if_modified_since = None 1604 if modified_access_conditions is not None: 1605 if_modified_since = modified_access_conditions.if_modified_since 1606 if_unmodified_since = None 1607 if modified_access_conditions is not None: 1608 if_unmodified_since = modified_access_conditions.if_unmodified_since 1609 if_match = None 1610 if modified_access_conditions is not None: 1611 if_match = modified_access_conditions.if_match 1612 if_none_match = None 1613 if modified_access_conditions is not None: 1614 if_none_match = modified_access_conditions.if_none_match 1615 1616 comp = "lease" 1617 action = "change" 1618 1619 # Construct URL 1620 url = self.change_lease.metadata['url'] 1621 path_format_arguments = { 1622 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1623 } 1624 url = self._client.format_url(url, **path_format_arguments) 1625 1626 # Construct parameters 1627 query_parameters = {} 1628 if timeout is not None: 1629 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1630 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1631 1632 # Construct headers 1633 header_parameters = {} 1634 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1635 header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') 1636 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1637 if request_id is not None: 1638 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1639 header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') 1640 if if_modified_since is not None: 1641 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1642 if if_unmodified_since is not None: 1643 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1644 if if_match is not None: 1645 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1646 if if_none_match is not None: 1647 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1648 1649 # Construct and send request 1650 request = self._client.put(url, query_parameters, header_parameters) 1651 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1652 response = pipeline_response.http_response 1653 1654 if response.status_code not in [200]: 1655 map_error(status_code=response.status_code, response=response, error_map=error_map) 1656 raise models.StorageErrorException(response, self._deserialize) 1657 1658 if cls: 1659 response_headers = { 1660 'ETag': self._deserialize('str', response.headers.get('ETag')), 1661 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1662 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1663 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1664 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')), 1665 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1666 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1667 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1668 } 1669 return cls(response, None, response_headers) 1670 change_lease.metadata = {'url': '/{containerName}/{blob}'} 1671 1672 async def break_lease(self, timeout=None, break_period=None, request_id=None, modified_access_conditions=None, *, cls=None, **kwargs): 1673 """[Update] The Lease Blob operation establishes and manages a lock on a 1674 blob for write and delete operations. 1675 1676 :param timeout: The timeout parameter is expressed in seconds. For 1677 more information, see <a 1678 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1679 Timeouts for Blob Service Operations.</a> 1680 :type timeout: int 1681 :param break_period: For a break operation, proposed duration the 1682 lease should continue before it is broken, in seconds, between 0 and 1683 60. This break period is only used if it is shorter than the time 1684 remaining on the lease. If longer, the time remaining on the lease is 1685 used. A new lease will not be available before the break period has 1686 expired, but the lease may be held for longer than the break period. 1687 If this header does not appear with a break operation, a 1688 fixed-duration lease breaks after the remaining lease period elapses, 1689 and an infinite lease breaks immediately. 1690 :type break_period: int 1691 :param request_id: Provides a client-generated, opaque value with a 1 1692 KB character limit that is recorded in the analytics logs when storage 1693 analytics logging is enabled. 1694 :type request_id: str 1695 :param modified_access_conditions: Additional parameters for the 1696 operation 1697 :type modified_access_conditions: 1698 ~azure.storage.blob.models.ModifiedAccessConditions 1699 :param callable cls: A custom type or function that will be passed the 1700 direct response 1701 :return: None or the result of cls(response) 1702 :rtype: None 1703 :raises: 1704 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1705 """ 1706 error_map = kwargs.pop('error_map', None) 1707 if_modified_since = None 1708 if modified_access_conditions is not None: 1709 if_modified_since = modified_access_conditions.if_modified_since 1710 if_unmodified_since = None 1711 if modified_access_conditions is not None: 1712 if_unmodified_since = modified_access_conditions.if_unmodified_since 1713 if_match = None 1714 if modified_access_conditions is not None: 1715 if_match = modified_access_conditions.if_match 1716 if_none_match = None 1717 if modified_access_conditions is not None: 1718 if_none_match = modified_access_conditions.if_none_match 1719 1720 comp = "lease" 1721 action = "break" 1722 1723 # Construct URL 1724 url = self.break_lease.metadata['url'] 1725 path_format_arguments = { 1726 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1727 } 1728 url = self._client.format_url(url, **path_format_arguments) 1729 1730 # Construct parameters 1731 query_parameters = {} 1732 if timeout is not None: 1733 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1734 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1735 1736 # Construct headers 1737 header_parameters = {} 1738 if break_period is not None: 1739 header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int') 1740 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1741 if request_id is not None: 1742 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1743 header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') 1744 if if_modified_since is not None: 1745 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1746 if if_unmodified_since is not None: 1747 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1748 if if_match is not None: 1749 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1750 if if_none_match is not None: 1751 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1752 1753 # Construct and send request 1754 request = self._client.put(url, query_parameters, header_parameters) 1755 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1756 response = pipeline_response.http_response 1757 1758 if response.status_code not in [202]: 1759 map_error(status_code=response.status_code, response=response, error_map=error_map) 1760 raise models.StorageErrorException(response, self._deserialize) 1761 1762 if cls: 1763 response_headers = { 1764 'ETag': self._deserialize('str', response.headers.get('ETag')), 1765 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1766 'x-ms-lease-time': self._deserialize('int', response.headers.get('x-ms-lease-time')), 1767 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1768 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1769 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1770 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1771 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1772 } 1773 return cls(response, None, response_headers) 1774 break_lease.metadata = {'url': '/{containerName}/{blob}'} 1775 1776 async def create_snapshot(self, timeout=None, metadata=None, request_id=None, cpk_info=None, modified_access_conditions=None, lease_access_conditions=None, *, cls=None, **kwargs): 1777 """The Create Snapshot operation creates a read-only snapshot of a blob. 1778 1779 :param timeout: The timeout parameter is expressed in seconds. For 1780 more information, see <a 1781 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1782 Timeouts for Blob Service Operations.</a> 1783 :type timeout: int 1784 :param metadata: Optional. Specifies a user-defined name-value pair 1785 associated with the blob. If no name-value pairs are specified, the 1786 operation will copy the metadata from the source blob or file to the 1787 destination blob. If one or more name-value pairs are specified, the 1788 destination blob is created with the specified metadata, and metadata 1789 is not copied from the source blob or file. Note that beginning with 1790 version 2009-09-19, metadata names must adhere to the naming rules for 1791 C# identifiers. See Naming and Referencing Containers, Blobs, and 1792 Metadata for more information. 1793 :type metadata: str 1794 :param request_id: Provides a client-generated, opaque value with a 1 1795 KB character limit that is recorded in the analytics logs when storage 1796 analytics logging is enabled. 1797 :type request_id: str 1798 :param cpk_info: Additional parameters for the operation 1799 :type cpk_info: ~azure.storage.blob.models.CpkInfo 1800 :param modified_access_conditions: Additional parameters for the 1801 operation 1802 :type modified_access_conditions: 1803 ~azure.storage.blob.models.ModifiedAccessConditions 1804 :param lease_access_conditions: Additional parameters for the 1805 operation 1806 :type lease_access_conditions: 1807 ~azure.storage.blob.models.LeaseAccessConditions 1808 :param callable cls: A custom type or function that will be passed the 1809 direct response 1810 :return: None or the result of cls(response) 1811 :rtype: None 1812 :raises: 1813 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1814 """ 1815 error_map = kwargs.pop('error_map', None) 1816 encryption_key = None 1817 if cpk_info is not None: 1818 encryption_key = cpk_info.encryption_key 1819 encryption_key_sha256 = None 1820 if cpk_info is not None: 1821 encryption_key_sha256 = cpk_info.encryption_key_sha256 1822 encryption_algorithm = None 1823 if cpk_info is not None: 1824 encryption_algorithm = cpk_info.encryption_algorithm 1825 if_modified_since = None 1826 if modified_access_conditions is not None: 1827 if_modified_since = modified_access_conditions.if_modified_since 1828 if_unmodified_since = None 1829 if modified_access_conditions is not None: 1830 if_unmodified_since = modified_access_conditions.if_unmodified_since 1831 if_match = None 1832 if modified_access_conditions is not None: 1833 if_match = modified_access_conditions.if_match 1834 if_none_match = None 1835 if modified_access_conditions is not None: 1836 if_none_match = modified_access_conditions.if_none_match 1837 lease_id = None 1838 if lease_access_conditions is not None: 1839 lease_id = lease_access_conditions.lease_id 1840 1841 comp = "snapshot" 1842 1843 # Construct URL 1844 url = self.create_snapshot.metadata['url'] 1845 path_format_arguments = { 1846 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1847 } 1848 url = self._client.format_url(url, **path_format_arguments) 1849 1850 # Construct parameters 1851 query_parameters = {} 1852 if timeout is not None: 1853 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 1854 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 1855 1856 # Construct headers 1857 header_parameters = {} 1858 if metadata is not None: 1859 header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') 1860 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 1861 if request_id is not None: 1862 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 1863 if encryption_key is not None: 1864 header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", encryption_key, 'str') 1865 if encryption_key_sha256 is not None: 1866 header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", encryption_key_sha256, 'str') 1867 if encryption_algorithm is not None: 1868 header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'EncryptionAlgorithmType') 1869 if if_modified_since is not None: 1870 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 1871 if if_unmodified_since is not None: 1872 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 1873 if if_match is not None: 1874 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 1875 if if_none_match is not None: 1876 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 1877 if lease_id is not None: 1878 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 1879 1880 # Construct and send request 1881 request = self._client.put(url, query_parameters, header_parameters) 1882 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 1883 response = pipeline_response.http_response 1884 1885 if response.status_code not in [201]: 1886 map_error(status_code=response.status_code, response=response, error_map=error_map) 1887 raise models.StorageErrorException(response, self._deserialize) 1888 1889 if cls: 1890 response_headers = { 1891 'x-ms-snapshot': self._deserialize('str', response.headers.get('x-ms-snapshot')), 1892 'ETag': self._deserialize('str', response.headers.get('ETag')), 1893 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 1894 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 1895 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 1896 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 1897 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 1898 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')), 1899 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 1900 } 1901 return cls(response, None, response_headers) 1902 create_snapshot.metadata = {'url': '/{containerName}/{blob}'} 1903 1904 async def start_copy_from_url(self, copy_source, timeout=None, metadata=None, tier=None, rehydrate_priority=None, request_id=None, source_modified_access_conditions=None, modified_access_conditions=None, lease_access_conditions=None, *, cls=None, **kwargs): 1905 """The Start Copy From URL operation copies a blob or an internet resource 1906 to a new blob. 1907 1908 :param copy_source: Specifies the name of the source page blob 1909 snapshot. This value is a URL of up to 2 KB in length that specifies a 1910 page blob snapshot. The value should be URL-encoded as it would appear 1911 in a request URI. The source blob must either be public or must be 1912 authenticated via a shared access signature. 1913 :type copy_source: str 1914 :param timeout: The timeout parameter is expressed in seconds. For 1915 more information, see <a 1916 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 1917 Timeouts for Blob Service Operations.</a> 1918 :type timeout: int 1919 :param metadata: Optional. Specifies a user-defined name-value pair 1920 associated with the blob. If no name-value pairs are specified, the 1921 operation will copy the metadata from the source blob or file to the 1922 destination blob. If one or more name-value pairs are specified, the 1923 destination blob is created with the specified metadata, and metadata 1924 is not copied from the source blob or file. Note that beginning with 1925 version 2009-09-19, metadata names must adhere to the naming rules for 1926 C# identifiers. See Naming and Referencing Containers, Blobs, and 1927 Metadata for more information. 1928 :type metadata: str 1929 :param tier: Optional. Indicates the tier to be set on the blob. 1930 Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 1931 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive' 1932 :type tier: str or ~azure.storage.blob.models.AccessTierOptional 1933 :param rehydrate_priority: Optional: Indicates the priority with which 1934 to rehydrate an archived blob. Possible values include: 'High', 1935 'Standard' 1936 :type rehydrate_priority: str or 1937 ~azure.storage.blob.models.RehydratePriority 1938 :param request_id: Provides a client-generated, opaque value with a 1 1939 KB character limit that is recorded in the analytics logs when storage 1940 analytics logging is enabled. 1941 :type request_id: str 1942 :param source_modified_access_conditions: Additional parameters for 1943 the operation 1944 :type source_modified_access_conditions: 1945 ~azure.storage.blob.models.SourceModifiedAccessConditions 1946 :param modified_access_conditions: Additional parameters for the 1947 operation 1948 :type modified_access_conditions: 1949 ~azure.storage.blob.models.ModifiedAccessConditions 1950 :param lease_access_conditions: Additional parameters for the 1951 operation 1952 :type lease_access_conditions: 1953 ~azure.storage.blob.models.LeaseAccessConditions 1954 :param callable cls: A custom type or function that will be passed the 1955 direct response 1956 :return: None or the result of cls(response) 1957 :rtype: None 1958 :raises: 1959 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 1960 """ 1961 error_map = kwargs.pop('error_map', None) 1962 source_if_modified_since = None 1963 if source_modified_access_conditions is not None: 1964 source_if_modified_since = source_modified_access_conditions.source_if_modified_since 1965 source_if_unmodified_since = None 1966 if source_modified_access_conditions is not None: 1967 source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since 1968 source_if_match = None 1969 if source_modified_access_conditions is not None: 1970 source_if_match = source_modified_access_conditions.source_if_match 1971 source_if_none_match = None 1972 if source_modified_access_conditions is not None: 1973 source_if_none_match = source_modified_access_conditions.source_if_none_match 1974 if_modified_since = None 1975 if modified_access_conditions is not None: 1976 if_modified_since = modified_access_conditions.if_modified_since 1977 if_unmodified_since = None 1978 if modified_access_conditions is not None: 1979 if_unmodified_since = modified_access_conditions.if_unmodified_since 1980 if_match = None 1981 if modified_access_conditions is not None: 1982 if_match = modified_access_conditions.if_match 1983 if_none_match = None 1984 if modified_access_conditions is not None: 1985 if_none_match = modified_access_conditions.if_none_match 1986 lease_id = None 1987 if lease_access_conditions is not None: 1988 lease_id = lease_access_conditions.lease_id 1989 1990 # Construct URL 1991 url = self.start_copy_from_url.metadata['url'] 1992 path_format_arguments = { 1993 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 1994 } 1995 url = self._client.format_url(url, **path_format_arguments) 1996 1997 # Construct parameters 1998 query_parameters = {} 1999 if timeout is not None: 2000 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2001 2002 # Construct headers 2003 header_parameters = {} 2004 if metadata is not None: 2005 header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') 2006 if tier is not None: 2007 header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') 2008 if rehydrate_priority is not None: 2009 header_parameters['x-ms-rehydrate-priority'] = self._serialize.header("rehydrate_priority", rehydrate_priority, 'str') 2010 header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') 2011 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2012 if request_id is not None: 2013 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2014 if source_if_modified_since is not None: 2015 header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') 2016 if source_if_unmodified_since is not None: 2017 header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') 2018 if source_if_match is not None: 2019 header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", source_if_match, 'str') 2020 if source_if_none_match is not None: 2021 header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", source_if_none_match, 'str') 2022 if if_modified_since is not None: 2023 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 2024 if if_unmodified_since is not None: 2025 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 2026 if if_match is not None: 2027 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 2028 if if_none_match is not None: 2029 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 2030 if lease_id is not None: 2031 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 2032 2033 # Construct and send request 2034 request = self._client.put(url, query_parameters, header_parameters) 2035 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2036 response = pipeline_response.http_response 2037 2038 if response.status_code not in [202]: 2039 map_error(status_code=response.status_code, response=response, error_map=error_map) 2040 raise models.StorageErrorException(response, self._deserialize) 2041 2042 if cls: 2043 response_headers = { 2044 'ETag': self._deserialize('str', response.headers.get('ETag')), 2045 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 2046 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2047 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2048 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2049 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2050 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 2051 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')), 2052 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2053 } 2054 return cls(response, None, response_headers) 2055 start_copy_from_url.metadata = {'url': '/{containerName}/{blob}'} 2056 2057 async def copy_from_url(self, copy_source, timeout=None, metadata=None, tier=None, request_id=None, source_modified_access_conditions=None, modified_access_conditions=None, lease_access_conditions=None, *, cls=None, **kwargs): 2058 """The Copy From URL operation copies a blob or an internet resource to a 2059 new blob. It will not return a response until the copy is complete. 2060 2061 :param copy_source: Specifies the name of the source page blob 2062 snapshot. This value is a URL of up to 2 KB in length that specifies a 2063 page blob snapshot. The value should be URL-encoded as it would appear 2064 in a request URI. The source blob must either be public or must be 2065 authenticated via a shared access signature. 2066 :type copy_source: str 2067 :param timeout: The timeout parameter is expressed in seconds. For 2068 more information, see <a 2069 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 2070 Timeouts for Blob Service Operations.</a> 2071 :type timeout: int 2072 :param metadata: Optional. Specifies a user-defined name-value pair 2073 associated with the blob. If no name-value pairs are specified, the 2074 operation will copy the metadata from the source blob or file to the 2075 destination blob. If one or more name-value pairs are specified, the 2076 destination blob is created with the specified metadata, and metadata 2077 is not copied from the source blob or file. Note that beginning with 2078 version 2009-09-19, metadata names must adhere to the naming rules for 2079 C# identifiers. See Naming and Referencing Containers, Blobs, and 2080 Metadata for more information. 2081 :type metadata: str 2082 :param tier: Optional. Indicates the tier to be set on the blob. 2083 Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 2084 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive' 2085 :type tier: str or ~azure.storage.blob.models.AccessTierOptional 2086 :param request_id: Provides a client-generated, opaque value with a 1 2087 KB character limit that is recorded in the analytics logs when storage 2088 analytics logging is enabled. 2089 :type request_id: str 2090 :param source_modified_access_conditions: Additional parameters for 2091 the operation 2092 :type source_modified_access_conditions: 2093 ~azure.storage.blob.models.SourceModifiedAccessConditions 2094 :param modified_access_conditions: Additional parameters for the 2095 operation 2096 :type modified_access_conditions: 2097 ~azure.storage.blob.models.ModifiedAccessConditions 2098 :param lease_access_conditions: Additional parameters for the 2099 operation 2100 :type lease_access_conditions: 2101 ~azure.storage.blob.models.LeaseAccessConditions 2102 :param callable cls: A custom type or function that will be passed the 2103 direct response 2104 :return: None or the result of cls(response) 2105 :rtype: None 2106 :raises: 2107 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 2108 """ 2109 error_map = kwargs.pop('error_map', None) 2110 source_if_modified_since = None 2111 if source_modified_access_conditions is not None: 2112 source_if_modified_since = source_modified_access_conditions.source_if_modified_since 2113 source_if_unmodified_since = None 2114 if source_modified_access_conditions is not None: 2115 source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since 2116 source_if_match = None 2117 if source_modified_access_conditions is not None: 2118 source_if_match = source_modified_access_conditions.source_if_match 2119 source_if_none_match = None 2120 if source_modified_access_conditions is not None: 2121 source_if_none_match = source_modified_access_conditions.source_if_none_match 2122 if_modified_since = None 2123 if modified_access_conditions is not None: 2124 if_modified_since = modified_access_conditions.if_modified_since 2125 if_unmodified_since = None 2126 if modified_access_conditions is not None: 2127 if_unmodified_since = modified_access_conditions.if_unmodified_since 2128 if_match = None 2129 if modified_access_conditions is not None: 2130 if_match = modified_access_conditions.if_match 2131 if_none_match = None 2132 if modified_access_conditions is not None: 2133 if_none_match = modified_access_conditions.if_none_match 2134 lease_id = None 2135 if lease_access_conditions is not None: 2136 lease_id = lease_access_conditions.lease_id 2137 2138 # Construct URL 2139 url = self.copy_from_url.metadata['url'] 2140 path_format_arguments = { 2141 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2142 } 2143 url = self._client.format_url(url, **path_format_arguments) 2144 2145 # Construct parameters 2146 query_parameters = {} 2147 if timeout is not None: 2148 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2149 2150 # Construct headers 2151 header_parameters = {} 2152 if metadata is not None: 2153 header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') 2154 if tier is not None: 2155 header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') 2156 header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') 2157 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2158 if request_id is not None: 2159 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2160 header_parameters['x-ms-requires-sync'] = self._serialize.header("self.x_ms_requires_sync", self.x_ms_requires_sync, 'str') 2161 if source_if_modified_since is not None: 2162 header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') 2163 if source_if_unmodified_since is not None: 2164 header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') 2165 if source_if_match is not None: 2166 header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", source_if_match, 'str') 2167 if source_if_none_match is not None: 2168 header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", source_if_none_match, 'str') 2169 if if_modified_since is not None: 2170 header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123') 2171 if if_unmodified_since is not None: 2172 header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') 2173 if if_match is not None: 2174 header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') 2175 if if_none_match is not None: 2176 header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') 2177 if lease_id is not None: 2178 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 2179 2180 # Construct and send request 2181 request = self._client.put(url, query_parameters, header_parameters) 2182 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2183 response = pipeline_response.http_response 2184 2185 if response.status_code not in [202]: 2186 map_error(status_code=response.status_code, response=response, error_map=error_map) 2187 raise models.StorageErrorException(response, self._deserialize) 2188 2189 if cls: 2190 response_headers = { 2191 'ETag': self._deserialize('str', response.headers.get('ETag')), 2192 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')), 2193 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2194 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2195 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2196 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2197 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')), 2198 'x-ms-copy-status': self._deserialize(models.SyncCopyStatusType, response.headers.get('x-ms-copy-status')), 2199 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2200 } 2201 return cls(response, None, response_headers) 2202 copy_from_url.metadata = {'url': '/{containerName}/{blob}'} 2203 2204 async def abort_copy_from_url(self, copy_id, timeout=None, request_id=None, lease_access_conditions=None, *, cls=None, **kwargs): 2205 """The Abort Copy From URL operation aborts a pending Copy From URL 2206 operation, and leaves a destination blob with zero length and full 2207 metadata. 2208 2209 :param copy_id: The copy identifier provided in the x-ms-copy-id 2210 header of the original Copy Blob operation. 2211 :type copy_id: str 2212 :param timeout: The timeout parameter is expressed in seconds. For 2213 more information, see <a 2214 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 2215 Timeouts for Blob Service Operations.</a> 2216 :type timeout: int 2217 :param request_id: Provides a client-generated, opaque value with a 1 2218 KB character limit that is recorded in the analytics logs when storage 2219 analytics logging is enabled. 2220 :type request_id: str 2221 :param lease_access_conditions: Additional parameters for the 2222 operation 2223 :type lease_access_conditions: 2224 ~azure.storage.blob.models.LeaseAccessConditions 2225 :param callable cls: A custom type or function that will be passed the 2226 direct response 2227 :return: None or the result of cls(response) 2228 :rtype: None 2229 :raises: 2230 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 2231 """ 2232 error_map = kwargs.pop('error_map', None) 2233 lease_id = None 2234 if lease_access_conditions is not None: 2235 lease_id = lease_access_conditions.lease_id 2236 2237 comp = "copy" 2238 2239 # Construct URL 2240 url = self.abort_copy_from_url.metadata['url'] 2241 path_format_arguments = { 2242 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2243 } 2244 url = self._client.format_url(url, **path_format_arguments) 2245 2246 # Construct parameters 2247 query_parameters = {} 2248 query_parameters['copyid'] = self._serialize.query("copy_id", copy_id, 'str') 2249 if timeout is not None: 2250 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2251 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 2252 2253 # Construct headers 2254 header_parameters = {} 2255 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2256 if request_id is not None: 2257 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2258 header_parameters['x-ms-copy-action'] = self._serialize.header("self.x_ms_copy_action", self.x_ms_copy_action, 'str') 2259 if lease_id is not None: 2260 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 2261 2262 # Construct and send request 2263 request = self._client.put(url, query_parameters, header_parameters) 2264 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2265 response = pipeline_response.http_response 2266 2267 if response.status_code not in [204]: 2268 map_error(status_code=response.status_code, response=response, error_map=error_map) 2269 raise models.StorageErrorException(response, self._deserialize) 2270 2271 if cls: 2272 response_headers = { 2273 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2274 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2275 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2276 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2277 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2278 } 2279 return cls(response, None, response_headers) 2280 abort_copy_from_url.metadata = {'url': '/{containerName}/{blob}'} 2281 2282 async def set_tier(self, tier, timeout=None, rehydrate_priority=None, request_id=None, lease_access_conditions=None, *, cls=None, **kwargs): 2283 """The Set Tier operation sets the tier on a blob. The operation is 2284 allowed on a page blob in a premium storage account and on a block blob 2285 in a blob storage account (locally redundant storage only). A premium 2286 page blob's tier determines the allowed size, IOPS, and bandwidth of 2287 the blob. A block blob's tier determines Hot/Cool/Archive storage type. 2288 This operation does not update the blob's ETag. 2289 2290 :param tier: Indicates the tier to be set on the blob. Possible values 2291 include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 2292 'P70', 'P80', 'Hot', 'Cool', 'Archive' 2293 :type tier: str or ~azure.storage.blob.models.AccessTierRequired 2294 :param timeout: The timeout parameter is expressed in seconds. For 2295 more information, see <a 2296 href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting 2297 Timeouts for Blob Service Operations.</a> 2298 :type timeout: int 2299 :param rehydrate_priority: Optional: Indicates the priority with which 2300 to rehydrate an archived blob. Possible values include: 'High', 2301 'Standard' 2302 :type rehydrate_priority: str or 2303 ~azure.storage.blob.models.RehydratePriority 2304 :param request_id: Provides a client-generated, opaque value with a 1 2305 KB character limit that is recorded in the analytics logs when storage 2306 analytics logging is enabled. 2307 :type request_id: str 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 lease_id = None 2321 if lease_access_conditions is not None: 2322 lease_id = lease_access_conditions.lease_id 2323 2324 comp = "tier" 2325 2326 # Construct URL 2327 url = self.set_tier.metadata['url'] 2328 path_format_arguments = { 2329 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2330 } 2331 url = self._client.format_url(url, **path_format_arguments) 2332 2333 # Construct parameters 2334 query_parameters = {} 2335 if timeout is not None: 2336 query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) 2337 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 2338 2339 # Construct headers 2340 header_parameters = {} 2341 header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') 2342 if rehydrate_priority is not None: 2343 header_parameters['x-ms-rehydrate-priority'] = self._serialize.header("rehydrate_priority", rehydrate_priority, 'str') 2344 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2345 if request_id is not None: 2346 header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str') 2347 if lease_id is not None: 2348 header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') 2349 2350 # Construct and send request 2351 request = self._client.put(url, query_parameters, header_parameters) 2352 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2353 response = pipeline_response.http_response 2354 2355 if response.status_code not in [200, 202]: 2356 map_error(status_code=response.status_code, response=response, error_map=error_map) 2357 raise models.StorageErrorException(response, self._deserialize) 2358 2359 if cls: 2360 response_headers = { 2361 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2362 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2363 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2364 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2365 } 2366 return cls(response, None, response_headers) 2367 set_tier.metadata = {'url': '/{containerName}/{blob}'} 2368 2369 async def get_account_info(self, *, cls=None, **kwargs): 2370 """Returns the sku name and account kind . 2371 2372 :param callable cls: A custom type or function that will be passed the 2373 direct response 2374 :return: None or the result of cls(response) 2375 :rtype: None 2376 :raises: 2377 :class:`StorageErrorException<azure.storage.blob.models.StorageErrorException>` 2378 """ 2379 error_map = kwargs.pop('error_map', None) 2380 comp = "properties" 2381 2382 # Construct URL 2383 url = self.get_account_info.metadata['url'] 2384 path_format_arguments = { 2385 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True) 2386 } 2387 url = self._client.format_url(url, **path_format_arguments) 2388 2389 # Construct parameters 2390 query_parameters = {} 2391 query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str') 2392 query_parameters['comp'] = self._serialize.query("comp", comp, 'str') 2393 2394 # Construct headers 2395 header_parameters = {} 2396 header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') 2397 2398 # Construct and send request 2399 request = self._client.get(url, query_parameters, header_parameters) 2400 pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) 2401 response = pipeline_response.http_response 2402 2403 if response.status_code not in [200]: 2404 map_error(status_code=response.status_code, response=response, error_map=error_map) 2405 raise models.StorageErrorException(response, self._deserialize) 2406 2407 if cls: 2408 response_headers = { 2409 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')), 2410 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')), 2411 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')), 2412 'Date': self._deserialize('rfc-1123', response.headers.get('Date')), 2413 'x-ms-sku-name': self._deserialize(models.SkuName, response.headers.get('x-ms-sku-name')), 2414 'x-ms-account-kind': self._deserialize(models.AccountKind, response.headers.get('x-ms-account-kind')), 2415 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')), 2416 } 2417 return cls(response, None, response_headers) 2418 get_account_info.metadata = {'url': '/{containerName}/{blob}'} 2419