in CustomScript/azure/storage/blobservice.py [0:0]
def put_blob(self, container_name, blob_name, blob, x_ms_blob_type,
content_encoding=None, content_language=None,
content_md5=None, cache_control=None,
x_ms_blob_content_type=None, x_ms_blob_content_encoding=None,
x_ms_blob_content_language=None, x_ms_blob_content_md5=None,
x_ms_blob_cache_control=None, x_ms_meta_name_values=None,
x_ms_lease_id=None, x_ms_blob_content_length=None,
x_ms_blob_sequence_number=None):
'''
Creates a new block blob or page blob, or updates the content of an
existing block blob.
See put_block_blob_from_* and put_page_blob_from_* for high level
functions that handle the creation and upload of large blobs with
automatic chunking and progress notifications.
container_name: Name of existing container.
blob_name: Name of blob to create or update.
blob:
For BlockBlob:
Content of blob as bytes (size < 64MB). For larger size, you
must call put_block and put_block_list to set content of blob.
For PageBlob:
Use None and call put_page to set content of blob.
x_ms_blob_type: Required. Could be BlockBlob or PageBlob.
content_encoding:
Optional. Specifies which content encodings have been applied to
the blob. This value is returned to the client when the Get Blob
(REST API) operation is performed on the blob resource. The client
can use this value when returned to decode the blob content.
content_language:
Optional. Specifies the natural languages used by this resource.
content_md5:
Optional. An MD5 hash of the blob content. This hash is used to
verify the integrity of the blob during transport. When this header
is specified, the storage service checks the hash that has arrived
with the one that was sent. If the two hashes do not match, the
operation will fail with error code 400 (Bad Request).
cache_control:
Optional. The Blob service stores this value but does not use or
modify it.
x_ms_blob_content_type: Optional. Set the blob's content type.
x_ms_blob_content_encoding: Optional. Set the blob's content encoding.
x_ms_blob_content_language: Optional. Set the blob's content language.
x_ms_blob_content_md5: Optional. Set the blob's MD5 hash.
x_ms_blob_cache_control: Optional. Sets the blob's cache control.
x_ms_meta_name_values: A dict containing name, value for metadata.
x_ms_lease_id: Required if the blob has an active lease.
x_ms_blob_content_length:
Required for page blobs. This header specifies the maximum size
for the page blob, up to 1 TB. The page blob size must be aligned
to a 512-byte boundary.
x_ms_blob_sequence_number:
Optional. Set for page blobs only. The sequence number is a
user-controlled value that you can use to track requests. The
value of the sequence number must be between 0 and 2^63 - 1. The
default value is 0.
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
_validate_not_none('x_ms_blob_type', x_ms_blob_type)
request = HTTPRequest()
request.method = 'PUT'
request.host = self._get_host()
request.path = '/' + _str(container_name) + '/' + _str(blob_name) + ''
request.headers = [
('x-ms-blob-type', _str_or_none(x_ms_blob_type)),
('Content-Encoding', _str_or_none(content_encoding)),
('Content-Language', _str_or_none(content_language)),
('Content-MD5', _str_or_none(content_md5)),
('Cache-Control', _str_or_none(cache_control)),
('x-ms-blob-content-type', _str_or_none(x_ms_blob_content_type)),
('x-ms-blob-content-encoding',
_str_or_none(x_ms_blob_content_encoding)),
('x-ms-blob-content-language',
_str_or_none(x_ms_blob_content_language)),
('x-ms-blob-content-md5', _str_or_none(x_ms_blob_content_md5)),
('x-ms-blob-cache-control', _str_or_none(x_ms_blob_cache_control)),
('x-ms-meta-name-values', x_ms_meta_name_values),
('x-ms-lease-id', _str_or_none(x_ms_lease_id)),
('x-ms-blob-content-length',
_str_or_none(x_ms_blob_content_length)),
('x-ms-blob-sequence-number',
_str_or_none(x_ms_blob_sequence_number))
]
request.body = _get_request_body_bytes_only('blob', blob)
request.path, request.query = _update_request_uri_query_local_storage(
request, self.use_local_storage)
request.headers = _update_storage_blob_header(
request, self.account_name, self.account_key)
self._perform_request(request)