From 1ca37b47d156ed76922835e7097ee55396bf2fc5 Mon Sep 17 00:00:00 2001
From: tasherif-msft <69483382+tasherif-msft@users.noreply.github.com>
Date: Mon, 18 Jan 2021 00:16:53 -0800
Subject: [PATCH] [Queues] Generated Queues using newest autorest version
(#16148)
* generated and removed StorageErrorException
* fixed all failing tests
* fixed failing test
* fixed failing test
* removed import
---
.../azure/storage/queue/_deserialize.py | 3 +-
.../storage/queue/_generated/__init__.py | 16 +-
.../queue/_generated/_azure_queue_storage.py | 46 +-
.../queue/_generated/_configuration.py | 46 +-
.../storage/queue/_generated/aio/__init__.py | 9 +-
...orage_async.py => _azure_queue_storage.py} | 61 +-
...nfiguration_async.py => _configuration.py} | 43 +-
.../__init__.py | 15 +-
.../aio/operations/_message_id_operations.py | 205 +++++++
.../aio/operations/_messages_operations.py | 365 ++++++++++++
.../aio/operations/_queue_operations.py | 481 +++++++++++++++
.../aio/operations/_service_operations.py | 361 ++++++++++++
.../_message_id_operations_async.py | 184 ------
.../_messages_operations_async.py | 350 -----------
.../_queue_operations_async.py | 432 --------------
.../_service_operations_async.py | 349 -----------
.../queue/_generated/models/__init__.py | 48 +-
.../models/_azure_queue_storage_enums.py | 156 ++---
.../queue/_generated/models/_models.py | 526 ++++++++---------
.../queue/_generated/models/_models_py3.py | 546 +++++++++--------
.../queue/_generated/operations/__init__.py | 7 +-
.../operations/_message_id_operations.py | 231 ++++----
.../operations/_messages_operations.py | 443 +++++++-------
.../operations/_queue_operations.py | 551 ++++++++++--------
.../operations/_service_operations.py | 434 +++++++-------
.../azure/storage/queue/_generated/py.typed | 1 +
.../azure/storage/queue/_generated/version.py | 13 -
.../azure/storage/queue/_message_encoding.py | 1 +
.../azure/storage/queue/_models.py | 6 +-
.../azure/storage/queue/_queue_client.py | 34 +-
.../storage/queue/_queue_service_client.py | 14 +-
.../storage/queue/_shared/base_client.py | 3 +-
.../queue/_shared/base_client_async.py | 3 +-
.../azure/storage/queue/_shared/constants.py | 4 +-
.../azure/storage/queue/_shared/encryption.py | 1 +
.../queue/_shared/response_handlers.py | 7 +-
.../azure/storage/queue/aio/_models.py | 6 +-
.../storage/queue/aio/_queue_client_async.py | 33 +-
.../queue/aio/_queue_service_client_async.py | 13 +-
39 files changed, 3153 insertions(+), 2894 deletions(-)
rename sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/{_azure_queue_storage_async.py => _azure_queue_storage.py} (58%)
rename sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/{_configuration_async.py => _configuration.py} (73%)
rename sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/{operations_async => operations}/__init__.py (64%)
create mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py
create mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py
create mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py
create mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_service_operations.py
delete mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations_async/_message_id_operations_async.py
delete mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations_async/_messages_operations_async.py
delete mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations_async/_queue_operations_async.py
delete mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations_async/_service_operations_async.py
create mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/py.typed
delete mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/version.py
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_deserialize.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_deserialize.py
index 893e2558accf..7eda92e8a84b 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_deserialize.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_deserialize.py
@@ -12,7 +12,7 @@
def deserialize_metadata(response, obj, headers):
- raw_metadata = {k: v for k, v in response.headers.items() if k.startswith("x-ms-meta-")}
+ raw_metadata = {k: v for k, v in response.http_response.headers.items() if k.startswith("x-ms-meta-")}
return {k[10:]: v for k, v in raw_metadata.items()}
@@ -26,6 +26,7 @@ def deserialize_queue_properties(response, obj, headers):
def deserialize_queue_creation(response, obj, headers):
+ response = response.http_response
if response.status_code == 204:
error_code = StorageErrorCode.queue_already_exists
error = ResourceExistsError(
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/__init__.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/__init__.py
index 1ee3b7536cf5..2519a661f749 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/__init__.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/__init__.py
@@ -1,18 +1,16 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._azure_queue_storage import AzureQueueStorage
__all__ = ['AzureQueueStorage']
-from .version import VERSION
-
-__version__ = VERSION
-
+try:
+ from ._patch import patch_sdk # type: ignore
+ patch_sdk()
+except ImportError:
+ pass
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py
index e441ecb93e52..1248b58b7add 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py
@@ -1,19 +1,21 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+
from azure.core import PipelineClient
-from msrest import Serializer, Deserializer
+from msrest import Deserializer, Serializer
+
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any
from ._configuration import AzureQueueStorageConfiguration
-from azure.core.exceptions import map_error
from .operations import ServiceOperations
from .operations import QueueOperations
from .operations import MessagesOperations
@@ -22,32 +24,33 @@
class AzureQueueStorage(object):
- """AzureQueueStorage
+ """AzureQueueStorage.
-
- :ivar service: Service operations
+ :ivar service: ServiceOperations operations
:vartype service: azure.storage.queue.operations.ServiceOperations
- :ivar queue: Queue operations
+ :ivar queue: QueueOperations operations
:vartype queue: azure.storage.queue.operations.QueueOperations
- :ivar messages: Messages operations
+ :ivar messages: MessagesOperations operations
:vartype messages: azure.storage.queue.operations.MessagesOperations
- :ivar message_id: MessageId operations
+ :ivar message_id: MessageIdOperations operations
:vartype message_id: azure.storage.queue.operations.MessageIdOperations
-
- :param url: The URL of the service account, queue or message that is the
- targe of the desired operation.
+ :param url: The URL of the service account, queue or message that is the targe of the desired operation.
:type url: str
"""
- def __init__(self, url, **kwargs):
-
+ def __init__(
+ self,
+ url, # type: str
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
base_url = '{url}'
self._config = AzureQueueStorageConfiguration(url, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
- self.api_version = '2018-03-28'
self._serialize = Serializer(client_models)
+ self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)
self.service = ServiceOperations(
@@ -60,9 +63,14 @@ def __init__(self, url, **kwargs):
self._client, self._config, self._serialize, self._deserialize)
def close(self):
+ # type: () -> None
self._client.close()
+
def __enter__(self):
+ # type: () -> AzureQueueStorage
self._client.__enter__()
return self
+
def __exit__(self, *exc_details):
+ # type: (Any) -> None
self._client.__exit__(*exc_details)
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py
index 75443cb798a4..530cb1caf1ed 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py
@@ -1,52 +1,58 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
-from .version import VERSION
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any
+VERSION = "unknown"
class AzureQueueStorageConfiguration(Configuration):
- """Configuration for AzureQueueStorage
+ """Configuration for AzureQueueStorage.
+
Note that all parameters used to create this instance are saved as instance
attributes.
- :param url: The URL of the service account, queue or message that is the
- targe of the desired operation.
+ :param url: The URL of the service account, queue or message that is the targe of the desired operation.
:type url: str
- :ivar version: Specifies the version of the operation to use for this
- request.
- :type version: str
"""
- def __init__(self, url, **kwargs):
-
+ def __init__(
+ self,
+ url, # type: str
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
if url is None:
raise ValueError("Parameter 'url' must not be None.")
-
super(AzureQueueStorageConfiguration, self).__init__(**kwargs)
- self._configure(**kwargs)
-
- self.user_agent_policy.add_user_agent('azsdk-python-azurequeuestorage/{}'.format(VERSION))
- self.generate_client_request_id = True
self.url = url
self.version = "2018-03-28"
+ kwargs.setdefault('sdk_moniker', 'azurequeuestorage/{}'.format(VERSION))
+ self._configure(**kwargs)
- def _configure(self, **kwargs):
+ def _configure(
+ self,
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
+ self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
+ self.authentication_policy = kwargs.get('authentication_policy')
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/__init__.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/__init__.py
index a6c00c21eb19..c42c1a4002a7 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/__init__.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/__init__.py
@@ -1,13 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from ._azure_queue_storage_async import AzureQueueStorage
+from ._azure_queue_storage import AzureQueueStorage
__all__ = ['AzureQueueStorage']
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py
similarity index 58%
rename from sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage_async.py
rename to sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py
index 9d803607d1a2..3b7bb2074356 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage_async.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py
@@ -1,54 +1,51 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import Any
+
from azure.core import AsyncPipelineClient
-from msrest import Serializer, Deserializer
+from msrest import Deserializer, Serializer
-from ._configuration_async import AzureQueueStorageConfiguration
-from azure.core.exceptions import map_error
-from .operations_async import ServiceOperations
-from .operations_async import QueueOperations
-from .operations_async import MessagesOperations
-from .operations_async import MessageIdOperations
+from ._configuration import AzureQueueStorageConfiguration
+from .operations import ServiceOperations
+from .operations import QueueOperations
+from .operations import MessagesOperations
+from .operations import MessageIdOperations
from .. import models
class AzureQueueStorage(object):
- """AzureQueueStorage
-
-
- :ivar service: Service operations
- :vartype service: azure.storage.queue.aio.operations_async.ServiceOperations
- :ivar queue: Queue operations
- :vartype queue: azure.storage.queue.aio.operations_async.QueueOperations
- :ivar messages: Messages operations
- :vartype messages: azure.storage.queue.aio.operations_async.MessagesOperations
- :ivar message_id: MessageId operations
- :vartype message_id: azure.storage.queue.aio.operations_async.MessageIdOperations
+ """AzureQueueStorage.
- :param url: The URL of the service account, queue or message that is the
- targe of the desired operation.
+ :ivar service: ServiceOperations operations
+ :vartype service: azure.storage.queue.aio.operations.ServiceOperations
+ :ivar queue: QueueOperations operations
+ :vartype queue: azure.storage.queue.aio.operations.QueueOperations
+ :ivar messages: MessagesOperations operations
+ :vartype messages: azure.storage.queue.aio.operations.MessagesOperations
+ :ivar message_id: MessageIdOperations operations
+ :vartype message_id: azure.storage.queue.aio.operations.MessageIdOperations
+ :param url: The URL of the service account, queue or message that is the targe of the desired operation.
:type url: str
"""
def __init__(
- self, url, **kwargs):
-
+ self,
+ url: str,
+ **kwargs: Any
+ ) -> None:
base_url = '{url}'
self._config = AzureQueueStorageConfiguration(url, **kwargs)
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
- self.api_version = '2018-03-28'
self._serialize = Serializer(client_models)
+ self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)
self.service = ServiceOperations(
@@ -60,10 +57,12 @@ def __init__(
self.message_id = MessageIdOperations(
self._client, self._config, self._serialize, self._deserialize)
- async def close(self):
+ async def close(self) -> None:
await self._client.close()
- async def __aenter__(self):
+
+ async def __aenter__(self) -> "AzureQueueStorage":
await self._client.__aenter__()
return self
- async def __aexit__(self, *exc_details):
+
+ async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py
similarity index 73%
rename from sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration_async.py
rename to sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py
index 5cbe3a2db1e0..ecd33f8672be 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration_async.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py
@@ -1,53 +1,52 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import Any
+
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
-from ..version import VERSION
-
+VERSION = "unknown"
class AzureQueueStorageConfiguration(Configuration):
- """Configuration for AzureQueueStorage
+ """Configuration for AzureQueueStorage.
+
Note that all parameters used to create this instance are saved as instance
attributes.
- :param url: The URL of the service account, queue or message that is the
- targe of the desired operation.
+ :param url: The URL of the service account, queue or message that is the targe of the desired operation.
:type url: str
- :ivar version: Specifies the version of the operation to use for this
- request.
- :type version: str
"""
- def __init__(self, url, **kwargs):
-
+ def __init__(
+ self,
+ url: str,
+ **kwargs: Any
+ ) -> None:
if url is None:
raise ValueError("Parameter 'url' must not be None.")
-
super(AzureQueueStorageConfiguration, self).__init__(**kwargs)
- self._configure(**kwargs)
-
- self.user_agent_policy.add_user_agent('azsdk-python-azurequeuestorage/{}'.format(VERSION))
- self.generate_client_request_id = True
- self.accept_language = None
self.url = url
self.version = "2018-03-28"
+ kwargs.setdefault('sdk_moniker', 'azurequeuestorage/{}'.format(VERSION))
+ self._configure(**kwargs)
- def _configure(self, **kwargs):
+ def _configure(
+ self,
+ **kwargs: Any
+ ) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
+ self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
+ self.authentication_policy = kwargs.get('authentication_policy')
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations_async/__init__.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/__init__.py
similarity index 64%
rename from sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations_async/__init__.py
rename to sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/__init__.py
index 6d9d66736b9d..c0abe554a930 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations_async/__init__.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/__init__.py
@@ -1,18 +1,15 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from ._service_operations_async import ServiceOperations
-from ._queue_operations_async import QueueOperations
-from ._messages_operations_async import MessagesOperations
-from ._message_id_operations_async import MessageIdOperations
+from ._service_operations import ServiceOperations
+from ._queue_operations import QueueOperations
+from ._messages_operations import MessagesOperations
+from ._message_id_operations import MessageIdOperations
__all__ = [
'ServiceOperations',
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py
new file mode 100644
index 000000000000..c84b04e8db5c
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py
@@ -0,0 +1,205 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from typing import Any, Callable, Dict, Generic, Optional, TypeVar
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+
+from ... import models as _models
+
+T = TypeVar('T')
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+class MessageIdOperations:
+ """MessageIdOperations async operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.queue.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer) -> None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def update(
+ self,
+ pop_receipt: str,
+ visibilitytimeout: int,
+ timeout: Optional[int] = None,
+ request_id_parameter: Optional[str] = None,
+ queue_message: Optional["_models.QueueMessage"] = None,
+ **kwargs
+ ) -> None:
+ """The Update operation was introduced with version 2011-08-18 of the Queue service API. The
+ Update Message operation updates the visibility timeout of a message. You can also use this
+ operation to update the contents of a message. A message must be in a format that can be
+ included in an XML request with UTF-8 encoding, and the encoded message can be up to 64KB in
+ size.
+
+ :param pop_receipt: Required. Specifies the valid pop receipt value returned from an earlier
+ call to the Get Messages or Update Message operation.
+ :type pop_receipt: str
+ :param visibilitytimeout: Optional. Specifies the new visibility timeout value, in seconds,
+ relative to server time. The default value is 30 seconds. A specified value must be larger than
+ or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol
+ versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value
+ later than the expiry time.
+ :type visibilitytimeout: int
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None:
+ """The Delete operation deletes the specified message.
+
+ :param pop_receipt: Required. Specifies the valid pop receipt value returned from an earlier
+ call to the Get Messages or Update Message operation.
+ :type pop_receipt: str
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def dequeue(
+ self,
+ number_of_messages: Optional[int] = None,
+ visibilitytimeout: Optional[int] = None,
+ timeout: Optional[int] = None,
+ request_id_parameter: Optional[str] = None,
+ **kwargs
+ ) -> List["_models.DequeuedMessageItem"]:
+ """The Dequeue operation retrieves one or more messages from the front of the queue.
+
+ :param number_of_messages: Optional. A nonzero integer value that specifies the number of
+ messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible
+ messages are returned. By default, a single message is retrieved from the queue with this
+ operation.
+ :type number_of_messages: int
+ :param visibilitytimeout: Optional. Specifies the new visibility timeout value, in seconds,
+ relative to server time. The default value is 30 seconds. A specified value must be larger than
+ or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol
+ versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value
+ later than the expiry time.
+ :type visibilitytimeout: int
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None:
+ """The Clear operation deletes all messages from the specified queue.
+
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see List["_models.EnqueuedMessage"]:
+ """The Enqueue operation adds a new message to the back of the message queue. A visibility timeout
+ can also be specified to make the message invisible until the visibility timeout expires. A
+ message must be in a format that can be included in an XML request with UTF-8 encoding. The
+ encoded message can be up to 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size
+ for previous versions.
+
+ :param queue_message: A Message object which can be stored in a Queue.
+ :type queue_message: ~azure.storage.queue.models.QueueMessage
+ :param visibilitytimeout: Optional. If specified, the request must be made using an x-ms-
+ version of 2011-08-18 or later. If not specified, the default value is 0. Specifies the new
+ visibility timeout value, in seconds, relative to server time. The new value must be larger
+ than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message
+ cannot be set to a value later than the expiry time. visibilitytimeout should be set to a value
+ smaller than the time-to-live value.
+ :type visibilitytimeout: int
+ :param message_time_to_live: Optional. Specifies the time-to-live interval for the message, in
+ seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version
+ 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1
+ indicating that the message does not expire. If this parameter is omitted, the default time-to-
+ live is 7 days.
+ :type message_time_to_live: int
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see List["_models.PeekedMessageItem"]:
+ """The Peek operation retrieves one or more messages from the front of the queue, but does not
+ alter the visibility of the message.
+
+ :param number_of_messages: Optional. A nonzero integer value that specifies the number of
+ messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible
+ messages are returned. By default, a single message is retrieved from the queue with this
+ operation.
+ :type number_of_messages: int
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def create(
+ self,
+ timeout: Optional[int] = None,
+ metadata: Optional[str] = None,
+ request_id_parameter: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """creates a new queue under the given account.
+
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None:
+ """operation permanently deletes the specified queue.
+
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None:
+ """Retrieves user-defined metadata and queue properties on the specified queue. Metadata is
+ associated with the queue as name-values pairs.
+
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None:
+ """sets user-defined metadata on the specified queue. Metadata is associated with the queue as
+ name-value pairs.
+
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see List["_models.SignedIdentifier"]:
+ """returns details about any stored access policies specified on the queue that may be used with
+ Shared Access Signatures.
+
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None:
+ """sets stored access policies for the queue that may be used with Shared Access Signatures.
+
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def set_properties(
+ self,
+ storage_service_properties: "_models.StorageServiceProperties",
+ timeout: Optional[int] = None,
+ request_id_parameter: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """Sets properties for a storage account's Queue service endpoint, including properties for
+ Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
+
+ :param storage_service_properties: The StorageService properties.
+ :type storage_service_properties: ~azure.storage.queue.models.StorageServiceProperties
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see "_models.StorageServiceProperties":
+ """gets the properties of a storage account's Queue service, including properties for Storage
+ Analytics and CORS (Cross-Origin Resource Sharing) rules.
+
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see "_models.StorageServiceStats":
+ """Retrieves statistics related to replication for the Queue service. It is only available on the
+ secondary location endpoint when read-access geo-redundant replication is enabled for the
+ storage account.
+
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see "_models.ListQueuesSegmentResponse":
+ """The List Queues Segment operation returns a list of the queues under the specified account.
+
+ :param prefix: Filters the results to return only queues whose name begins with the specified
+ prefix.
+ :type prefix: str
+ :param marker: A string value that identifies the portion of the list of queues to be returned
+ with the next listing operation. The operation returns the NextMarker value within the response
+ body if the listing operation did not return all queues remaining to be listed with the current
+ page. The NextMarker value can be used as the value for the marker parameter in a subsequent
+ call to request the next page of list items. The marker value is opaque to the client.
+ :type marker: str
+ :param maxresults: Specifies the maximum number of queues to return. If the request does not
+ specify maxresults, or specifies a value greater than 5000, the server will return up to 5000
+ items. Note that if the listing operation crosses a partition boundary, then the service will
+ return a continuation token for retrieving the remainder of the results. For this reason, it is
+ possible that the service will return fewer results than specified by maxresults, or than the
+ default of 5000.
+ :type maxresults: int
+ :param include: Include this parameter to specify that the queues's metadata be returned as
+ part of the response body.
+ :type include: list[str]
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None:
-
- self._client = client
- self._serialize = serializer
- self._deserialize = deserializer
-
- self._config = config
-
- async def update(self, pop_receipt, visibilitytimeout, queue_message=None, timeout=None, request_id=None, *, cls=None, **kwargs):
- """The Update operation was introduced with version 2011-08-18 of the
- Queue service API. The Update Message operation updates the visibility
- timeout of a message. You can also use this operation to update the
- contents of a message. A message must be in a format that can be
- included in an XML request with UTF-8 encoding, and the encoded message
- can be up to 64KB in size.
-
- :param pop_receipt: Required. Specifies the valid pop receipt value
- returned from an earlier call to the Get Messages or Update Message
- operation.
- :type pop_receipt: str
- :param visibilitytimeout: Optional. Specifies the new visibility
- timeout value, in seconds, relative to server time. The default value
- is 30 seconds. A specified value must be larger than or equal to 1
- second, and cannot be larger than 7 days, or larger than 2 hours on
- REST protocol versions prior to version 2011-08-18. The visibility
- timeout of a message can be set to a value later than the expiry time.
- :type visibilitytimeout: int
- :param queue_message: A Message object which can be stored in a Queue
- :type queue_message: ~azure.storage.queue.models.QueueMessage
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see None:
-
- self._client = client
- self._serialize = serializer
- self._deserialize = deserializer
-
- self._config = config
- self.peekonly = "true"
-
- async def dequeue(self, number_of_messages=None, visibilitytimeout=None, timeout=None, request_id=None, *, cls=None, **kwargs):
- """The Dequeue operation retrieves one or more messages from the front of
- the queue.
-
- :param number_of_messages: Optional. A nonzero integer value that
- specifies the number of messages to retrieve from the queue, up to a
- maximum of 32. If fewer are visible, the visible messages are
- returned. By default, a single message is retrieved from the queue
- with this operation.
- :type number_of_messages: int
- :param visibilitytimeout: Optional. Specifies the new visibility
- timeout value, in seconds, relative to server time. The default value
- is 30 seconds. A specified value must be larger than or equal to 1
- second, and cannot be larger than 7 days, or larger than 2 hours on
- REST protocol versions prior to version 2011-08-18. The visibility
- timeout of a message can be set to a value later than the expiry time.
- :type visibilitytimeout: int
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see None:
-
- self._client = client
- self._serialize = serializer
- self._deserialize = deserializer
-
- self._config = config
-
- async def create(self, timeout=None, metadata=None, request_id=None, *, cls=None, **kwargs):
- """creates a new queue under the given account.
-
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see None:
-
- self._client = client
- self._serialize = serializer
- self._deserialize = deserializer
-
- self._config = config
- self.restype = "service"
-
- async def set_properties(self, storage_service_properties, timeout=None, request_id=None, *, cls=None, **kwargs):
- """Sets properties for a storage account's Queue service endpoint,
- including properties for Storage Analytics and CORS (Cross-Origin
- Resource Sharing) rules.
-
- :param storage_service_properties: The StorageService properties.
- :type storage_service_properties:
- ~azure.storage.queue.models.StorageServiceProperties
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see `.
:type metadata: dict[str, str]
"""
@@ -449,25 +434,28 @@ class QueueItem(Model):
}
_attribute_map = {
- 'name': {'key': 'Name', 'type': 'str', 'xml': {'name': 'Name'}},
- 'metadata': {'key': 'Metadata', 'type': '{str}', 'xml': {'name': 'Metadata'}},
+ 'name': {'key': 'Name', 'type': 'str'},
+ 'metadata': {'key': 'Metadata', 'type': '{str}'},
}
_xml_map = {
'name': 'Queue'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(QueueItem, self).__init__(**kwargs)
- self.name = kwargs.get('name', None)
+ self.name = kwargs['name']
self.metadata = kwargs.get('metadata', None)
-class QueueMessage(Model):
+class QueueMessage(msrest.serialization.Model):
"""A Message object which can be stored in a Queue.
All required parameters must be populated in order to send to Azure.
- :param message_text: Required. The content of the message
+ :param message_text: Required. The content of the message.
:type message_text: str
"""
@@ -476,27 +464,27 @@ class QueueMessage(Model):
}
_attribute_map = {
- 'message_text': {'key': 'MessageText', 'type': 'str', 'xml': {'name': 'MessageText'}},
- }
- _xml_map = {
+ 'message_text': {'key': 'MessageText', 'type': 'str'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(QueueMessage, self).__init__(**kwargs)
- self.message_text = kwargs.get('message_text', None)
+ self.message_text = kwargs['message_text']
-class RetentionPolicy(Model):
+class RetentionPolicy(msrest.serialization.Model):
"""the retention policy.
All required parameters must be populated in order to send to Azure.
- :param enabled: Required. Indicates whether a retention policy is enabled
- for the storage service
+ :param enabled: Required. Indicates whether a retention policy is enabled for the storage
+ service.
:type enabled: bool
- :param days: Indicates the number of days that metrics or logging or
- soft-deleted data should be retained. All data older than this value will
- be deleted
+ :param days: Indicates the number of days that metrics or logging or soft-deleted data should
+ be retained. All data older than this value will be deleted.
:type days: int
"""
@@ -506,26 +494,27 @@ class RetentionPolicy(Model):
}
_attribute_map = {
- 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
- 'days': {'key': 'Days', 'type': 'int', 'xml': {'name': 'Days'}},
- }
- _xml_map = {
+ 'enabled': {'key': 'Enabled', 'type': 'bool'},
+ 'days': {'key': 'Days', 'type': 'int'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(RetentionPolicy, self).__init__(**kwargs)
- self.enabled = kwargs.get('enabled', None)
+ self.enabled = kwargs['enabled']
self.days = kwargs.get('days', None)
-class SignedIdentifier(Model):
+class SignedIdentifier(msrest.serialization.Model):
"""signed identifier.
All required parameters must be populated in order to send to Azure.
- :param id: Required. a unique id
+ :param id: Required. a unique id.
:type id: str
- :param access_policy: The access policy
+ :param access_policy: The access policy.
:type access_policy: ~azure.storage.queue.models.AccessPolicy
"""
@@ -534,19 +523,20 @@ class SignedIdentifier(Model):
}
_attribute_map = {
- 'id': {'key': 'Id', 'type': 'str', 'xml': {'name': 'Id'}},
- 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy', 'xml': {'name': 'AccessPolicy'}},
- }
- _xml_map = {
+ 'id': {'key': 'Id', 'type': 'str'},
+ 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(SignedIdentifier, self).__init__(**kwargs)
- self.id = kwargs.get('id', None)
+ self.id = kwargs['id']
self.access_policy = kwargs.get('access_policy', None)
-class StorageError(Model):
+class StorageError(msrest.serialization.Model):
"""StorageError.
:param message:
@@ -554,57 +544,43 @@ class StorageError(Model):
"""
_attribute_map = {
- 'message': {'key': 'Message', 'type': 'str', 'xml': {'name': 'Message'}},
- }
- _xml_map = {
+ 'message': {'key': 'Message', 'type': 'str'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(StorageError, self).__init__(**kwargs)
self.message = kwargs.get('message', None)
-class StorageErrorException(HttpResponseError):
- """Server responsed with exception of type: 'StorageError'.
-
- :param deserialize: A deserializer
- :param response: Server response to be deserialized.
- """
-
- def __init__(self, response, deserialize, *args):
-
- model_name = 'StorageError'
- self.error = deserialize(model_name, response)
- if self.error is None:
- self.error = deserialize.dependencies[model_name]()
- super(StorageErrorException, self).__init__(response=response)
-
-
-class StorageServiceProperties(Model):
+class StorageServiceProperties(msrest.serialization.Model):
"""Storage Service Properties.
- :param logging: Azure Analytics Logging settings
+ :param logging: Azure Analytics Logging settings.
:type logging: ~azure.storage.queue.models.Logging
- :param hour_metrics: A summary of request statistics grouped by API in
- hourly aggregates for queues
+ :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for
+ queues.
:type hour_metrics: ~azure.storage.queue.models.Metrics
- :param minute_metrics: a summary of request statistics grouped by API in
- minute aggregates for queues
+ :param minute_metrics: a summary of request statistics grouped by API in minute aggregates for
+ queues.
:type minute_metrics: ~azure.storage.queue.models.Metrics
:param cors: The set of CORS rules.
:type cors: list[~azure.storage.queue.models.CorsRule]
"""
_attribute_map = {
- 'logging': {'key': 'Logging', 'type': 'Logging', 'xml': {'name': 'Logging'}},
- 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics', 'xml': {'name': 'HourMetrics'}},
- 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics', 'xml': {'name': 'MinuteMetrics'}},
- 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'name': 'Cors', 'itemsName': 'CorsRule', 'wrapped': True}},
- }
- _xml_map = {
+ 'logging': {'key': 'Logging', 'type': 'Logging'},
+ 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics'},
+ 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics'},
+ 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'wrapped': True}},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(StorageServiceProperties, self).__init__(**kwargs)
self.logging = kwargs.get('logging', None)
self.hour_metrics = kwargs.get('hour_metrics', None)
@@ -612,20 +588,20 @@ def __init__(self, **kwargs):
self.cors = kwargs.get('cors', None)
-class StorageServiceStats(Model):
+class StorageServiceStats(msrest.serialization.Model):
"""Stats for the storage service.
- :param geo_replication: Geo-Replication information for the Secondary
- Storage Service
+ :param geo_replication: Geo-Replication information for the Secondary Storage Service.
:type geo_replication: ~azure.storage.queue.models.GeoReplication
"""
_attribute_map = {
- 'geo_replication': {'key': 'GeoReplication', 'type': 'GeoReplication', 'xml': {'name': 'GeoReplication'}},
- }
- _xml_map = {
+ 'geo_replication': {'key': 'GeoReplication', 'type': 'GeoReplication'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(StorageServiceStats, self).__init__(**kwargs)
self.geo_replication = kwargs.get('geo_replication', None)
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models_py3.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models_py3.py
index e74ab627590c..b4000bfdd284 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models_py3.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models_py3.py
@@ -1,80 +1,73 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from msrest.serialization import Model
+import datetime
+from typing import Dict, List, Optional, Union
+
from azure.core.exceptions import HttpResponseError
+import msrest.serialization
+from ._azure_queue_storage_enums import *
-class AccessPolicy(Model):
- """An Access policy.
- All required parameters must be populated in order to send to Azure.
+class AccessPolicy(msrest.serialization.Model):
+ """An Access policy.
- :param start: Required. the date-time the policy is active
+ :param start: the date-time the policy is active.
:type start: str
- :param expiry: Required. the date-time the policy expires
+ :param expiry: the date-time the policy expires.
:type expiry: str
- :param permission: Required. the permissions for the acl policy
+ :param permission: the permissions for the acl policy.
:type permission: str
"""
- _validation = {
- 'start': {'required': True},
- 'expiry': {'required': True},
- 'permission': {'required': True},
- }
-
_attribute_map = {
- 'start': {'key': 'Start', 'type': 'str', 'xml': {'name': 'Start'}},
- 'expiry': {'key': 'Expiry', 'type': 'str', 'xml': {'name': 'Expiry'}},
- 'permission': {'key': 'Permission', 'type': 'str', 'xml': {'name': 'Permission'}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, start: str, expiry: str, permission: str, **kwargs) -> None:
+ 'start': {'key': 'Start', 'type': 'str'},
+ 'expiry': {'key': 'Expiry', 'type': 'str'},
+ 'permission': {'key': 'Permission', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ start: Optional[str] = None,
+ expiry: Optional[str] = None,
+ permission: Optional[str] = None,
+ **kwargs
+ ):
super(AccessPolicy, self).__init__(**kwargs)
self.start = start
self.expiry = expiry
self.permission = permission
-class CorsRule(Model):
- """CORS is an HTTP feature that enables a web application running under one
- domain to access resources in another domain. Web browsers implement a
- security restriction known as same-origin policy that prevents a web page
- from calling APIs in a different domain; CORS provides a secure way to
- allow one domain (the origin domain) to call APIs in another domain.
+class CorsRule(msrest.serialization.Model):
+ """CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain.
All required parameters must be populated in order to send to Azure.
- :param allowed_origins: Required. The origin domains that are permitted to
- make a request against the storage service via CORS. The origin domain is
- the domain from which the request originates. Note that the origin must be
- an exact case-sensitive match with the origin that the user age sends to
- the service. You can also use the wildcard character '*' to allow all
- origin domains to make requests via CORS.
+ :param allowed_origins: Required. The origin domains that are permitted to make a request
+ against the storage service via CORS. The origin domain is the domain from which the request
+ originates. Note that the origin must be an exact case-sensitive match with the origin that the
+ user age sends to the service. You can also use the wildcard character '*' to allow all origin
+ domains to make requests via CORS.
:type allowed_origins: str
- :param allowed_methods: Required. The methods (HTTP request verbs) that
- the origin domain may use for a CORS request. (comma separated)
+ :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may
+ use for a CORS request. (comma separated).
:type allowed_methods: str
- :param allowed_headers: Required. the request headers that the origin
- domain may specify on the CORS request.
+ :param allowed_headers: Required. the request headers that the origin domain may specify on the
+ CORS request.
:type allowed_headers: str
- :param exposed_headers: Required. The response headers that may be sent in
- the response to the CORS request and exposed by the browser to the request
- issuer
+ :param exposed_headers: Required. The response headers that may be sent in the response to the
+ CORS request and exposed by the browser to the request issuer.
:type exposed_headers: str
- :param max_age_in_seconds: Required. The maximum amount time that a
- browser should cache the preflight OPTIONS request.
+ :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the
+ preflight OPTIONS request.
:type max_age_in_seconds: int
"""
@@ -87,16 +80,23 @@ class CorsRule(Model):
}
_attribute_map = {
- 'allowed_origins': {'key': 'AllowedOrigins', 'type': 'str', 'xml': {'name': 'AllowedOrigins'}},
- 'allowed_methods': {'key': 'AllowedMethods', 'type': 'str', 'xml': {'name': 'AllowedMethods'}},
- 'allowed_headers': {'key': 'AllowedHeaders', 'type': 'str', 'xml': {'name': 'AllowedHeaders'}},
- 'exposed_headers': {'key': 'ExposedHeaders', 'type': 'str', 'xml': {'name': 'ExposedHeaders'}},
- 'max_age_in_seconds': {'key': 'MaxAgeInSeconds', 'type': 'int', 'xml': {'name': 'MaxAgeInSeconds'}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, allowed_origins: str, allowed_methods: str, allowed_headers: str, exposed_headers: str, max_age_in_seconds: int, **kwargs) -> None:
+ 'allowed_origins': {'key': 'AllowedOrigins', 'type': 'str'},
+ 'allowed_methods': {'key': 'AllowedMethods', 'type': 'str'},
+ 'allowed_headers': {'key': 'AllowedHeaders', 'type': 'str'},
+ 'exposed_headers': {'key': 'ExposedHeaders', 'type': 'str'},
+ 'max_age_in_seconds': {'key': 'MaxAgeInSeconds', 'type': 'int'},
+ }
+
+ def __init__(
+ self,
+ *,
+ allowed_origins: str,
+ allowed_methods: str,
+ allowed_headers: str,
+ exposed_headers: str,
+ max_age_in_seconds: int,
+ **kwargs
+ ):
super(CorsRule, self).__init__(**kwargs)
self.allowed_origins = allowed_origins
self.allowed_methods = allowed_methods
@@ -105,29 +105,25 @@ def __init__(self, *, allowed_origins: str, allowed_methods: str, allowed_header
self.max_age_in_seconds = max_age_in_seconds
-class DequeuedMessageItem(Model):
- """The object returned in the QueueMessageList array when calling Get Messages
- on a Queue.
+class DequeuedMessageItem(msrest.serialization.Model):
+ """The object returned in the QueueMessageList array when calling Get Messages on a Queue.
All required parameters must be populated in order to send to Azure.
:param message_id: Required. The Id of the Message.
:type message_id: str
- :param insertion_time: Required. The time the Message was inserted into
- the Queue.
- :type insertion_time: datetime
- :param expiration_time: Required. The time that the Message will expire
- and be automatically deleted.
- :type expiration_time: datetime
- :param pop_receipt: Required. This value is required to delete the
- Message. If deletion fails using this popreceipt then the message has been
- dequeued by another client.
+ :param insertion_time: Required. The time the Message was inserted into the Queue.
+ :type insertion_time: ~datetime.datetime
+ :param expiration_time: Required. The time that the Message will expire and be automatically
+ deleted.
+ :type expiration_time: ~datetime.datetime
+ :param pop_receipt: Required. This value is required to delete the Message. If deletion fails
+ using this popreceipt then the message has been dequeued by another client.
:type pop_receipt: str
- :param time_next_visible: Required. The time that the message will again
- become visible in the Queue.
- :type time_next_visible: datetime
- :param dequeue_count: Required. The number of times the message has been
- dequeued.
+ :param time_next_visible: Required. The time that the message will again become visible in the
+ Queue.
+ :type time_next_visible: ~datetime.datetime
+ :param dequeue_count: Required. The number of times the message has been dequeued.
:type dequeue_count: long
:param message_text: Required. The content of the Message.
:type message_text: str
@@ -144,19 +140,30 @@ class DequeuedMessageItem(Model):
}
_attribute_map = {
- 'message_id': {'key': 'MessageId', 'type': 'str', 'xml': {'name': 'MessageId'}},
- 'insertion_time': {'key': 'InsertionTime', 'type': 'rfc-1123', 'xml': {'name': 'InsertionTime'}},
- 'expiration_time': {'key': 'ExpirationTime', 'type': 'rfc-1123', 'xml': {'name': 'ExpirationTime'}},
- 'pop_receipt': {'key': 'PopReceipt', 'type': 'str', 'xml': {'name': 'PopReceipt'}},
- 'time_next_visible': {'key': 'TimeNextVisible', 'type': 'rfc-1123', 'xml': {'name': 'TimeNextVisible'}},
- 'dequeue_count': {'key': 'DequeueCount', 'type': 'long', 'xml': {'name': 'DequeueCount'}},
- 'message_text': {'key': 'MessageText', 'type': 'str', 'xml': {'name': 'MessageText'}},
+ 'message_id': {'key': 'MessageId', 'type': 'str'},
+ 'insertion_time': {'key': 'InsertionTime', 'type': 'rfc-1123'},
+ 'expiration_time': {'key': 'ExpirationTime', 'type': 'rfc-1123'},
+ 'pop_receipt': {'key': 'PopReceipt', 'type': 'str'},
+ 'time_next_visible': {'key': 'TimeNextVisible', 'type': 'rfc-1123'},
+ 'dequeue_count': {'key': 'DequeueCount', 'type': 'long'},
+ 'message_text': {'key': 'MessageText', 'type': 'str'},
}
_xml_map = {
'name': 'QueueMessage'
}
- def __init__(self, *, message_id: str, insertion_time, expiration_time, pop_receipt: str, time_next_visible, dequeue_count: int, message_text: str, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ message_id: str,
+ insertion_time: datetime.datetime,
+ expiration_time: datetime.datetime,
+ pop_receipt: str,
+ time_next_visible: datetime.datetime,
+ dequeue_count: int,
+ message_text: str,
+ **kwargs
+ ):
super(DequeuedMessageItem, self).__init__(**kwargs)
self.message_id = message_id
self.insertion_time = insertion_time
@@ -167,27 +174,24 @@ def __init__(self, *, message_id: str, insertion_time, expiration_time, pop_rece
self.message_text = message_text
-class EnqueuedMessage(Model):
- """The object returned in the QueueMessageList array when calling Put Message
- on a Queue.
+class EnqueuedMessage(msrest.serialization.Model):
+ """The object returned in the QueueMessageList array when calling Put Message on a Queue.
All required parameters must be populated in order to send to Azure.
:param message_id: Required. The Id of the Message.
:type message_id: str
- :param insertion_time: Required. The time the Message was inserted into
- the Queue.
- :type insertion_time: datetime
- :param expiration_time: Required. The time that the Message will expire
- and be automatically deleted.
- :type expiration_time: datetime
- :param pop_receipt: Required. This value is required to delete the
- Message. If deletion fails using this popreceipt then the message has been
- dequeued by another client.
+ :param insertion_time: Required. The time the Message was inserted into the Queue.
+ :type insertion_time: ~datetime.datetime
+ :param expiration_time: Required. The time that the Message will expire and be automatically
+ deleted.
+ :type expiration_time: ~datetime.datetime
+ :param pop_receipt: Required. This value is required to delete the Message. If deletion fails
+ using this popreceipt then the message has been dequeued by another client.
:type pop_receipt: str
- :param time_next_visible: Required. The time that the message will again
- become visible in the Queue.
- :type time_next_visible: datetime
+ :param time_next_visible: Required. The time that the message will again become visible in the
+ Queue.
+ :type time_next_visible: ~datetime.datetime
"""
_validation = {
@@ -199,17 +203,26 @@ class EnqueuedMessage(Model):
}
_attribute_map = {
- 'message_id': {'key': 'MessageId', 'type': 'str', 'xml': {'name': 'MessageId'}},
- 'insertion_time': {'key': 'InsertionTime', 'type': 'rfc-1123', 'xml': {'name': 'InsertionTime'}},
- 'expiration_time': {'key': 'ExpirationTime', 'type': 'rfc-1123', 'xml': {'name': 'ExpirationTime'}},
- 'pop_receipt': {'key': 'PopReceipt', 'type': 'str', 'xml': {'name': 'PopReceipt'}},
- 'time_next_visible': {'key': 'TimeNextVisible', 'type': 'rfc-1123', 'xml': {'name': 'TimeNextVisible'}},
+ 'message_id': {'key': 'MessageId', 'type': 'str'},
+ 'insertion_time': {'key': 'InsertionTime', 'type': 'rfc-1123'},
+ 'expiration_time': {'key': 'ExpirationTime', 'type': 'rfc-1123'},
+ 'pop_receipt': {'key': 'PopReceipt', 'type': 'str'},
+ 'time_next_visible': {'key': 'TimeNextVisible', 'type': 'rfc-1123'},
}
_xml_map = {
'name': 'QueueMessage'
}
- def __init__(self, *, message_id: str, insertion_time, expiration_time, pop_receipt: str, time_next_visible, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ message_id: str,
+ insertion_time: datetime.datetime,
+ expiration_time: datetime.datetime,
+ pop_receipt: str,
+ time_next_visible: datetime.datetime,
+ **kwargs
+ ):
super(EnqueuedMessage, self).__init__(**kwargs)
self.message_id = message_id
self.insertion_time = insertion_time
@@ -218,19 +231,18 @@ def __init__(self, *, message_id: str, insertion_time, expiration_time, pop_rece
self.time_next_visible = time_next_visible
-class GeoReplication(Model):
+class GeoReplication(msrest.serialization.Model):
"""GeoReplication.
All required parameters must be populated in order to send to Azure.
- :param status: Required. The status of the secondary location. Possible
- values include: 'live', 'bootstrap', 'unavailable'
+ :param status: Required. The status of the secondary location. Possible values include: "live",
+ "bootstrap", "unavailable".
:type status: str or ~azure.storage.queue.models.GeoReplicationStatusType
- :param last_sync_time: Required. A GMT date/time value, to the second. All
- primary writes preceding this value are guaranteed to be available for
- read operations at the secondary. Primary writes after this point in time
- may or may not be available for reads.
- :type last_sync_time: datetime
+ :param last_sync_time: Required. A GMT date/time value, to the second. All primary writes
+ preceding this value are guaranteed to be available for read operations at the secondary.
+ Primary writes after this point in time may or may not be available for reads.
+ :type last_sync_time: ~datetime.datetime
"""
_validation = {
@@ -239,19 +251,23 @@ class GeoReplication(Model):
}
_attribute_map = {
- 'status': {'key': 'Status', 'type': 'str', 'xml': {'name': 'Status'}},
- 'last_sync_time': {'key': 'LastSyncTime', 'type': 'rfc-1123', 'xml': {'name': 'LastSyncTime'}},
- }
- _xml_map = {
+ 'status': {'key': 'Status', 'type': 'str'},
+ 'last_sync_time': {'key': 'LastSyncTime', 'type': 'rfc-1123'},
}
- def __init__(self, *, status, last_sync_time, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ status: Union[str, "GeoReplicationStatusType"],
+ last_sync_time: datetime.datetime,
+ **kwargs
+ ):
super(GeoReplication, self).__init__(**kwargs)
self.status = status
self.last_sync_time = last_sync_time
-class ListQueuesSegmentResponse(Model):
+class ListQueuesSegmentResponse(msrest.serialization.Model):
"""The object returned when calling List Queues on a Queue Service.
All required parameters must be populated in order to send to Azure.
@@ -278,18 +294,28 @@ class ListQueuesSegmentResponse(Model):
}
_attribute_map = {
- 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'name': 'ServiceEndpoint', 'attr': True}},
- 'prefix': {'key': 'Prefix', 'type': 'str', 'xml': {'name': 'Prefix'}},
- 'marker': {'key': 'Marker', 'type': 'str', 'xml': {'name': 'Marker'}},
- 'max_results': {'key': 'MaxResults', 'type': 'int', 'xml': {'name': 'MaxResults'}},
- 'queue_items': {'key': 'QueueItems', 'type': '[QueueItem]', 'xml': {'name': 'Queues', 'itemsName': 'Queues', 'wrapped': True}},
- 'next_marker': {'key': 'NextMarker', 'type': 'str', 'xml': {'name': 'NextMarker'}},
+ 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'attr': True}},
+ 'prefix': {'key': 'Prefix', 'type': 'str'},
+ 'marker': {'key': 'Marker', 'type': 'str'},
+ 'max_results': {'key': 'MaxResults', 'type': 'int'},
+ 'queue_items': {'key': 'QueueItems', 'type': '[QueueItem]', 'xml': {'name': 'Queues', 'wrapped': True, 'itemsName': 'Queue'}},
+ 'next_marker': {'key': 'NextMarker', 'type': 'str'},
}
_xml_map = {
'name': 'EnumerationResults'
}
- def __init__(self, *, service_endpoint: str, prefix: str, max_results: int, next_marker: str, marker: str=None, queue_items=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ service_endpoint: str,
+ prefix: str,
+ max_results: int,
+ next_marker: str,
+ marker: Optional[str] = None,
+ queue_items: Optional[List["QueueItem"]] = None,
+ **kwargs
+ ):
super(ListQueuesSegmentResponse, self).__init__(**kwargs)
self.service_endpoint = service_endpoint
self.prefix = prefix
@@ -299,23 +325,20 @@ def __init__(self, *, service_endpoint: str, prefix: str, max_results: int, next
self.next_marker = next_marker
-class Logging(Model):
+class Logging(msrest.serialization.Model):
"""Azure Analytics Logging settings.
All required parameters must be populated in order to send to Azure.
:param version: Required. The version of Storage Analytics to configure.
:type version: str
- :param delete: Required. Indicates whether all delete requests should be
- logged.
+ :param delete: Required. Indicates whether all delete requests should be logged.
:type delete: bool
- :param read: Required. Indicates whether all read requests should be
- logged.
+ :param read: Required. Indicates whether all read requests should be logged.
:type read: bool
- :param write: Required. Indicates whether all write requests should be
- logged.
+ :param write: Required. Indicates whether all write requests should be logged.
:type write: bool
- :param retention_policy: Required.
+ :param retention_policy: Required. the retention policy.
:type retention_policy: ~azure.storage.queue.models.RetentionPolicy
"""
@@ -328,16 +351,23 @@ class Logging(Model):
}
_attribute_map = {
- 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
- 'delete': {'key': 'Delete', 'type': 'bool', 'xml': {'name': 'Delete'}},
- 'read': {'key': 'Read', 'type': 'bool', 'xml': {'name': 'Read'}},
- 'write': {'key': 'Write', 'type': 'bool', 'xml': {'name': 'Write'}},
- 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy', 'xml': {'name': 'RetentionPolicy'}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, version: str, delete: bool, read: bool, write: bool, retention_policy, **kwargs) -> None:
+ 'version': {'key': 'Version', 'type': 'str'},
+ 'delete': {'key': 'Delete', 'type': 'bool'},
+ 'read': {'key': 'Read', 'type': 'bool'},
+ 'write': {'key': 'Write', 'type': 'bool'},
+ 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'},
+ }
+
+ def __init__(
+ self,
+ *,
+ version: str,
+ delete: bool,
+ read: bool,
+ write: bool,
+ retention_policy: "RetentionPolicy",
+ **kwargs
+ ):
super(Logging, self).__init__(**kwargs)
self.version = version
self.delete = delete
@@ -346,20 +376,19 @@ def __init__(self, *, version: str, delete: bool, read: bool, write: bool, reten
self.retention_policy = retention_policy
-class Metrics(Model):
+class Metrics(msrest.serialization.Model):
"""Metrics.
All required parameters must be populated in order to send to Azure.
:param version: The version of Storage Analytics to configure.
:type version: str
- :param enabled: Required. Indicates whether metrics are enabled for the
- Queue service.
+ :param enabled: Required. Indicates whether metrics are enabled for the Queue service.
:type enabled: bool
- :param include_apis: Indicates whether metrics should generate summary
- statistics for called API operations.
+ :param include_apis: Indicates whether metrics should generate summary statistics for called
+ API operations.
:type include_apis: bool
- :param retention_policy:
+ :param retention_policy: the retention policy.
:type retention_policy: ~azure.storage.queue.models.RetentionPolicy
"""
@@ -368,15 +397,21 @@ class Metrics(Model):
}
_attribute_map = {
- 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
- 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
- 'include_apis': {'key': 'IncludeAPIs', 'type': 'bool', 'xml': {'name': 'IncludeAPIs'}},
- 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy', 'xml': {'name': 'RetentionPolicy'}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, enabled: bool, version: str=None, include_apis: bool=None, retention_policy=None, **kwargs) -> None:
+ 'version': {'key': 'Version', 'type': 'str'},
+ 'enabled': {'key': 'Enabled', 'type': 'bool'},
+ 'include_apis': {'key': 'IncludeAPIs', 'type': 'bool'},
+ 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'},
+ }
+
+ def __init__(
+ self,
+ *,
+ enabled: bool,
+ version: Optional[str] = None,
+ include_apis: Optional[bool] = None,
+ retention_policy: Optional["RetentionPolicy"] = None,
+ **kwargs
+ ):
super(Metrics, self).__init__(**kwargs)
self.version = version
self.enabled = enabled
@@ -384,22 +419,19 @@ def __init__(self, *, enabled: bool, version: str=None, include_apis: bool=None,
self.retention_policy = retention_policy
-class PeekedMessageItem(Model):
- """The object returned in the QueueMessageList array when calling Peek
- Messages on a Queue.
+class PeekedMessageItem(msrest.serialization.Model):
+ """The object returned in the QueueMessageList array when calling Peek Messages on a Queue.
All required parameters must be populated in order to send to Azure.
:param message_id: Required. The Id of the Message.
:type message_id: str
- :param insertion_time: Required. The time the Message was inserted into
- the Queue.
- :type insertion_time: datetime
- :param expiration_time: Required. The time that the Message will expire
- and be automatically deleted.
- :type expiration_time: datetime
- :param dequeue_count: Required. The number of times the message has been
- dequeued.
+ :param insertion_time: Required. The time the Message was inserted into the Queue.
+ :type insertion_time: ~datetime.datetime
+ :param expiration_time: Required. The time that the Message will expire and be automatically
+ deleted.
+ :type expiration_time: ~datetime.datetime
+ :param dequeue_count: Required. The number of times the message has been dequeued.
:type dequeue_count: long
:param message_text: Required. The content of the Message.
:type message_text: str
@@ -414,17 +446,26 @@ class PeekedMessageItem(Model):
}
_attribute_map = {
- 'message_id': {'key': 'MessageId', 'type': 'str', 'xml': {'name': 'MessageId'}},
- 'insertion_time': {'key': 'InsertionTime', 'type': 'rfc-1123', 'xml': {'name': 'InsertionTime'}},
- 'expiration_time': {'key': 'ExpirationTime', 'type': 'rfc-1123', 'xml': {'name': 'ExpirationTime'}},
- 'dequeue_count': {'key': 'DequeueCount', 'type': 'long', 'xml': {'name': 'DequeueCount'}},
- 'message_text': {'key': 'MessageText', 'type': 'str', 'xml': {'name': 'MessageText'}},
+ 'message_id': {'key': 'MessageId', 'type': 'str'},
+ 'insertion_time': {'key': 'InsertionTime', 'type': 'rfc-1123'},
+ 'expiration_time': {'key': 'ExpirationTime', 'type': 'rfc-1123'},
+ 'dequeue_count': {'key': 'DequeueCount', 'type': 'long'},
+ 'message_text': {'key': 'MessageText', 'type': 'str'},
}
_xml_map = {
'name': 'QueueMessage'
}
- def __init__(self, *, message_id: str, insertion_time, expiration_time, dequeue_count: int, message_text: str, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ message_id: str,
+ insertion_time: datetime.datetime,
+ expiration_time: datetime.datetime,
+ dequeue_count: int,
+ message_text: str,
+ **kwargs
+ ):
super(PeekedMessageItem, self).__init__(**kwargs)
self.message_id = message_id
self.insertion_time = insertion_time
@@ -433,14 +474,14 @@ def __init__(self, *, message_id: str, insertion_time, expiration_time, dequeue_
self.message_text = message_text
-class QueueItem(Model):
+class QueueItem(msrest.serialization.Model):
"""An Azure Storage Queue.
All required parameters must be populated in order to send to Azure.
:param name: Required. The name of the Queue.
:type name: str
- :param metadata:
+ :param metadata: Dictionary of :code:``.
:type metadata: dict[str, str]
"""
@@ -449,25 +490,31 @@ class QueueItem(Model):
}
_attribute_map = {
- 'name': {'key': 'Name', 'type': 'str', 'xml': {'name': 'Name'}},
- 'metadata': {'key': 'Metadata', 'type': '{str}', 'xml': {'name': 'Metadata'}},
+ 'name': {'key': 'Name', 'type': 'str'},
+ 'metadata': {'key': 'Metadata', 'type': '{str}'},
}
_xml_map = {
'name': 'Queue'
}
- def __init__(self, *, name: str, metadata=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ name: str,
+ metadata: Optional[Dict[str, str]] = None,
+ **kwargs
+ ):
super(QueueItem, self).__init__(**kwargs)
self.name = name
self.metadata = metadata
-class QueueMessage(Model):
+class QueueMessage(msrest.serialization.Model):
"""A Message object which can be stored in a Queue.
All required parameters must be populated in order to send to Azure.
- :param message_text: Required. The content of the message
+ :param message_text: Required. The content of the message.
:type message_text: str
"""
@@ -476,27 +523,29 @@ class QueueMessage(Model):
}
_attribute_map = {
- 'message_text': {'key': 'MessageText', 'type': 'str', 'xml': {'name': 'MessageText'}},
- }
- _xml_map = {
+ 'message_text': {'key': 'MessageText', 'type': 'str'},
}
- def __init__(self, *, message_text: str, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ message_text: str,
+ **kwargs
+ ):
super(QueueMessage, self).__init__(**kwargs)
self.message_text = message_text
-class RetentionPolicy(Model):
+class RetentionPolicy(msrest.serialization.Model):
"""the retention policy.
All required parameters must be populated in order to send to Azure.
- :param enabled: Required. Indicates whether a retention policy is enabled
- for the storage service
+ :param enabled: Required. Indicates whether a retention policy is enabled for the storage
+ service.
:type enabled: bool
- :param days: Indicates the number of days that metrics or logging or
- soft-deleted data should be retained. All data older than this value will
- be deleted
+ :param days: Indicates the number of days that metrics or logging or soft-deleted data should
+ be retained. All data older than this value will be deleted.
:type days: int
"""
@@ -506,26 +555,30 @@ class RetentionPolicy(Model):
}
_attribute_map = {
- 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
- 'days': {'key': 'Days', 'type': 'int', 'xml': {'name': 'Days'}},
- }
- _xml_map = {
+ 'enabled': {'key': 'Enabled', 'type': 'bool'},
+ 'days': {'key': 'Days', 'type': 'int'},
}
- def __init__(self, *, enabled: bool, days: int=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ enabled: bool,
+ days: Optional[int] = None,
+ **kwargs
+ ):
super(RetentionPolicy, self).__init__(**kwargs)
self.enabled = enabled
self.days = days
-class SignedIdentifier(Model):
+class SignedIdentifier(msrest.serialization.Model):
"""signed identifier.
All required parameters must be populated in order to send to Azure.
- :param id: Required. a unique id
+ :param id: Required. a unique id.
:type id: str
- :param access_policy: The access policy
+ :param access_policy: The access policy.
:type access_policy: ~azure.storage.queue.models.AccessPolicy
"""
@@ -534,19 +587,23 @@ class SignedIdentifier(Model):
}
_attribute_map = {
- 'id': {'key': 'Id', 'type': 'str', 'xml': {'name': 'Id'}},
- 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy', 'xml': {'name': 'AccessPolicy'}},
- }
- _xml_map = {
+ 'id': {'key': 'Id', 'type': 'str'},
+ 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy'},
}
- def __init__(self, *, id: str, access_policy=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ id: str,
+ access_policy: Optional["AccessPolicy"] = None,
+ **kwargs
+ ):
super(SignedIdentifier, self).__init__(**kwargs)
self.id = id
self.access_policy = access_policy
-class StorageError(Model):
+class StorageError(msrest.serialization.Model):
"""StorageError.
:param message:
@@ -554,57 +611,50 @@ class StorageError(Model):
"""
_attribute_map = {
- 'message': {'key': 'Message', 'type': 'str', 'xml': {'name': 'Message'}},
- }
- _xml_map = {
+ 'message': {'key': 'Message', 'type': 'str'},
}
- def __init__(self, *, message: str=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ message: Optional[str] = None,
+ **kwargs
+ ):
super(StorageError, self).__init__(**kwargs)
self.message = message
-class StorageErrorException(HttpResponseError):
- """Server responsed with exception of type: 'StorageError'.
-
- :param deserialize: A deserializer
- :param response: Server response to be deserialized.
- """
-
- def __init__(self, response, deserialize, *args):
-
- model_name = 'StorageError'
- self.error = deserialize(model_name, response)
- if self.error is None:
- self.error = deserialize.dependencies[model_name]()
- super(StorageErrorException, self).__init__(response=response)
-
-
-class StorageServiceProperties(Model):
+class StorageServiceProperties(msrest.serialization.Model):
"""Storage Service Properties.
- :param logging: Azure Analytics Logging settings
+ :param logging: Azure Analytics Logging settings.
:type logging: ~azure.storage.queue.models.Logging
- :param hour_metrics: A summary of request statistics grouped by API in
- hourly aggregates for queues
+ :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for
+ queues.
:type hour_metrics: ~azure.storage.queue.models.Metrics
- :param minute_metrics: a summary of request statistics grouped by API in
- minute aggregates for queues
+ :param minute_metrics: a summary of request statistics grouped by API in minute aggregates for
+ queues.
:type minute_metrics: ~azure.storage.queue.models.Metrics
:param cors: The set of CORS rules.
:type cors: list[~azure.storage.queue.models.CorsRule]
"""
_attribute_map = {
- 'logging': {'key': 'Logging', 'type': 'Logging', 'xml': {'name': 'Logging'}},
- 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics', 'xml': {'name': 'HourMetrics'}},
- 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics', 'xml': {'name': 'MinuteMetrics'}},
- 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'name': 'Cors', 'itemsName': 'CorsRule', 'wrapped': True}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, logging=None, hour_metrics=None, minute_metrics=None, cors=None, **kwargs) -> None:
+ 'logging': {'key': 'Logging', 'type': 'Logging'},
+ 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics'},
+ 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics'},
+ 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'wrapped': True}},
+ }
+
+ def __init__(
+ self,
+ *,
+ logging: Optional["Logging"] = None,
+ hour_metrics: Optional["Metrics"] = None,
+ minute_metrics: Optional["Metrics"] = None,
+ cors: Optional[List["CorsRule"]] = None,
+ **kwargs
+ ):
super(StorageServiceProperties, self).__init__(**kwargs)
self.logging = logging
self.hour_metrics = hour_metrics
@@ -612,20 +662,22 @@ def __init__(self, *, logging=None, hour_metrics=None, minute_metrics=None, cors
self.cors = cors
-class StorageServiceStats(Model):
+class StorageServiceStats(msrest.serialization.Model):
"""Stats for the storage service.
- :param geo_replication: Geo-Replication information for the Secondary
- Storage Service
+ :param geo_replication: Geo-Replication information for the Secondary Storage Service.
:type geo_replication: ~azure.storage.queue.models.GeoReplication
"""
_attribute_map = {
- 'geo_replication': {'key': 'GeoReplication', 'type': 'GeoReplication', 'xml': {'name': 'GeoReplication'}},
- }
- _xml_map = {
+ 'geo_replication': {'key': 'GeoReplication', 'type': 'GeoReplication'},
}
- def __init__(self, *, geo_replication=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ geo_replication: Optional["GeoReplication"] = None,
+ **kwargs
+ ):
super(StorageServiceStats, self).__init__(**kwargs)
self.geo_replication = geo_replication
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/__init__.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/__init__.py
index d600f5294c7f..c0abe554a930 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/__init__.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/__init__.py
@@ -1,12 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._service_operations import ServiceOperations
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py
index 8be7a24dbb60..0d1a4a7f7d7b 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py
@@ -1,184 +1,211 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+import warnings
-from azure.core.exceptions import map_error
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
-from .. import models
+from .. import models as _models
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, Optional, TypeVar
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class MessageIdOperations(object):
"""MessageIdOperations operations.
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.queue.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
- models = models
+ models = _models
def __init__(self, client, config, serializer, deserializer):
-
self._client = client
self._serialize = serializer
self._deserialize = deserializer
-
self._config = config
- def update(self, pop_receipt, visibilitytimeout, queue_message=None, timeout=None, request_id=None, cls=None, **kwargs):
- """The Update operation was introduced with version 2011-08-18 of the
- Queue service API. The Update Message operation updates the visibility
- timeout of a message. You can also use this operation to update the
- contents of a message. A message must be in a format that can be
- included in an XML request with UTF-8 encoding, and the encoded message
- can be up to 64KB in size.
-
- :param pop_receipt: Required. Specifies the valid pop receipt value
- returned from an earlier call to the Get Messages or Update Message
- operation.
+ def update(
+ self,
+ pop_receipt, # type: str
+ visibilitytimeout, # type: int
+ timeout=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ queue_message=None, # type: Optional["_models.QueueMessage"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """The Update operation was introduced with version 2011-08-18 of the Queue service API. The
+ Update Message operation updates the visibility timeout of a message. You can also use this
+ operation to update the contents of a message. A message must be in a format that can be
+ included in an XML request with UTF-8 encoding, and the encoded message can be up to 64KB in
+ size.
+
+ :param pop_receipt: Required. Specifies the valid pop receipt value returned from an earlier
+ call to the Get Messages or Update Message operation.
:type pop_receipt: str
- :param visibilitytimeout: Optional. Specifies the new visibility
- timeout value, in seconds, relative to server time. The default value
- is 30 seconds. A specified value must be larger than or equal to 1
- second, and cannot be larger than 7 days, or larger than 2 hours on
- REST protocol versions prior to version 2011-08-18. The visibility
- timeout of a message can be set to a value later than the expiry time.
+ :param visibilitytimeout: Optional. Specifies the new visibility timeout value, in seconds,
+ relative to server time. The default value is 30 seconds. A specified value must be larger than
+ or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol
+ versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value
+ later than the expiry time.
:type visibilitytimeout: int
- :param queue_message: A Message object which can be stored in a Queue
- :type queue_message: ~azure.storage.queue.models.QueueMessage
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see Setting Timeouts for Queue Service Operations..
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :param queue_message: A Message object which can be stored in a Queue.
+ :type queue_message: ~azure.storage.queue.models.QueueMessage
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None, or the result of cls(response)
:rtype: None
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ content_type = kwargs.pop("content_type", "application/xml")
+ accept = "application/xml"
+
# Construct URL
- url = self.update.metadata['url']
+ url = self.update.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
query_parameters['popreceipt'] = self._serialize.query("pop_receipt", pop_receipt, 'str')
query_parameters['visibilitytimeout'] = self._serialize.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0)
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
- header_parameters['Content-Type'] = 'application/xml; charset=utf-8'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct body
+ body_content_kwargs = {} # type: Dict[str, Any]
if queue_message is not None:
- body_content = self._serialize.body(queue_message, 'QueueMessage')
+ body_content = self._serialize.body(queue_message, 'QueueMessage', is_xml=True)
else:
body_content = None
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters, body_content)
+ body_content_kwargs['content'] = body_content
+ request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-popreceipt']=self._deserialize('str', response.headers.get('x-ms-popreceipt'))
+ response_headers['x-ms-time-next-visible']=self._deserialize('rfc-1123', response.headers.get('x-ms-time-next-visible'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-popreceipt': self._deserialize('str', response.headers.get('x-ms-popreceipt')),
- 'x-ms-time-next-visible': self._deserialize('rfc-1123', response.headers.get('x-ms-time-next-visible')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- update.metadata = {'url': '/{queueName}/messages/{messageid}'}
-
- def delete(self, pop_receipt, timeout=None, request_id=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ update.metadata = {'url': '/{queueName}/messages/{messageid}'} # type: ignore
+
+ def delete(
+ self,
+ pop_receipt, # type: str
+ timeout=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""The Delete operation deletes the specified message.
- :param pop_receipt: Required. Specifies the valid pop receipt value
- returned from an earlier call to the Get Messages or Update Message
- operation.
+ :param pop_receipt: Required. Specifies the valid pop receipt value returned from an earlier
+ call to the Get Messages or Update Message operation.
:type pop_receipt: str
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see Setting Timeouts for Queue Service Operations..
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None, or the result of cls(response)
:rtype: None
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/xml"
+
# Construct URL
- url = self.delete.metadata['url']
+ url = self.delete.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
query_parameters['popreceipt'] = self._serialize.query("pop_receipt", pop_receipt, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- delete.metadata = {'url': '/{queueName}/messages/{messageid}'}
+ return cls(pipeline_response, None, response_headers)
+
+ delete.metadata = {'url': '/{queueName}/messages/{messageid}'} # type: ignore
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py
index ccd00ceaa53a..0849705219a7 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py
@@ -1,85 +1,98 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+import warnings
-from azure.core.exceptions import map_error
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
-from .. import models
+from .. import models as _models
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class MessagesOperations(object):
"""MessagesOperations operations.
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.queue.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
- :ivar peekonly: . Constant value: "true".
"""
- models = models
+ models = _models
def __init__(self, client, config, serializer, deserializer):
-
self._client = client
self._serialize = serializer
self._deserialize = deserializer
-
self._config = config
- self.peekonly = "true"
- def dequeue(self, number_of_messages=None, visibilitytimeout=None, timeout=None, request_id=None, cls=None, **kwargs):
- """The Dequeue operation retrieves one or more messages from the front of
- the queue.
-
- :param number_of_messages: Optional. A nonzero integer value that
- specifies the number of messages to retrieve from the queue, up to a
- maximum of 32. If fewer are visible, the visible messages are
- returned. By default, a single message is retrieved from the queue
- with this operation.
+ def dequeue(
+ self,
+ number_of_messages=None, # type: Optional[int]
+ visibilitytimeout=None, # type: Optional[int]
+ timeout=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> List["_models.DequeuedMessageItem"]
+ """The Dequeue operation retrieves one or more messages from the front of the queue.
+
+ :param number_of_messages: Optional. A nonzero integer value that specifies the number of
+ messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible
+ messages are returned. By default, a single message is retrieved from the queue with this
+ operation.
:type number_of_messages: int
- :param visibilitytimeout: Optional. Specifies the new visibility
- timeout value, in seconds, relative to server time. The default value
- is 30 seconds. A specified value must be larger than or equal to 1
- second, and cannot be larger than 7 days, or larger than 2 hours on
- REST protocol versions prior to version 2011-08-18. The visibility
- timeout of a message can be set to a value later than the expiry time.
+ :param visibilitytimeout: Optional. Specifies the new visibility timeout value, in seconds,
+ relative to server time. The default value is 30 seconds. A specified value must be larger than
+ or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol
+ versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value
+ later than the expiry time.
:type visibilitytimeout: int
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see Setting Timeouts for Queue Service Operations..
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: list or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: list of DequeuedMessageItem, or the result of cls(response)
:rtype: list[~azure.storage.queue.models.DequeuedMessageItem]
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.DequeuedMessageItem"]]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/xml"
+
# Construct URL
- url = self.dequeue.metadata['url']
+ url = self.dequeue.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
if number_of_messages is not None:
query_parameters['numofmessages'] = self._serialize.query("number_of_messages", number_of_messages, 'int', minimum=1)
if visibilitytimeout is not None:
@@ -88,145 +101,159 @@ def dequeue(self, number_of_messages=None, visibilitytimeout=None, timeout=None,
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('[DequeuedMessageItem]', response)
- header_dict = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('[DequeuedMessageItem]', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- dequeue.metadata = {'url': '/{queueName}/messages'}
-
- def clear(self, timeout=None, request_id=None, cls=None, **kwargs):
+ dequeue.metadata = {'url': '/{queueName}/messages'} # type: ignore
+
+ def clear(
+ self,
+ timeout=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""The Clear operation deletes all messages from the specified queue.
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see Setting Timeouts for Queue Service Operations..
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None, or the result of cls(response)
:rtype: None
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/xml"
+
# Construct URL
- url = self.clear.metadata['url']
+ url = self.clear.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- clear.metadata = {'url': '/{queueName}/messages'}
-
- def enqueue(self, queue_message=None, visibilitytimeout=None, message_time_to_live=None, timeout=None, request_id=None, cls=None, **kwargs):
- """The Enqueue operation adds a new message to the back of the message
- queue. A visibility timeout can also be specified to make the message
- invisible until the visibility timeout expires. A message must be in a
- format that can be included in an XML request with UTF-8 encoding. The
- encoded message can be up to 64 KB in size for versions 2011-08-18 and
- newer, or 8 KB in size for previous versions.
-
- :param queue_message: A Message object which can be stored in a Queue
+ return cls(pipeline_response, None, response_headers)
+
+ clear.metadata = {'url': '/{queueName}/messages'} # type: ignore
+
+ def enqueue(
+ self,
+ queue_message, # type: "_models.QueueMessage"
+ visibilitytimeout=None, # type: Optional[int]
+ message_time_to_live=None, # type: Optional[int]
+ timeout=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> List["_models.EnqueuedMessage"]
+ """The Enqueue operation adds a new message to the back of the message queue. A visibility timeout
+ can also be specified to make the message invisible until the visibility timeout expires. A
+ message must be in a format that can be included in an XML request with UTF-8 encoding. The
+ encoded message can be up to 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size
+ for previous versions.
+
+ :param queue_message: A Message object which can be stored in a Queue.
:type queue_message: ~azure.storage.queue.models.QueueMessage
- :param visibilitytimeout: Optional. Specifies the new visibility
- timeout value, in seconds, relative to server time. The default value
- is 30 seconds. A specified value must be larger than or equal to 1
- second, and cannot be larger than 7 days, or larger than 2 hours on
- REST protocol versions prior to version 2011-08-18. The visibility
- timeout of a message can be set to a value later than the expiry time.
+ :param visibilitytimeout: Optional. If specified, the request must be made using an x-ms-
+ version of 2011-08-18 or later. If not specified, the default value is 0. Specifies the new
+ visibility timeout value, in seconds, relative to server time. The new value must be larger
+ than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message
+ cannot be set to a value later than the expiry time. visibilitytimeout should be set to a value
+ smaller than the time-to-live value.
:type visibilitytimeout: int
- :param message_time_to_live: Optional. Specifies the time-to-live
- interval for the message, in seconds. Prior to version 2017-07-29, the
- maximum time-to-live allowed is 7 days. For version 2017-07-29 or
- later, the maximum time-to-live can be any positive number, as well as
- -1 indicating that the message does not expire. If this parameter is
- omitted, the default time-to-live is 7 days.
+ :param message_time_to_live: Optional. Specifies the time-to-live interval for the message, in
+ seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version
+ 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1
+ indicating that the message does not expire. If this parameter is omitted, the default time-to-
+ live is 7 days.
:type message_time_to_live: int
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see Setting Timeouts for Queue Service Operations..
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: list or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: list of EnqueuedMessage, or the result of cls(response)
:rtype: list[~azure.storage.queue.models.EnqueuedMessage]
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.EnqueuedMessage"]]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ content_type = kwargs.pop("content_type", "application/xml")
+ accept = "application/xml"
+
# Construct URL
- url = self.enqueue.metadata['url']
+ url = self.enqueue.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
if visibilitytimeout is not None:
query_parameters['visibilitytimeout'] = self._serialize.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0)
if message_time_to_live is not None:
@@ -235,116 +262,112 @@ def enqueue(self, queue_message=None, visibilitytimeout=None, message_time_to_li
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
- header_parameters['Content-Type'] = 'application/xml; charset=utf-8'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
-
- # Construct body
- if queue_message is not None:
- body_content = self._serialize.body(queue_message, 'QueueMessage')
- else:
- body_content = None
-
- # Construct and send request
- request = self._client.post(url, query_parameters, header_parameters, body_content)
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content = self._serialize.body(queue_message, 'QueueMessage', is_xml=True)
+ body_content_kwargs['content'] = body_content
+ request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 201:
- deserialized = self._deserialize('[EnqueuedMessage]', response)
- header_dict = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('[EnqueuedMessage]', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- enqueue.metadata = {'url': '/{queueName}/messages'}
-
- def peek(self, number_of_messages=None, timeout=None, request_id=None, cls=None, **kwargs):
- """The Peek operation retrieves one or more messages from the front of the
- queue, but does not alter the visibility of the message.
-
- :param number_of_messages: Optional. A nonzero integer value that
- specifies the number of messages to retrieve from the queue, up to a
- maximum of 32. If fewer are visible, the visible messages are
- returned. By default, a single message is retrieved from the queue
- with this operation.
+ enqueue.metadata = {'url': '/{queueName}/messages'} # type: ignore
+
+ def peek(
+ self,
+ number_of_messages=None, # type: Optional[int]
+ timeout=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> List["_models.PeekedMessageItem"]
+ """The Peek operation retrieves one or more messages from the front of the queue, but does not
+ alter the visibility of the message.
+
+ :param number_of_messages: Optional. A nonzero integer value that specifies the number of
+ messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible
+ messages are returned. By default, a single message is retrieved from the queue with this
+ operation.
:type number_of_messages: int
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see Setting Timeouts for Queue Service Operations..
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: list or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: list of PeekedMessageItem, or the result of cls(response)
:rtype: list[~azure.storage.queue.models.PeekedMessageItem]
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PeekedMessageItem"]]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ peekonly = "true"
+ accept = "application/xml"
+
# Construct URL
- url = self.peek.metadata['url']
+ url = self.peek.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['peekonly'] = self._serialize.query("peekonly", peekonly, 'str')
if number_of_messages is not None:
query_parameters['numofmessages'] = self._serialize.query("number_of_messages", number_of_messages, 'int', minimum=1)
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['peekonly'] = self._serialize.query("self.peekonly", self.peekonly, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('[PeekedMessageItem]', response)
- header_dict = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('[PeekedMessageItem]', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- peek.metadata = {'url': '/{queueName}/messages'}
+ peek.metadata = {'url': '/{queueName}/messages'} # type: ignore
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py
index 02618d6a1707..784057fd47e8 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py
@@ -1,432 +1,491 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+import warnings
-from azure.core.exceptions import map_error
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
-from .. import models
+from .. import models as _models
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class QueueOperations(object):
"""QueueOperations operations.
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.queue.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
- models = models
+ models = _models
def __init__(self, client, config, serializer, deserializer):
-
self._client = client
self._serialize = serializer
self._deserialize = deserializer
-
self._config = config
- def create(self, timeout=None, metadata=None, request_id=None, cls=None, **kwargs):
+ def create(
+ self,
+ timeout=None, # type: Optional[int]
+ metadata=None, # type: Optional[str]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""creates a new queue under the given account.
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see Setting Timeouts for Queue Service Operations..
:type timeout: int
- :param metadata: Optional. Include this parameter to specify that the
- queue's metadata be returned as part of the response body. Note that
- metadata requested with this parameter must be stored in accordance
- with the naming restrictions imposed by the 2009-09-19 version of the
- Queue service. Beginning with this version, all metadata names must
- adhere to the naming conventions for C# identifiers.
+ :param metadata: Optional. Include this parameter to specify that the queue's metadata be
+ returned as part of the response body. Note that metadata requested with this parameter must be
+ stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the
+ Queue service. Beginning with this version, all metadata names must adhere to the naming
+ conventions for C# identifiers.
:type metadata: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None, or the result of cls(response)
:rtype: None
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/xml"
+
# Construct URL
- url = self.create.metadata['url']
+ url = self.create.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
if metadata is not None:
header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ if response.status_code == 201:
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if response.status_code == 204:
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create.metadata = {'url': '/{queueName}'}
-
- def delete(self, timeout=None, request_id=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ create.metadata = {'url': '/{queueName}'} # type: ignore
+
+ def delete(
+ self,
+ timeout=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""operation permanently deletes the specified queue.
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see Setting Timeouts for Queue Service Operations..
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None, or the result of cls(response)
:rtype: None
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/xml"
+
# Construct URL
- url = self.delete.metadata['url']
+ url = self.delete.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- delete.metadata = {'url': '/{queueName}'}
-
- def get_properties(self, timeout=None, request_id=None, cls=None, **kwargs):
- """Retrieves user-defined metadata and queue properties on the specified
- queue. Metadata is associated with the queue as name-values pairs.
-
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see None
+ """sets stored access policies for the queue that may be used with Shared Access Signatures.
+
+ :param timeout: The The timeout parameter is expressed in seconds. For more information, see None
+ """Sets properties for a storage account's Queue service endpoint, including properties for
+ Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
:param storage_service_properties: The StorageService properties.
- :type storage_service_properties:
- ~azure.storage.queue.models.StorageServiceProperties
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see Setting Timeouts for Queue Service Operations..
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None, or the result of cls(response)
:rtype: None
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "service"
comp = "properties"
+ content_type = kwargs.pop("content_type", "application/xml")
+ accept = "application/xml"
# Construct URL
- url = self.set_properties.metadata['url']
+ url = self.set_properties.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Content-Type'] = 'application/xml; charset=utf-8'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
-
- # Construct body
- body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters, body_content)
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True)
+ body_content_kwargs['content'] = body_content
+ request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_properties.metadata = {'url': '/'}
-
- def get_properties(self, timeout=None, request_id=None, cls=None, **kwargs):
- """gets the properties of a storage account's Queue service, including
- properties for Storage Analytics and CORS (Cross-Origin Resource
- Sharing) rules.
-
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see "_models.ListQueuesSegmentResponse"
+ """The List Queues Segment operation returns a list of the queues under the specified account.
+
+ :param prefix: Filters the results to return only queues whose name begins with the specified
+ prefix.
:type prefix: str
- :param marker: A string value that identifies the portion of the list
- of queues to be returned with the next listing operation. The
- operation returns the NextMarker value within the response body if the
- listing operation did not return all queues remaining to be listed
- with the current page. The NextMarker value can be used as the value
- for the marker parameter in a subsequent call to request the next page
- of list items. The marker value is opaque to the client.
+ :param marker: A string value that identifies the portion of the list of queues to be returned
+ with the next listing operation. The operation returns the NextMarker value within the response
+ body if the listing operation did not return all queues remaining to be listed with the current
+ page. The NextMarker value can be used as the value for the marker parameter in a subsequent
+ call to request the next page of list items. The marker value is opaque to the client.
:type marker: str
- :param maxresults: Specifies the maximum number of queues to return.
- If the request does not specify maxresults, or specifies a value
- greater than 5000, the server will return up to 5000 items. Note that
- if the listing operation crosses a partition boundary, then the
- service will return a continuation token for retrieving the remainder
- of the results. For this reason, it is possible that the service will
- return fewer results than specified by maxresults, or than the default
- of 5000.
+ :param maxresults: Specifies the maximum number of queues to return. If the request does not
+ specify maxresults, or specifies a value greater than 5000, the server will return up to 5000
+ items. Note that if the listing operation crosses a partition boundary, then the service will
+ return a continuation token for retrieving the remainder of the results. For this reason, it is
+ possible that the service will return fewer results than specified by maxresults, or than the
+ default of 5000.
:type maxresults: int
- :param include: Include this parameter to specify that the queues's
- metadata be returned as part of the response body.
- :type include: list[str or
- ~azure.storage.queue.models.ListQueuesIncludeType]
- :param timeout: The The timeout parameter is expressed in seconds. For
- more information, see Setting Timeouts for Queue Service Operations..
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ListQueuesSegmentResponse or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ListQueuesSegmentResponse, or the result of cls(response)
:rtype: ~azure.storage.queue.models.ListQueuesSegmentResponse
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListQueuesSegmentResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "list"
+ accept = "application/xml"
# Construct URL
- url = self.list_queues_segment.metadata['url']
+ url = self.list_queues_segment.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if prefix is not None:
query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str')
if marker is not None:
@@ -310,40 +336,34 @@ def list_queues_segment(self, prefix=None, marker=None, maxresults=None, include
if maxresults is not None:
query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
if include is not None:
- query_parameters['include'] = self._serialize.query("include", include, '[ListQueuesIncludeType]', div=',')
+ query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ListQueuesSegmentResponse', response)
- header_dict = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ListQueuesSegmentResponse', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- list_queues_segment.metadata = {'url': '/'}
+ list_queues_segment.metadata = {'url': '/'} # type: ignore
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/py.typed b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/py.typed
new file mode 100644
index 000000000000..e5aff4f83af8
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/py.typed
@@ -0,0 +1 @@
+# Marker file for PEP 561.
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/version.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/version.py
deleted file mode 100644
index f8a9f8f977c9..000000000000
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/version.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
-# --------------------------------------------------------------------------
-
-VERSION = "2018-03-28"
-
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_message_encoding.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_message_encoding.py
index 52b643905c08..e9b4f88eb0c7 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_message_encoding.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_message_encoding.py
@@ -122,6 +122,7 @@ class BinaryBase64DecodePolicy(MessageDecodePolicy):
"""
def decode(self, content, response):
+ response = response.http_response
try:
return b64decode(content.encode('utf-8'))
except (ValueError, TypeError) as error:
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py
index 24d3b4bea627..943de5ce8e7d 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py
@@ -7,10 +7,10 @@
# pylint: disable=super-init-not-called
from typing import List # pylint: disable=unused-import
+from azure.core.exceptions import HttpResponseError
from azure.core.paging import PageIterator
from ._shared.response_handlers import return_context_and_deserialized, process_storage_error
from ._shared.models import DictMixin
-from ._generated.models import StorageErrorException
from ._generated.models import AccessPolicy as GenAccessPolicy
from ._generated.models import Logging as GeneratedLogging
from ._generated.models import Metrics as GeneratedMetrics
@@ -279,7 +279,7 @@ def __init__(self, command, results_per_page=None, continuation_token=None):
def _get_next_cb(self, continuation_token):
try:
return self._command(number_of_messages=self.results_per_page)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
def _extract_data_cb(self, messages): # pylint: disable=no-self-use
@@ -349,7 +349,7 @@ def _get_next_cb(self, continuation_token):
maxresults=self.results_per_page,
cls=return_context_and_deserialized,
use_location=self.location_mode)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
def _extract_data_cb(self, get_next_return):
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_client.py
index 7bebbdbed064..3a75db386fe6 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_client.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_client.py
@@ -16,6 +16,7 @@
import six
+from azure.core.exceptions import HttpResponseError
from azure.core.paging import ItemPaged
from azure.core.tracing.decorator import distributed_trace
from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query
@@ -26,8 +27,8 @@
return_headers_and_deserialized)
from ._message_encoding import NoEncodePolicy, NoDecodePolicy
from ._deserialize import deserialize_queue_properties, deserialize_queue_creation
-from ._generated import AzureQueueStorage, VERSION
-from ._generated.models import StorageErrorException, SignedIdentifier
+from ._generated import AzureQueueStorage
+from ._generated.models import SignedIdentifier
from ._generated.models import QueueMessage as GenQueueMessage
from ._models import QueueMessage, AccessPolicy, MessagesPaged
@@ -100,7 +101,8 @@ def __init__(
self._config.message_encode_policy = kwargs.get('message_encode_policy', None) or NoEncodePolicy()
self._config.message_decode_policy = kwargs.get('message_decode_policy', None) or NoDecodePolicy()
self._client = AzureQueueStorage(self.url, pipeline=self._pipeline)
- self._client._config.version = kwargs.get('api_version', VERSION) # pylint: disable=protected-access
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = kwargs.get('api_version', default_api_version) # pylint: disable=protected-access
def _format_url(self, hostname):
"""Format the endpoint URL according to the current location
@@ -229,7 +231,7 @@ def create_queue(self, **kwargs):
headers=headers,
cls=deserialize_queue_creation,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -261,7 +263,7 @@ def delete_queue(self, **kwargs):
timeout = kwargs.pop('timeout', None)
try:
self._client.queue.delete(timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -291,7 +293,7 @@ def get_queue_properties(self, **kwargs):
timeout=timeout,
cls=deserialize_queue_properties,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
response.name = self.queue_name
return response # type: ignore
@@ -328,7 +330,7 @@ def set_queue_metadata(self, metadata=None, **kwargs):
headers=headers,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -348,7 +350,7 @@ def get_queue_access_policy(self, **kwargs):
timeout=timeout,
cls=return_headers_and_deserialized,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return {s.id: s.access_policy or AccessPolicy() for s in identifiers}
@@ -403,7 +405,7 @@ def set_queue_access_policy(self, signed_identifiers, **kwargs):
queue_acl=signed_identifiers or None,
timeout=timeout,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -481,7 +483,7 @@ def send_message( # type: ignore
queue_message.pop_receipt = enqueued[0].pop_receipt
queue_message.next_visible_on = enqueued[0].time_next_visible
return queue_message
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -537,7 +539,7 @@ def receive_message(self, **kwargs):
wrapped_message = QueueMessage._from_generated( # pylint: disable=protected-access
message[0]) if message != [] else None
return wrapped_message
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -608,7 +610,7 @@ def receive_messages(self, **kwargs):
**kwargs
)
return ItemPaged(command, results_per_page=messages_per_page, page_iterator_class=MessagesPaged)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -705,7 +707,7 @@ def update_message(self, message, pop_receipt=None, content=None, **kwargs):
new_message.pop_receipt = response['popreceipt']
new_message.next_visible_on = response['time_next_visible']
return new_message
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -763,7 +765,7 @@ def peek_messages(self, max_messages=None, **kwargs):
for peeked in messages:
wrapped_messages.append(QueueMessage._from_generated(peeked)) # pylint: disable=protected-access
return wrapped_messages
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -786,7 +788,7 @@ def clear_messages(self, **kwargs):
timeout = kwargs.pop('timeout', None)
try:
self._client.messages.clear(timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -839,5 +841,5 @@ def delete_message(self, message, pop_receipt=None, **kwargs):
queue_message_id=message_id,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_service_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_service_client.py
index 9a67862f144a..d9faf38e5da8 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_service_client.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_service_client.py
@@ -13,14 +13,15 @@
except ImportError:
from urlparse import urlparse # type: ignore
+from azure.core.exceptions import HttpResponseError
from azure.core.paging import ItemPaged
from azure.core.pipeline import Pipeline
from azure.core.tracing.decorator import distributed_trace
from ._shared.models import LocationMode
from ._shared.base_client import StorageAccountHostsMixin, TransportWrapper, parse_connection_str, parse_query
from ._shared.response_handlers import process_storage_error
-from ._generated import AzureQueueStorage, VERSION
-from ._generated.models import StorageServiceProperties, StorageErrorException
+from ._generated import AzureQueueStorage
+from ._generated.models import StorageServiceProperties
from ._models import (
QueuePropertiesPaged,
@@ -103,7 +104,8 @@ def __init__(
self._query_str, credential = self._format_query_string(sas_token, credential)
super(QueueServiceClient, self).__init__(parsed_url, service='queue', credential=credential, **kwargs)
self._client = AzureQueueStorage(self.url, pipeline=self._pipeline)
- self._client._config.version = kwargs.get('api_version', VERSION) # pylint: disable=protected-access
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = kwargs.get('api_version', default_api_version) # pylint: disable=protected-access
def _format_url(self, hostname):
"""Format the endpoint URL according to the current location
@@ -176,7 +178,7 @@ def get_service_stats(self, **kwargs):
stats = self._client.service.get_statistics( # type: ignore
timeout=timeout, use_location=LocationMode.SECONDARY, **kwargs)
return service_stats_deserialize(stats)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -204,7 +206,7 @@ def get_service_properties(self, **kwargs):
try:
service_props = self._client.service.get_properties(timeout=timeout, **kwargs) # type: ignore
return service_properties_deserialize(service_props)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -260,7 +262,7 @@ def set_service_properties( # type: ignore
)
try:
return self._client.service.set_properties(props, timeout=timeout, **kwargs) # type: ignore
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py
index e8788ec65b40..d472cbcd0e14 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py
@@ -56,7 +56,6 @@
ExponentialRetry,
)
from .._version import VERSION
-from .._generated.models import StorageErrorException
from .response_handlers import process_storage_error, PartialBatchErrorException
@@ -305,7 +304,7 @@ def _batch_send(
raise error
return iter(parts)
return parts
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
class TransportWrapper(HttpTransport):
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py
index aea9b85064ff..16eb6de66750 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py
@@ -35,7 +35,6 @@
)
from .policies_async import AsyncStorageResponseHook
-from .._generated.models import StorageErrorException
from .response_handlers import process_storage_error, PartialBatchErrorException
if TYPE_CHECKING:
@@ -155,7 +154,7 @@ async def _batch_send(
raise error
return AsyncList(parts_list)
return parts
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/constants.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/constants.py
index 7fb05b559850..f2695b5e9400 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/constants.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/constants.py
@@ -5,10 +5,10 @@
# --------------------------------------------------------------------------
import sys
-from .._generated.version import VERSION
+from .._generated import AzureQueueStorage
-X_MS_VERSION = VERSION
+X_MS_VERSION = AzureQueueStorage(url="get_api_version")._config.version # pylint: disable=protected-access
# Socket timeout in seconds
CONNECTION_TIMEOUT = 20
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/encryption.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/encryption.py
index 62607cc0cf85..439db5be42ae 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/encryption.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/encryption.py
@@ -520,6 +520,7 @@ def decrypt_queue_message(message, response, require_encryption, key_encryption_
:return: The plain text message from the queue message.
:rtype: str
'''
+ response = response.http_response
try:
message = loads(message)
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py
index 5df2f5c9a625..aee171a26510 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py
@@ -3,7 +3,6 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
-
from typing import ( # pylint: disable=unused-import
Union, Optional, Any, Iterable, Dict, List, Type, Tuple,
TYPE_CHECKING
@@ -80,11 +79,14 @@ def return_headers_and_deserialized(response, deserialized, response_headers):
def return_context_and_deserialized(response, deserialized, response_headers): # pylint: disable=unused-argument
- return response.location_mode, deserialized
+ return response.http_response.location_mode, deserialized
def process_storage_error(storage_error):
raise_error = HttpResponseError
+ # If the status code is 200 or 204 then it has already been deserialized.
+ if storage_error.response.status_code in [200, 204]:
+ raise storage_error
error_code = storage_error.response.headers.get('x-ms-error-code')
error_message = storage_error.message
additional_data = {}
@@ -131,7 +133,6 @@ def process_storage_error(storage_error):
StorageErrorCode.share_being_deleted]:
raise_error = ResourceExistsError
except ValueError:
- # Got an unknown error code
pass
try:
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_models.py
index 4e4577dbb9af..cb9083617b1d 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_models.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_models.py
@@ -8,10 +8,10 @@
from typing import List # pylint: disable=unused-import
from azure.core.async_paging import AsyncPageIterator
+from azure.core.exceptions import HttpResponseError
from .._shared.response_handlers import (
process_storage_error,
return_context_and_deserialized)
-from .._generated.models import StorageErrorException
from .._models import QueueMessage, QueueProperties
@@ -36,7 +36,7 @@ def __init__(self, command, results_per_page=None, continuation_token=None):
async def _get_next_cb(self, continuation_token):
try:
return await self._command(number_of_messages=self.results_per_page)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
async def _extract_data_cb(self, messages):
@@ -83,7 +83,7 @@ async def _get_next_cb(self, continuation_token):
maxresults=self.results_per_page,
cls=return_context_and_deserialized,
use_location=self.location_mode)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
async def _extract_data_cb(self, get_next_return):
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py
index b9b611ef18d0..34ecba6b6fe2 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py
@@ -25,6 +25,7 @@
from urlparse import urlparse # type: ignore
from urllib2 import quote, unquote # type: ignore
+from azure.core.exceptions import HttpResponseError
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
@@ -38,9 +39,8 @@
return_headers_and_deserialized,
)
from .._deserialize import deserialize_queue_properties, deserialize_queue_creation
-from .._generated.version import VERSION
from .._generated.aio import AzureQueueStorage
-from .._generated.models import StorageErrorException, SignedIdentifier
+from .._generated.models import SignedIdentifier
from .._generated.models import QueueMessage as GenQueueMessage
from .._models import QueueMessage, AccessPolicy
@@ -111,7 +111,8 @@ def __init__(
account_url, queue_name=queue_name, credential=credential, loop=loop, **kwargs
)
self._client = AzureQueueStorage(self.url, pipeline=self._pipeline, loop=loop) # type: ignore
- self._client._config.version = kwargs.get('api_version', VERSION) # pylint: disable=protected-access
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = kwargs.get('api_version', default_api_version) # pylint: disable=protected-access
self._loop = loop
@distributed_trace_async
@@ -149,7 +150,7 @@ async def create_queue(self, **kwargs):
return await self._client.queue.create( # type: ignore
metadata=metadata, timeout=timeout, headers=headers, cls=deserialize_queue_creation, **kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -181,7 +182,7 @@ async def delete_queue(self, **kwargs):
timeout = kwargs.pop('timeout', None)
try:
await self._client.queue.delete(timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -210,7 +211,7 @@ async def get_queue_properties(self, **kwargs):
response = await self._client.queue.get_properties(
timeout=timeout, cls=deserialize_queue_properties, **kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
response.name = self.queue_name
return response # type: ignore
@@ -245,7 +246,7 @@ async def set_queue_metadata(self, metadata=None, **kwargs):
return await self._client.queue.set_metadata( # type: ignore
timeout=timeout, headers=headers, cls=return_response_headers, **kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -264,7 +265,7 @@ async def get_queue_access_policy(self, **kwargs):
_, identifiers = await self._client.queue.get_access_policy(
timeout=timeout, cls=return_headers_and_deserialized, **kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return {s.id: s.access_policy or AccessPolicy() for s in identifiers}
@@ -317,7 +318,7 @@ async def set_queue_access_policy(self, signed_identifiers, **kwargs):
signed_identifiers = identifiers # type: ignore
try:
await self._client.queue.set_access_policy(queue_acl=signed_identifiers or None, timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -398,7 +399,7 @@ async def send_message( # type: ignore
queue_message.pop_receipt = enqueued[0].pop_receipt
queue_message.next_visible_on = enqueued[0].time_next_visible
return queue_message
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -454,7 +455,7 @@ async def receive_message(self, **kwargs):
wrapped_message = QueueMessage._from_generated( # pylint: disable=protected-access
message[0]) if message != [] else None
return wrapped_message
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -517,7 +518,7 @@ def receive_messages(self, **kwargs):
**kwargs
)
return AsyncItemPaged(command, results_per_page=messages_per_page, page_iterator_class=MessagesPaged)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -620,7 +621,7 @@ async def update_message(
new_message.pop_receipt = response["popreceipt"]
new_message.next_visible_on = response["time_next_visible"]
return new_message
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -677,7 +678,7 @@ async def peek_messages(self, max_messages=None, **kwargs):
for peeked in messages:
wrapped_messages.append(QueueMessage._from_generated(peeked)) # pylint: disable=protected-access
return wrapped_messages
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -700,7 +701,7 @@ async def clear_messages(self, **kwargs):
timeout = kwargs.pop('timeout', None)
try:
await self._client.messages.clear(timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -750,5 +751,5 @@ async def delete_message(self, message, pop_receipt=None, **kwargs):
await self._client.message_id.delete(
pop_receipt=receipt, timeout=timeout, queue_message_id=message_id, **kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py
index 63c11ff004f1..805ed41b7cc5 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py
@@ -14,6 +14,7 @@
except ImportError:
from urlparse import urlparse # type: ignore
+from azure.core.exceptions import HttpResponseError
from azure.core.async_paging import AsyncItemPaged
from azure.core.tracing.decorator import distributed_trace
from azure.core.pipeline import AsyncPipeline
@@ -24,9 +25,8 @@
from .._shared.models import LocationMode
from .._shared.base_client_async import AsyncStorageAccountHostsMixin, AsyncTransportWrapper
from .._shared.response_handlers import process_storage_error
-from .._generated.version import VERSION
from .._generated.aio import AzureQueueStorage
-from .._generated.models import StorageServiceProperties, StorageErrorException
+from .._generated.models import StorageServiceProperties
from ._models import QueuePropertiesPaged
from ._queue_client_async import QueueClient
@@ -101,7 +101,8 @@ def __init__(
loop=loop,
**kwargs)
self._client = AzureQueueStorage(url=self.url, pipeline=self._pipeline, loop=loop) # type: ignore
- self._client._config.version = kwargs.get('api_version', VERSION) # pylint: disable=protected-access
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = kwargs.get('api_version', default_api_version) # pylint: disable=protected-access
self._loop = loop
@distributed_trace_async
@@ -135,7 +136,7 @@ async def get_service_stats(self, **kwargs):
stats = await self._client.service.get_statistics( # type: ignore
timeout=timeout, use_location=LocationMode.SECONDARY, **kwargs)
return service_stats_deserialize(stats)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -163,7 +164,7 @@ async def get_service_properties(self, **kwargs):
try:
service_props = await self._client.service.get_properties(timeout=timeout, **kwargs) # type: ignore
return service_properties_deserialize(service_props)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -219,7 +220,7 @@ async def set_service_properties( # type: ignore
)
try:
return await self._client.service.set_properties(props, timeout=timeout, **kwargs) # type: ignore
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace