in azure/multiapi/storage/v2015_04_05/blob/pageblobservice.py [0:0]
def update_page(
self, container_name, blob_name, page, start_range, end_range,
content_md5=None, lease_id=None, if_sequence_number_lte=None,
if_sequence_number_lt=None, if_sequence_number_eq=None,
if_modified_since=None, if_unmodified_since=None,
if_match=None, if_none_match=None, timeout=None):
'''
Updates a range of pages.
:param str container_name:
Name of existing container.
:param str blob_name:
Name of existing blob.
:param bytes page:
Content of the page.
:param int start_range:
Start of byte range to use for writing to a section of the blob.
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.
:param int end_range:
End of byte range to use for writing to a section of the blob.
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.
:param int content_md5:
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).
:param str lease_id:
Required if the blob has an active lease.
:param int if_sequence_number_lte:
If the blob's sequence number is less than or equal to
the specified value, the request proceeds; otherwise it fails.
:param int if_sequence_number_lt:
If the blob's sequence number is less than the specified
value, the request proceeds; otherwise it fails.
:param int if_sequence_number_eq:
If the blob's sequence number is equal to the specified
value, the request proceeds; otherwise it fails.
:param datetime if_modified_since:
A DateTime value. Azure expects the date value passed in to be UTC.
If timezone is included, any non-UTC datetimes will be converted to UTC.
If a date is passed in without timezone info, it is assumed to be UTC.
Specify this header to perform the operation only
if the resource has been modified since the specified time.
:param datetime if_unmodified_since:
A DateTime value. Azure expects the date value passed in to be UTC.
If timezone is included, any non-UTC datetimes will be converted to UTC.
If a date is passed in without timezone info, it is assumed to be UTC.
Specify this header to perform the operation only if
the resource has not been modified since the specified date/time.
:param str if_match:
An ETag value, or the wildcard character (*). 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.
:param str if_none_match:
An ETag value, or the wildcard character (*). 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.
:param int timeout:
The timeout parameter is expressed in seconds.
:return: ETag and last modified properties for the updated Page Blob
:rtype: :class:`~azure.storage.blob.models.ResourceProperties`
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
_validate_not_none('page', page)
request = HTTPRequest()
request.method = 'PUT'
request.host = self._get_host()
request.path = _get_path(container_name, blob_name)
request.query = [
('comp', 'page'),
('timeout', _int_to_str(timeout)),
]
request.headers = [
('Content-MD5', _to_str(content_md5)),
('x-ms-page-write', 'update'),
('x-ms-lease-id', _to_str(lease_id)),
('x-ms-if-sequence-number-le',
_to_str(if_sequence_number_lte)),
('x-ms-if-sequence-number-lt',
_to_str(if_sequence_number_lt)),
('x-ms-if-sequence-number-eq',
_to_str(if_sequence_number_eq)),
('If-Modified-Since', _datetime_to_utc_string(if_modified_since)),
('If-Unmodified-Since', _datetime_to_utc_string(if_unmodified_since)),
('If-Match', _to_str(if_match)),
('If-None-Match', _to_str(if_none_match))
]
_validate_and_format_range_headers(
request,
start_range,
end_range,
align_to_page=True)
request.body = _get_request_body_bytes_only('page', page)
response = self._perform_request(request)
return _parse_page_properties(response)