Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:type property_resolver: func(pk, rk, prop_name, prop_value, service_edm_type)
:param int timeout:
The server timeout, expressed in seconds.
:return: A list of entities, potentially with a next_marker property.
:rtype: list(:class:`~azure.storage.table.models.Entity`)
'''
_validate_not_none('table_name', table_name)
_validate_not_none('accept', accept)
next_partition_key = None if marker is None else marker.get('nextpartitionkey')
next_row_key = None if marker is None else marker.get('nextrowkey')
request = HTTPRequest()
request.method = 'GET'
request.host_locations = self._get_host_locations(secondary=True)
request.path = '/' + _to_str(table_name) + '()'
request.headers = {'Accept': _to_str(accept)}
request.query = {
'$filter': _to_str(filter),
'$select': _to_str(select),
'$top': _int_to_str(max_results),
'NextPartitionKey': _to_str(next_partition_key),
'NextRowKey': _to_str(next_row_key),
'timeout': _int_to_str(timeout),
}
return self._perform_request(request, _convert_json_response_to_entities,
[property_resolver, self.require_encryption,
self.key_encryption_key, self.key_resolver_function],
operation_context=_context)
in a subsequent call to request the next portion of the list of
tables. The marker value is opaque to the client.
:type marker: obj
:param int timeout:
The server timeout, expressed in seconds.
:return: A list of tables, potentially with a next_marker property.
:rtype: list(:class:`~azure.storage.common.models.table.Table`)
'''
request = HTTPRequest()
request.method = 'GET'
request.host_locations = self._get_host_locations(secondary=True)
request.path = '/Tables'
request.headers = {'Accept': TablePayloadFormat.JSON_NO_METADATA}
request.query = {
'$top': _int_to_str(max_results),
'NextTableName': _to_str(marker),
'timeout': _int_to_str(timeout),
}
return self._perform_request(request, _convert_json_response_to_tables,
operation_context=_context)
request.method = 'PUT'
request.host_locations = self._get_host_locations()
request.path = _get_path(container_name, blob_name)
request.query = {
'comp': 'page',
'timeout': _int_to_str(timeout),
}
request.headers = {
'x-ms-page-write': 'clear',
'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)
return self._perform_request(request, _parse_page_properties)
:param str lease_id:
Required if the blob has an active lease.
:param int timeout:
The timeout parameter is expressed in seconds.
:return: list committed and/or uncommitted blocks for Block Blob
:rtype: :class:`~azure.storage.blob.models.BlobBlockList`
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
request = HTTPRequest()
request.method = 'GET'
request.host_locations = self._get_host_locations(secondary=True)
request.path = _get_path(container_name, blob_name)
request.query = {
'comp': 'blocklist',
'snapshot': _to_str(snapshot),
'blocklisttype': _to_str(block_list_type),
'timeout': _int_to_str(timeout),
}
request.headers = {'x-ms-lease-id': _to_str(lease_id)}
return self._perform_request(request, _convert_xml_to_block_list)
when uploading entire blob contents immediately follows creation of the blob.
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
_validate_not_none('content_length', content_length)
request = HTTPRequest()
request.method = 'PUT'
request.host_locations = self._get_host_locations()
request.path = _get_path(container_name, blob_name)
request.query = {'timeout': _int_to_str(timeout)}
request.headers = {
'x-ms-blob-type': _to_str(self.blob_type),
'x-ms-blob-content-length': _to_str(content_length),
'x-ms-lease-id': _to_str(lease_id),
'x-ms-blob-sequence-number': _to_str(sequence_number),
'x-ms-access-tier': _to_str(premium_page_blob_tier),
'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)
}
_add_metadata_headers(metadata, request)
if content_settings is not None:
request.headers.update(content_settings._to_headers())
if encryption_data is not None:
request.headers['x-ms-meta-encryptiondata'] = encryption_data
return self._perform_request(request, _parse_base_properties)
get_key_wrap_algorithm()--returns the algorithm used to wrap the specified symmetric key.
get_kid()--returns a string key id for this key-encryption-key.
:param function(partition_key, row_key, property_name) encryption_resolver:
A function that takes in an entities partition key, row key, and property name and returns
a boolean that indicates whether that property should be encrypted.
'''
_validate_not_none('if_match', if_match)
_validate_entity(entity, key_encryption_key is not None)
_validate_encryption_required(encryption_required, key_encryption_key)
request = HTTPRequest()
request.method = 'PUT'
request.headers = {
_DEFAULT_CONTENT_TYPE_HEADER[0]: _DEFAULT_CONTENT_TYPE_HEADER[1],
_DEFAULT_ACCEPT_HEADER[0]: _DEFAULT_ACCEPT_HEADER[1],
'If-Match': _to_str(if_match),
}
if (key_encryption_key):
entity = _encrypt_entity(entity, key_encryption_key, encryption_resolver)
request.body = _get_request_body(_convert_entity_to_json(entity))
return request
def _to_headers(self):
return {
'x-ms-blob-cache-control': _to_str(self.cache_control),
'x-ms-blob-content-type': _to_str(self.content_type),
'x-ms-blob-content-disposition': _to_str(self.content_disposition),
'x-ms-blob-content-md5': _to_str(self.content_md5),
'x-ms-blob-content-encoding': _to_str(self.content_encoding),
'x-ms-blob-content-language': _to_str(self.content_language),
}
allows for encryption or other such special behavior because
it is safely handled by the library. These behaviors are
prohibited in the public version of this function.
'''
_validate_not_none('container_name', container_name)
_validate_not_none('blob_name', blob_name)
_validate_not_none('block', block)
_validate_not_none('block_id', block_id)
request = HTTPRequest()
request.method = 'PUT'
request.host_locations = self._get_host_locations()
request.path = _get_path(container_name, blob_name)
request.query = {
'comp': 'block',
'blockid': _encode_base64(_to_str(block_id)),
'timeout': _int_to_str(timeout),
}
request.headers = {
'x-ms-lease-id': _to_str(lease_id)
}
request.body = _get_data_bytes_or_stream_only('block', block)
if hasattr(request.body, 'read'):
if _len_plus(request.body) is None:
try:
data = b''
for chunk in iter(lambda: request.body.read(4096), b""):
data += chunk
request.body = data
except AttributeError:
raise ValueError(_ERROR_VALUE_SHOULD_BE_STREAM.format('request.body'))
:param int timeout:
The timeout parameter is expressed in seconds.
:param str snapshot:
A string that represents the snapshot version, if applicable.
"""
_validate_not_none('share_name', share_name)
request = HTTPRequest()
request.method = 'GET'
request.host_locations = self._get_host_locations()
request.path = _get_path(share_name, directory_name, file_name)
request.query = {
'comp': 'listhandles',
'marker': _to_str(marker),
'maxresults': _int_to_str(max_results),
'timeout': _int_to_str(timeout),
'sharesnapshot': _to_str(snapshot)
}
request.headers = {
'x-ms-recursive': _to_str(recursive)
}
return self._perform_request(request, _convert_xml_to_handles,
operation_context=_context)
def _get_entity(partition_key, row_key, select, accept):
'''
Constructs a get entity request.
'''
_validate_not_none('partition_key', partition_key)
_validate_not_none('row_key', row_key)
_validate_not_none('accept', accept)
request = HTTPRequest()
request.method = 'GET'
request.headers = {'Accept': _to_str(accept)}
request.query = {'$select': _to_str(select)}
return request