Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
upload_block_blob,
upload_append_blob,
upload_page_blob)
from ._models import BlobType, BlobBlock, BlobProperties
from ._models import BlobType, BlobBlock, BlobProperties, BlobQueryError
from ._download import StorageStreamDownloader
from ._lease import BlobLeaseClient, get_access_conditions

Expand Down Expand Up @@ -750,6 +750,7 @@ def query_blob(self, query_expression, **kwargs):
:caption: select/project on blob/or blob snapshot data by providing simple query expressions.
"""
errors = kwargs.pop("on_error", None)
error_cls = kwargs.pop("error_cls", BlobQueryError)
encoding = kwargs.pop("encoding", None)
options, delimiter = self._quick_query_options(query_expression, **kwargs)
try:
Expand All @@ -763,7 +764,8 @@ def query_blob(self, query_expression, **kwargs):
record_delimiter=delimiter,
encoding=encoding,
headers=headers,
response=raw_response_body)
response=raw_response_body,
error_cls=error_cls)

@staticmethod
def _generic_delete_blob_options(delete_snapshots=False, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ async def get_properties(self, snapshot=None, version_id=None, timeout=None, req
'x-ms-tag-count': self._deserialize('long', response.headers.get('x-ms-tag-count')),
'x-ms-expiry-time': self._deserialize('rfc-1123', response.headers.get('x-ms-expiry-time')),
'x-ms-blob-sealed': self._deserialize('bool', response.headers.get('x-ms-blob-sealed')),
'x-ms-rehydrate-priority': self._deserialize('str', response.headers.get('x-ms-rehydrate-priority')),
'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
}
return cls(response, None, response_headers)
Expand Down Expand Up @@ -2257,7 +2258,7 @@ async def start_copy_from_url(self, copy_source, timeout=None, metadata=None, ti
return cls(response, None, response_headers)
start_copy_from_url.metadata = {'url': '/{containerName}/{blob}'}

async def copy_from_url(self, copy_source, timeout=None, metadata=None, tier=None, request_id=None, source_content_md5=None, blob_tags_string=None, seal_blob=None, source_modified_access_conditions=None, modified_access_conditions=None, lease_access_conditions=None, *, cls=None, **kwargs):
async def copy_from_url(self, copy_source, timeout=None, metadata=None, tier=None, request_id=None, source_content_md5=None, blob_tags_string=None, source_modified_access_conditions=None, modified_access_conditions=None, lease_access_conditions=None, *, cls=None, **kwargs):
"""The Copy From URL operation copies a blob or an internet resource to a
new blob. It will not return a response until the copy is complete.

Expand Down Expand Up @@ -2296,9 +2297,6 @@ async def copy_from_url(self, copy_source, timeout=None, metadata=None, tier=Non
:param blob_tags_string: Optional. Used to set blob tags in various
blob operations.
:type blob_tags_string: str
:param seal_blob: Overrides the sealed state of the destination blob.
Service version 2019-12-12 and newer.
:type seal_blob: bool
:param source_modified_access_conditions: Additional parameters for
the operation
:type source_modified_access_conditions:
Expand Down Expand Up @@ -2376,8 +2374,6 @@ async def copy_from_url(self, copy_source, timeout=None, metadata=None, tier=Non
header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray')
if blob_tags_string is not None:
header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str')
if seal_blob is not None:
header_parameters['x-ms-seal-blob'] = self._serialize.header("seal_blob", seal_blob, 'bool')
header_parameters['x-ms-requires-sync'] = self._serialize.header("self.x_ms_requires_sync", self.x_ms_requires_sync, 'str')
if source_if_modified_since is not None:
header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", source_if_modified_since, 'rfc-1123')
Expand Down Expand Up @@ -2505,7 +2501,7 @@ async def abort_copy_from_url(self, copy_id, timeout=None, request_id=None, leas
return cls(response, None, response_headers)
abort_copy_from_url.metadata = {'url': '/{containerName}/{blob}'}

async def set_tier(self, tier, snapshot=None, version_id=None, timeout=None, rehydrate_priority=None, request_id=None, lease_access_conditions=None, *, cls=None, **kwargs):
async def set_tier(self, tier, snapshot=None, version_id=None, timeout=None, rehydrate_priority=None, request_id=None, lease_access_conditions=None, modified_access_conditions=None, *, cls=None, **kwargs):
"""The Set Tier operation sets the tier on a blob. The operation is
allowed on a page blob in a premium storage account and on a block blob
in a blob storage account (locally redundant storage only). A premium
Expand Down Expand Up @@ -2545,6 +2541,10 @@ async def set_tier(self, tier, snapshot=None, version_id=None, timeout=None, reh
operation
:type lease_access_conditions:
~azure.storage.blob.models.LeaseAccessConditions
:param modified_access_conditions: Additional parameters for the
operation
:type modified_access_conditions:
~azure.storage.blob.models.ModifiedAccessConditions
:param callable cls: A custom type or function that will be passed the
direct response
:return: None or the result of cls(response)
Expand All @@ -2556,6 +2556,9 @@ async def set_tier(self, tier, snapshot=None, version_id=None, timeout=None, reh
lease_id = None
if lease_access_conditions is not None:
lease_id = lease_access_conditions.lease_id
if_tags = None
if modified_access_conditions is not None:
if_tags = modified_access_conditions.if_tags

comp = "tier"

Expand Down Expand Up @@ -2586,6 +2589,8 @@ async def set_tier(self, tier, snapshot=None, version_id=None, timeout=None, reh
header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
if lease_id is not None:
header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
if if_tags is not None:
header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", if_tags, 'str')

# Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@
'AccessTier',
'ArchiveStatus',
'BlobType',
'RehydratePriority',
'StorageErrorCode',
'GeoReplicationStatusType',
'QueryFormatType',
'AccessTierRequired',
'AccessTierOptional',
'PremiumPageBlobAccessTier',
'RehydratePriority',
'BlobExpiryOptions',
'BlockListType',
'DeleteSnapshotsOptionType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ class BlobType(str, Enum):
append_blob = "AppendBlob"


class RehydratePriority(str, Enum):

high = "High"
standard = "Standard"


class StorageErrorCode(str, Enum):

account_already_exists = "AccountAlreadyExists"
Expand Down Expand Up @@ -257,12 +263,6 @@ class PremiumPageBlobAccessTier(str, Enum):
p80 = "P80"


class RehydratePriority(str, Enum):

high = "High"
standard = "Standard"


class BlobExpiryOptions(str, Enum):

never_expire = "NeverExpire"
Expand Down Expand Up @@ -333,6 +333,8 @@ class AccountKind(str, Enum):
storage = "Storage"
blob_storage = "BlobStorage"
storage_v2 = "StorageV2"
file_storage = "FileStorage"
block_blob_storage = "BlockBlobStorage"


class SyncCopyStatusType(str, Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ class BlobPropertiesInternal(Model):
:type expires_on: datetime
:param is_sealed:
:type is_sealed: bool
:param rehydrate_priority: Possible values include: 'High', 'Standard'
:type rehydrate_priority: str or
~azure.storage.blob.models.RehydratePriority
"""

_validation = {
Expand Down Expand Up @@ -406,7 +409,8 @@ class BlobPropertiesInternal(Model):
'access_tier_change_time': {'key': 'AccessTierChangeTime', 'type': 'rfc-1123', 'xml': {'name': 'AccessTierChangeTime'}},
'tag_count': {'key': 'TagCount', 'type': 'int', 'xml': {'name': 'TagCount'}},
'expires_on': {'key': 'Expiry-Time', 'type': 'rfc-1123', 'xml': {'name': 'Expiry-Time'}},
'is_sealed': {'key': 'IsSealed', 'type': 'bool', 'xml': {'name': 'IsSealed'}},
'is_sealed': {'key': 'Sealed', 'type': 'bool', 'xml': {'name': 'Sealed'}},
'rehydrate_priority': {'key': 'RehydratePriority', 'type': 'str', 'xml': {'name': 'RehydratePriority'}},
}
_xml_map = {
'name': 'Properties'
Expand Down Expand Up @@ -449,6 +453,7 @@ def __init__(self, **kwargs):
self.tag_count = kwargs.get('tag_count', None)
self.expires_on = kwargs.get('expires_on', None)
self.is_sealed = kwargs.get('is_sealed', None)
self.rehydrate_priority = kwargs.get('rehydrate_priority', None)


class BlobTag(Model):
Expand Down Expand Up @@ -1755,6 +1760,9 @@ class StaticWebsite(Model):
:type index_document: str
:param error_document404_path: The absolute path of the custom 404 page
:type error_document404_path: str
:param default_index_document_path: Absolute path of the default index
page
:type default_index_document_path: str
"""

_validation = {
Expand All @@ -1765,6 +1773,7 @@ class StaticWebsite(Model):
'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
'index_document': {'key': 'IndexDocument', 'type': 'str', 'xml': {'name': 'IndexDocument'}},
'error_document404_path': {'key': 'ErrorDocument404Path', 'type': 'str', 'xml': {'name': 'ErrorDocument404Path'}},
'default_index_document_path': {'key': 'DefaultIndexDocumentPath', 'type': 'str', 'xml': {'name': 'DefaultIndexDocumentPath'}},
}
_xml_map = {
}
Expand All @@ -1774,6 +1783,7 @@ def __init__(self, **kwargs):
self.enabled = kwargs.get('enabled', None)
self.index_document = kwargs.get('index_document', None)
self.error_document404_path = kwargs.get('error_document404_path', None)
self.default_index_document_path = kwargs.get('default_index_document_path', None)


class StorageError(Model):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ class BlobPropertiesInternal(Model):
:type expires_on: datetime
:param is_sealed:
:type is_sealed: bool
:param rehydrate_priority: Possible values include: 'High', 'Standard'
:type rehydrate_priority: str or
~azure.storage.blob.models.RehydratePriority
"""

_validation = {
Expand Down Expand Up @@ -406,13 +409,14 @@ class BlobPropertiesInternal(Model):
'access_tier_change_time': {'key': 'AccessTierChangeTime', 'type': 'rfc-1123', 'xml': {'name': 'AccessTierChangeTime'}},
'tag_count': {'key': 'TagCount', 'type': 'int', 'xml': {'name': 'TagCount'}},
'expires_on': {'key': 'Expiry-Time', 'type': 'rfc-1123', 'xml': {'name': 'Expiry-Time'}},
'is_sealed': {'key': 'IsSealed', 'type': 'bool', 'xml': {'name': 'IsSealed'}},
'is_sealed': {'key': 'Sealed', 'type': 'bool', 'xml': {'name': 'Sealed'}},
'rehydrate_priority': {'key': 'RehydratePriority', 'type': 'str', 'xml': {'name': 'RehydratePriority'}},
}
_xml_map = {
'name': 'Properties'
}

def __init__(self, *, last_modified, etag: str, creation_time=None, content_length: int=None, content_type: str=None, content_encoding: str=None, content_language: str=None, content_md5: bytearray=None, content_disposition: str=None, cache_control: str=None, blob_sequence_number: int=None, blob_type=None, lease_status=None, lease_state=None, lease_duration=None, copy_id: str=None, copy_status=None, copy_source: str=None, copy_progress: str=None, copy_completion_time=None, copy_status_description: str=None, server_encrypted: bool=None, incremental_copy: bool=None, destination_snapshot: str=None, deleted_time=None, remaining_retention_days: int=None, access_tier=None, access_tier_inferred: bool=None, archive_status=None, customer_provided_key_sha256: str=None, encryption_scope: str=None, access_tier_change_time=None, tag_count: int=None, expires_on=None, is_sealed: bool=None, **kwargs) -> None:
def __init__(self, *, last_modified, etag: str, creation_time=None, content_length: int=None, content_type: str=None, content_encoding: str=None, content_language: str=None, content_md5: bytearray=None, content_disposition: str=None, cache_control: str=None, blob_sequence_number: int=None, blob_type=None, lease_status=None, lease_state=None, lease_duration=None, copy_id: str=None, copy_status=None, copy_source: str=None, copy_progress: str=None, copy_completion_time=None, copy_status_description: str=None, server_encrypted: bool=None, incremental_copy: bool=None, destination_snapshot: str=None, deleted_time=None, remaining_retention_days: int=None, access_tier=None, access_tier_inferred: bool=None, archive_status=None, customer_provided_key_sha256: str=None, encryption_scope: str=None, access_tier_change_time=None, tag_count: int=None, expires_on=None, is_sealed: bool=None, rehydrate_priority=None, **kwargs) -> None:
super(BlobPropertiesInternal, self).__init__(**kwargs)
self.creation_time = creation_time
self.last_modified = last_modified
Expand Down Expand Up @@ -449,6 +453,7 @@ def __init__(self, *, last_modified, etag: str, creation_time=None, content_leng
self.tag_count = tag_count
self.expires_on = expires_on
self.is_sealed = is_sealed
self.rehydrate_priority = rehydrate_priority


class BlobTag(Model):
Expand Down Expand Up @@ -1755,6 +1760,9 @@ class StaticWebsite(Model):
:type index_document: str
:param error_document404_path: The absolute path of the custom 404 page
:type error_document404_path: str
:param default_index_document_path: Absolute path of the default index
page
:type default_index_document_path: str
"""

_validation = {
Expand All @@ -1765,15 +1773,17 @@ class StaticWebsite(Model):
'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
'index_document': {'key': 'IndexDocument', 'type': 'str', 'xml': {'name': 'IndexDocument'}},
'error_document404_path': {'key': 'ErrorDocument404Path', 'type': 'str', 'xml': {'name': 'ErrorDocument404Path'}},
'default_index_document_path': {'key': 'DefaultIndexDocumentPath', 'type': 'str', 'xml': {'name': 'DefaultIndexDocumentPath'}},
}
_xml_map = {
}

def __init__(self, *, enabled: bool, index_document: str=None, error_document404_path: str=None, **kwargs) -> None:
def __init__(self, *, enabled: bool, index_document: str=None, error_document404_path: str=None, default_index_document_path: str=None, **kwargs) -> None:
super(StaticWebsite, self).__init__(**kwargs)
self.enabled = enabled
self.index_document = index_document
self.error_document404_path = error_document404_path
self.default_index_document_path = default_index_document_path


class StorageError(Model):
Expand Down
Loading