in DSC/azure/storage/blobservice.py [0:0]
def put_page(self, container_name, blob_name, page, x_ms_range,
x_ms_page_write, timeout=None, content_md5=None,
x_ms_lease_id=None, x_ms_if_sequence_number_lte=None,
x_ms_if_sequence_number_lt=None,
x_ms_if_sequence_number_eq=None,
if_modified_since=None, if_unmodified_since=None,
if_match=None, if_none_match=None):
'''
Writes a range of pages to a page blob.
container_name: Name of existing container.
blob_name: Name of existing blob.
page: Content of the page.
x_ms_range:
Required. Specifies the range of bytes to be written as a page.
Both the start and end of the range must be specified. Must be in
format: bytes=startByte-endByte. Given that pages must be aligned
with 512-byte boundaries, the start offset must be a modulus of
512 and the end offset must be a modulus of 512-1. Examples of
valid byte ranges are 0-511, 512-1023, etc.
x_ms_page_write:
Required. You may specify one of the following options:
update (lower case):
Writes the bytes specified by the request body into the
specified range. The Range and Content-Length headers must
match to perform the update.
clear (lower case):
Clears the specified range and releases the space used in
storage for that range. To clear a range, set the
Content-Length header to zero, and the Range header to a
value that indicates the range to clear, up to maximum
blob size.
timeout: the timeout parameter is expressed in seconds.
content_md5:
Optional. An MD5 hash of the page content. This hash is used to
verify the integrity of the page during transport. When this header
is specified, the storage service compares the hash of the content
that has arrived with the header value that was sent. If the two
hashes do not match, the operation will fail with error code 400
(Bad Request).
x_ms_lease_id: Required if the blob has an active lease.
x_ms_if_sequence_number_lte:
Optional. If the blob's sequence number is less than or equal to
the specified value, the request proceeds; otherwise it fails.
x_ms_if_sequence_number_lt:
Optional. If the blob's sequence number is less than the specified
value, the request proceeds; otherwise it fails.
x_ms_if_sequence_number_eq:
Optional. If the blob's sequence number is equal to the specified
value, the request proceeds; otherwise it fails.
if_modified_since:
Optional. A DateTime value. Specify this conditional header to
write the page only if the blob has been modified since the
specified date/time. If the blob has not been modified, the Blob
service fails.
if_unmodified_since:
Optional. A DateTime value. Specify this conditional header to
write the page only if the blob has not been modified since the
specified date/time. If the blob has been modified, the Blob
service fails.
if_match:
Optional. An ETag value. Specify an ETag value for this conditional
header to write the page only if the blob's ETag value matches the
value specified. If the values do not match, the Blob service fails.
if_none_match:
Optional. An ETag value. Specify an ETag value for this conditional
header to write the page only if the blob's ETag value does not
match the value specified. If the values are identical, the Blob
service fails.
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
_validate_not_none('page', page)
_validate_not_none('x_ms_range', x_ms_range)
_validate_not_none('x_ms_page_write', x_ms_page_write)
request = HTTPRequest()
request.method = 'PUT'
request.host = self._get_host()
request.path = '/' + \
_str(container_name) + '/' + _str(blob_name) + '?comp=page'
request.headers = [
('x-ms-range', _str_or_none(x_ms_range)),
('Content-MD5', _str_or_none(content_md5)),
('x-ms-page-write', _str_or_none(x_ms_page_write)),
('x-ms-lease-id', _str_or_none(x_ms_lease_id)),
('x-ms-if-sequence-number-le',
_str_or_none(x_ms_if_sequence_number_lte)),
('x-ms-if-sequence-number-lt',
_str_or_none(x_ms_if_sequence_number_lt)),
('x-ms-if-sequence-number-eq',
_str_or_none(x_ms_if_sequence_number_eq)),
('If-Modified-Since', _str_or_none(if_modified_since)),
('If-Unmodified-Since', _str_or_none(if_unmodified_since)),
('If-Match', _str_or_none(if_match)),
('If-None-Match', _str_or_none(if_none_match))
]
request.query = [('timeout', _int_or_none(timeout))]
request.body = _get_request_body_bytes_only('page', page)
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)