Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
This header should be specified only for a request against the base
blob resource. If this header is specified on a request to delete
an individual snapshot, the Blob service returns status code 400
(Bad Request). If this header is not specified on the request and
the blob has associated snapshots, the Blob service returns status
code 409 (Conflict).
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
request = HTTPRequest()
request.method = 'DELETE'
request.host = self._get_host()
request.path = '/' + _str(container_name) + '/' + _str(blob_name) + ''
request.headers = [
('x-ms-lease-id', _str_or_none(x_ms_lease_id)),
('x-ms-delete-snapshots', _str_or_none(x_ms_delete_snapshots))
]
request.query = [
('snapshot', _str_or_none(snapshot)),
('timeout', _int_or_none(timeout))
]
request.path, request.query = _update_request_uri_query_local_storage(
request, self.use_local_storage)
request.headers = _update_storage_blob_header(
request, self.authentication)
self._perform_request(request)
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
request = HTTPRequest()
request.method = 'GET'
request.host = self._get_host()
request.path = _get_path(container_name, blob_name)
request.query = [
('snapshot', _str_or_none(snapshot)),
('timeout', _int_or_none(timeout)),
]
request.headers = [
('x-ms-lease-id', _str_or_none(lease_id)),
('If-Modified-Since', _datetime_to_utc_string(if_modified_since)),
('If-Unmodified-Since', _datetime_to_utc_string(if_unmodified_since)),
('If-Match', _str_or_none(if_match)),
('If-None-Match', _str_or_none(if_none_match)),
]
_validate_and_format_range_headers(
request,
start_range,
end_range,
start_range_required=False,
end_range_required=False,
check_content_md5=range_get_content_md5)
response = self._perform_request(request, None)
return _parse_blob(blob_name, snapshot, response)
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
request = HTTPRequest()
request.method = 'GET'
request.host = self._get_host()
request.path = _get_path(container_name, blob_name)
request.query = [
('snapshot', _str_or_none(snapshot)),
('timeout', _int_or_none(timeout)),
]
request.headers = [
('x-ms-lease-id', _str_or_none(lease_id)),
('If-Modified-Since', _datetime_to_utc_string(if_modified_since)),
('If-Unmodified-Since', _datetime_to_utc_string(if_unmodified_since)),
('If-Match', _str_or_none(if_match)),
('If-None-Match', _str_or_none(if_none_match)),
]
_validate_and_format_range_headers(
request,
start_range,
end_range,
start_range_required=False,
end_range_required=False,
check_content_md5=range_get_content_md5)
response = self._perform_request(request, None)
return _parse_blob(blob_name, snapshot, response)
Optional. An ETag value
x_ms_lease_id:
Required if the blob has an active lease.
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
request = HTTPRequest()
request.method = 'PUT'
request.host = self._get_host()
request.path = '/' + \
_str(container_name) + '/' + _str(blob_name) + '?comp=snapshot'
request.headers = [
('x-ms-meta-name-values', x_ms_meta_name_values),
('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)),
('x-ms-lease-id', _str_or_none(x_ms_lease_id))
]
request.path, request.query = _update_request_uri_query_local_storage(
request, self.use_local_storage)
request.headers = _update_storage_blob_header(
request, self.authentication)
response = self._perform_request(request)
return _parse_response_for_dict_filter(
response,
filter=['x-ms-snapshot', 'etag', 'last-modified'])
Specifies the maximum number of containers to return.
:param str include:
Include this parameter to specify that the container's
metadata be returned as part of the response body. set this
parameter to string 'metadata' to get container's metadata.
:param int timeout:
The timeout parameter is expressed in seconds.
'''
request = HTTPRequest()
request.method = 'GET'
request.host = self._get_host()
request.path = _get_path()
request.query = [
('comp', 'list'),
('prefix', _str_or_none(prefix)),
('marker', _str_or_none(marker)),
('maxresults', _int_or_none(max_results)),
('include', _str_or_none(include)),
('timeout', _int_or_none(timeout))
]
response = self._perform_request(request)
return _convert_xml_to_containers(response)
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
request = HTTPRequest()
request.method = 'HEAD'
request.host = self._get_host()
request.path = _get_path(container_name, blob_name)
request.query = [
('snapshot', _str_or_none(snapshot)),
('timeout', _int_or_none(timeout)),
]
request.headers = [
('x-ms-lease-id', _str_or_none(lease_id)),
('If-Modified-Since', _datetime_to_utc_string(if_modified_since)),
('If-Unmodified-Since', _datetime_to_utc_string(if_unmodified_since)),
('If-Match', _str_or_none(if_match)),
('If-None-Match', _str_or_none(if_none_match)),
]
response = self._perform_request(request)
return _parse_blob(blob_name, snapshot, response)
'''
_validate_not_none('container_name', container_name)
_validate_not_none('lease_action', lease_action)
request = HTTPRequest()
request.method = 'PUT'
request.host = self._get_host()
request.path = _get_path(container_name)
request.query = [
('restype', 'container'),
('comp', 'lease'),
('timeout', _int_or_none(timeout)),
]
request.headers = [
('x-ms-lease-id', _str_or_none(lease_id)),
('x-ms-lease-action', _str_or_none(lease_action)),
('x-ms-lease-duration', _str_or_none(lease_duration)),
('x-ms-lease-break-period', _str_or_none(lease_break_period)),
('x-ms-proposed-lease-id', _str_or_none(proposed_lease_id)),
('If-Modified-Since', _datetime_to_utc_string(if_modified_since)),
('If-Unmodified-Since', _datetime_to_utc_string(if_unmodified_since)),
]
return self._perform_request(request)
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.authentication)
self._perform_request(request)
request = HTTPRequest()
request.method = 'PUT'
request.host = self._get_host()
request.path = _get_path(container_name, blob_name)
request.query = [('timeout', _int_or_none(timeout))]
request.headers = [
('x-ms-copy-source', _str_or_none(copy_source)),
('x-ms-meta-name-values', metadata),
('x-ms-source-if-modified-since',
_str_or_none(source_if_modified_since)),
('x-ms-source-if-unmodified-since',
_str_or_none(source_if_unmodified_since)),
('x-ms-source-if-match', _str_or_none(source_if_match)),
('x-ms-source-if-none-match',
_str_or_none(source_if_none_match)),
('If-Modified-Since', _datetime_to_utc_string(destination_if_modified_since)),
('If-Unmodified-Since', _datetime_to_utc_string(destination_if_unmodified_since)),
('If-Match', _str_or_none(destination_if_match)),
('If-None-Match', _str_or_none(destination_if_none_match)),
('x-ms-lease-id', _str_or_none(destination_lease_id)),
('x-ms-source-lease-id', _str_or_none(source_lease_id))
]
response = self._perform_request(request)
props = _parse_properties(response, BlobProperties)
return props.copy
The timeout parameter is expressed in seconds.
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
_validate_not_none('copy_id', copy_id)
request = HTTPRequest()
request.method = 'PUT'
request.host = self._get_host()
request.path = _get_path(container_name, blob_name)
request.query = [
('comp', 'copy'),
('copyid', _str(copy_id)),
('timeout', _int_or_none(timeout)),
]
request.headers = [
('x-ms-lease-id', _str_or_none(lease_id)),
('x-ms-copy-action', 'abort'),
]
self._perform_request(request)