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
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-blob/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log azure-storage-blob

## Version 12.0.0:
## Version 12.0.0b5:

**Breaking changes**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def upload_blob(
:param metadata:
Name-value pairs associated with the blob as metadata.
:type metadata: dict(str, str)
:param str encoding:
:keyword str encoding:
Defaults to UTF-8.
:keyword bool overwrite: Whether the blob to be uploaded should overwrite the current data.
If True, upload_blob will silently overwrite the existing data. If set to False, the
Expand Down Expand Up @@ -808,10 +808,6 @@ def delete_blob(
:param blob: The blob with which to interact. If specified, this value will override
a blob value specified in the blob URL.
:type blob: str or ~azure.storage.blob.BlobProperties
:param str delete_snapshots:
Required if the blob has associated snapshots. Values include:
- "only": Deletes only the blobs snapshots.
- "include": Deletes the blob along with all snapshots.
:param str delete_snapshots:
Required if the blob has associated snapshots. Values include:
- "only": Deletes only the blobs snapshots.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def _create_pipeline(self, credential, **kwargs):
policies = [
QueueMessagePolicy(),
config.headers_policy,
config.proxy_policy,
config.user_agent_policy,
StorageContentValidation(),
StorageRequestHook(**kwargs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def _create_pipeline(self, credential, **kwargs):
policies = [
QueueMessagePolicy(),
config.headers_policy,
config.proxy_policy,
config.user_agent_policy,
StorageContentValidation(),
StorageRequestHook(**kwargs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = "12.0.0b4"
VERSION = "12.0.0b5"
1 change: 1 addition & 0 deletions sdk/storage/azure-storage-blob/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-file/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log azure-storage-file

## Version 12.0.0:
## Version 12.0.0b5:

**Breaking changes**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from azure.core.configuration import Configuration
from azure.core.exceptions import HttpResponseError
from azure.core.pipeline import Pipeline
from azure.core.pipeline.transport import RequestsTransport, HttpTransport # pylint: disable=unused-import
from azure.core.pipeline.transport import RequestsTransport, HttpTransport
from azure.core.pipeline.policies import (
RedirectPolicy,
ContentDecodePolicy,
Expand All @@ -54,7 +54,7 @@
ExponentialRetry,
)
from .._generated.models import StorageErrorException
from .response_handlers import process_storage_error
from .response_handlers import process_storage_error, PartialBatchErrorException


_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -178,6 +178,7 @@ def _create_pipeline(self, credential, **kwargs):
policies = [
QueueMessagePolicy(),
config.headers_policy,
config.proxy_policy,
config.user_agent_policy,
StorageContentValidation(),
StorageRequestHook(**kwargs),
Expand All @@ -199,6 +200,8 @@ def _batch_send(
):
"""Given a series of request, do a Storage batch call.
"""
# Pop it here, so requests doesn't feel bad about additional kwarg
raise_on_any_failure = kwargs.pop("raise_on_any_failure", True)
request = self._client._client.post( # pylint: disable=protected-access
url='https://{}/?comp=batch'.format(self.primary_hostname),
headers={
Expand All @@ -222,7 +225,17 @@ def _batch_send(
try:
if response.status_code not in [202]:
raise HttpResponseError(response=response)
return response.parts()
parts = response.parts()
if raise_on_any_failure:
parts = list(response.parts())
if any(p for p in parts if not 200 <= p.status_code < 300):
error = PartialBatchErrorException(
message="There is a partial failure in the batch operation.",
response=response, parts=parts
)
raise error
return iter(parts)
return parts
except StorageErrorException as error:
process_storage_error(error)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
TYPE_CHECKING
)
import logging

from azure.core.pipeline import AsyncPipeline
from azure.core.async_paging import AsyncList
from azure.core.exceptions import HttpResponseError
from azure.core.pipeline.policies import (
ContentDecodePolicy,
Expand All @@ -34,13 +34,12 @@
from .policies_async import AsyncStorageResponseHook

from .._generated.models import StorageErrorException
from .response_handlers import process_storage_error
from .response_handlers import process_storage_error, PartialBatchErrorException

if TYPE_CHECKING:
from azure.core.pipeline import Pipeline
from azure.core.pipeline.transport import HttpRequest
from azure.core.configuration import Configuration

_LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -83,6 +82,7 @@ def _create_pipeline(self, credential, **kwargs):
policies = [
QueueMessagePolicy(),
config.headers_policy,
config.proxy_policy,
config.user_agent_policy,
StorageContentValidation(),
StorageRequestHook(**kwargs),
Expand All @@ -104,6 +104,8 @@ async def _batch_send(
):
"""Given a series of request, do a Storage batch call.
"""
# Pop it here, so requests doesn't feel bad about additional kwarg
raise_on_any_failure = kwargs.pop("raise_on_any_failure", True)
request = self._client._client.post( # pylint: disable=protected-access
url='https://{}/?comp=batch'.format(self.primary_hostname),
headers={
Expand All @@ -127,7 +129,19 @@ async def _batch_send(
try:
if response.status_code not in [202]:
raise HttpResponseError(response=response)
return response.parts() # Return an AsyncIterator
parts = response.parts() # Return an AsyncIterator
if raise_on_any_failure:
parts_list = []
async for part in parts:
parts_list.append(part)
if any(p for p in parts_list if not 200 <= p.status_code < 300):
error = PartialBatchErrorException(
message="There is a partial failure in the batch operation.",
response=response, parts=parts_list
)
raise error
return AsyncList(parts_list)
return parts
except StorageErrorException as error:
process_storage_error(error)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@
_LOGGER = logging.getLogger(__name__)


class PartialBatchErrorException(HttpResponseError):
"""There is a partial failure in batch operations.

:param message: The message of the exception.
:param response: Server response to be deserialized.
:param parts: A list of the parts in multipart response.
"""

def __init__(self, message, response, parts):
self.parts = parts
super(PartialBatchErrorException, self).__init__(message=message, response=response)


def parse_length_from_content_range(content_range):
'''
Parses the blob length from the content range header: bytes 1-3/65537
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = '12.0.0b4'
VERSION = '12.0.0b5'
1 change: 1 addition & 0 deletions sdk/storage/azure-storage-file/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-queue/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log azure-storage-queue

## Version 12.0.0:
## Version 12.0.0b5:

**Breaking changes**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from azure.core.configuration import Configuration
from azure.core.exceptions import HttpResponseError
from azure.core.pipeline import Pipeline
from azure.core.pipeline.transport import RequestsTransport, HttpTransport # pylint: disable=unused-import
from azure.core.pipeline.transport import RequestsTransport, HttpTransport
from azure.core.pipeline.policies import (
RedirectPolicy,
ContentDecodePolicy,
Expand All @@ -54,7 +54,7 @@
ExponentialRetry,
)
from .._generated.models import StorageErrorException
from .response_handlers import process_storage_error
from .response_handlers import process_storage_error, PartialBatchErrorException


_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -178,6 +178,7 @@ def _create_pipeline(self, credential, **kwargs):
policies = [
QueueMessagePolicy(),
config.headers_policy,
config.proxy_policy,
config.user_agent_policy,
StorageContentValidation(),
StorageRequestHook(**kwargs),
Expand All @@ -199,6 +200,8 @@ def _batch_send(
):
"""Given a series of request, do a Storage batch call.
"""
# Pop it here, so requests doesn't feel bad about additional kwarg
raise_on_any_failure = kwargs.pop("raise_on_any_failure", True)
request = self._client._client.post( # pylint: disable=protected-access
url='https://{}/?comp=batch'.format(self.primary_hostname),
headers={
Expand All @@ -222,7 +225,17 @@ def _batch_send(
try:
if response.status_code not in [202]:
raise HttpResponseError(response=response)
return response.parts()
parts = response.parts()
if raise_on_any_failure:
parts = list(response.parts())
if any(p for p in parts if not 200 <= p.status_code < 300):
error = PartialBatchErrorException(
message="There is a partial failure in the batch operation.",
response=response, parts=parts
)
raise error
return iter(parts)
return parts
except StorageErrorException as error:
process_storage_error(error)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
TYPE_CHECKING
)
import logging

from azure.core.pipeline import AsyncPipeline
from azure.core.async_paging import AsyncList
from azure.core.exceptions import HttpResponseError
from azure.core.pipeline.policies import (
ContentDecodePolicy,
Expand All @@ -34,13 +34,12 @@
from .policies_async import AsyncStorageResponseHook

from .._generated.models import StorageErrorException
from .response_handlers import process_storage_error
from .response_handlers import process_storage_error, PartialBatchErrorException

if TYPE_CHECKING:
from azure.core.pipeline import Pipeline
from azure.core.pipeline.transport import HttpRequest
from azure.core.configuration import Configuration

_LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -83,6 +82,7 @@ def _create_pipeline(self, credential, **kwargs):
policies = [
QueueMessagePolicy(),
config.headers_policy,
config.proxy_policy,
config.user_agent_policy,
StorageContentValidation(),
StorageRequestHook(**kwargs),
Expand All @@ -104,6 +104,8 @@ async def _batch_send(
):
"""Given a series of request, do a Storage batch call.
"""
# Pop it here, so requests doesn't feel bad about additional kwarg
raise_on_any_failure = kwargs.pop("raise_on_any_failure", True)
request = self._client._client.post( # pylint: disable=protected-access
url='https://{}/?comp=batch'.format(self.primary_hostname),
headers={
Expand All @@ -127,7 +129,19 @@ async def _batch_send(
try:
if response.status_code not in [202]:
raise HttpResponseError(response=response)
return response.parts() # Return an AsyncIterator
parts = response.parts() # Return an AsyncIterator
if raise_on_any_failure:
parts_list = []
async for part in parts:
parts_list.append(part)
if any(p for p in parts_list if not 200 <= p.status_code < 300):
error = PartialBatchErrorException(
message="There is a partial failure in the batch operation.",
response=response, parts=parts_list
)
raise error
return AsyncList(parts_list)
return parts
except StorageErrorException as error:
process_storage_error(error)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@
_LOGGER = logging.getLogger(__name__)


class PartialBatchErrorException(HttpResponseError):
"""There is a partial failure in batch operations.

:param message: The message of the exception.
:param response: Server response to be deserialized.
:param parts: A list of the parts in multipart response.
"""

def __init__(self, message, response, parts):
self.parts = parts
super(PartialBatchErrorException, self).__init__(message=message, response=response)


def parse_length_from_content_range(content_range):
'''
Parses the blob length from the content range header: bytes 1-3/65537
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "12.0.0b4"
VERSION = "12.0.0b5"
1 change: 1 addition & 0 deletions sdk/storage/azure-storage-queue/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
Expand Down