Skip to content

Commit 1ca37b4

Browse files
[Queues] Generated Queues using newest autorest version (#16148)
* generated and removed StorageErrorException * fixed all failing tests * fixed failing test * fixed failing test * removed import
1 parent c47cdc3 commit 1ca37b4

39 files changed

+3153
-2894
lines changed

sdk/storage/azure-storage-queue/azure/storage/queue/_deserialize.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
def deserialize_metadata(response, obj, headers):
15-
raw_metadata = {k: v for k, v in response.headers.items() if k.startswith("x-ms-meta-")}
15+
raw_metadata = {k: v for k, v in response.http_response.headers.items() if k.startswith("x-ms-meta-")}
1616
return {k[10:]: v for k, v in raw_metadata.items()}
1717

1818

@@ -26,6 +26,7 @@ def deserialize_queue_properties(response, obj, headers):
2626

2727

2828
def deserialize_queue_creation(response, obj, headers):
29+
response = response.http_response
2930
if response.status_code == 204:
3031
error_code = StorageErrorCode.queue_already_exists
3132
error = ResourceExistsError(
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

129
from ._azure_queue_storage import AzureQueueStorage
1310
__all__ = ['AzureQueueStorage']
1411

15-
from .version import VERSION
16-
17-
__version__ = VERSION
18-
12+
try:
13+
from ._patch import patch_sdk # type: ignore
14+
patch_sdk()
15+
except ImportError:
16+
pass
Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

9+
from typing import TYPE_CHECKING
10+
1211
from azure.core import PipelineClient
13-
from msrest import Serializer, Deserializer
12+
from msrest import Deserializer, Serializer
13+
14+
if TYPE_CHECKING:
15+
# pylint: disable=unused-import,ungrouped-imports
16+
from typing import Any
1417

1518
from ._configuration import AzureQueueStorageConfiguration
16-
from azure.core.exceptions import map_error
1719
from .operations import ServiceOperations
1820
from .operations import QueueOperations
1921
from .operations import MessagesOperations
@@ -22,32 +24,33 @@
2224

2325

2426
class AzureQueueStorage(object):
25-
"""AzureQueueStorage
27+
"""AzureQueueStorage.
2628
27-
28-
:ivar service: Service operations
29+
:ivar service: ServiceOperations operations
2930
:vartype service: azure.storage.queue.operations.ServiceOperations
30-
:ivar queue: Queue operations
31+
:ivar queue: QueueOperations operations
3132
:vartype queue: azure.storage.queue.operations.QueueOperations
32-
:ivar messages: Messages operations
33+
:ivar messages: MessagesOperations operations
3334
:vartype messages: azure.storage.queue.operations.MessagesOperations
34-
:ivar message_id: MessageId operations
35+
:ivar message_id: MessageIdOperations operations
3536
:vartype message_id: azure.storage.queue.operations.MessageIdOperations
36-
37-
:param url: The URL of the service account, queue or message that is the
38-
targe of the desired operation.
37+
:param url: The URL of the service account, queue or message that is the targe of the desired operation.
3938
:type url: str
4039
"""
4140

42-
def __init__(self, url, **kwargs):
43-
41+
def __init__(
42+
self,
43+
url, # type: str
44+
**kwargs # type: Any
45+
):
46+
# type: (...) -> None
4447
base_url = '{url}'
4548
self._config = AzureQueueStorageConfiguration(url, **kwargs)
4649
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
4750

4851
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
49-
self.api_version = '2018-03-28'
5052
self._serialize = Serializer(client_models)
53+
self._serialize.client_side_validation = False
5154
self._deserialize = Deserializer(client_models)
5255

5356
self.service = ServiceOperations(
@@ -60,9 +63,14 @@ def __init__(self, url, **kwargs):
6063
self._client, self._config, self._serialize, self._deserialize)
6164

6265
def close(self):
66+
# type: () -> None
6367
self._client.close()
68+
6469
def __enter__(self):
70+
# type: () -> AzureQueueStorage
6571
self._client.__enter__()
6672
return self
73+
6774
def __exit__(self, *exc_details):
75+
# type: (Any) -> None
6876
self._client.__exit__(*exc_details)
Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,58 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

9+
from typing import TYPE_CHECKING
10+
1211
from azure.core.configuration import Configuration
1312
from azure.core.pipeline import policies
1413

15-
from .version import VERSION
14+
if TYPE_CHECKING:
15+
# pylint: disable=unused-import,ungrouped-imports
16+
from typing import Any
1617

18+
VERSION = "unknown"
1719

1820
class AzureQueueStorageConfiguration(Configuration):
19-
"""Configuration for AzureQueueStorage
21+
"""Configuration for AzureQueueStorage.
22+
2023
Note that all parameters used to create this instance are saved as instance
2124
attributes.
2225
23-
:param url: The URL of the service account, queue or message that is the
24-
targe of the desired operation.
26+
:param url: The URL of the service account, queue or message that is the targe of the desired operation.
2527
:type url: str
26-
:ivar version: Specifies the version of the operation to use for this
27-
request.
28-
:type version: str
2928
"""
3029

31-
def __init__(self, url, **kwargs):
32-
30+
def __init__(
31+
self,
32+
url, # type: str
33+
**kwargs # type: Any
34+
):
35+
# type: (...) -> None
3336
if url is None:
3437
raise ValueError("Parameter 'url' must not be None.")
35-
3638
super(AzureQueueStorageConfiguration, self).__init__(**kwargs)
37-
self._configure(**kwargs)
38-
39-
self.user_agent_policy.add_user_agent('azsdk-python-azurequeuestorage/{}'.format(VERSION))
40-
self.generate_client_request_id = True
4139

4240
self.url = url
4341
self.version = "2018-03-28"
42+
kwargs.setdefault('sdk_moniker', 'azurequeuestorage/{}'.format(VERSION))
43+
self._configure(**kwargs)
4444

45-
def _configure(self, **kwargs):
45+
def _configure(
46+
self,
47+
**kwargs # type: Any
48+
):
49+
# type: (...) -> None
4650
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
4751
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
4852
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
4953
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
54+
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
5055
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
5156
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
5257
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
58+
self.authentication_policy = kwargs.get('authentication_policy')
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

12-
from ._azure_queue_storage_async import AzureQueueStorage
9+
from ._azure_queue_storage import AzureQueueStorage
1310
__all__ = ['AzureQueueStorage']
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,51 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

9+
from typing import Any
10+
1211
from azure.core import AsyncPipelineClient
13-
from msrest import Serializer, Deserializer
12+
from msrest import Deserializer, Serializer
1413

15-
from ._configuration_async import AzureQueueStorageConfiguration
16-
from azure.core.exceptions import map_error
17-
from .operations_async import ServiceOperations
18-
from .operations_async import QueueOperations
19-
from .operations_async import MessagesOperations
20-
from .operations_async import MessageIdOperations
14+
from ._configuration import AzureQueueStorageConfiguration
15+
from .operations import ServiceOperations
16+
from .operations import QueueOperations
17+
from .operations import MessagesOperations
18+
from .operations import MessageIdOperations
2119
from .. import models
2220

2321

2422
class AzureQueueStorage(object):
25-
"""AzureQueueStorage
26-
27-
28-
:ivar service: Service operations
29-
:vartype service: azure.storage.queue.aio.operations_async.ServiceOperations
30-
:ivar queue: Queue operations
31-
:vartype queue: azure.storage.queue.aio.operations_async.QueueOperations
32-
:ivar messages: Messages operations
33-
:vartype messages: azure.storage.queue.aio.operations_async.MessagesOperations
34-
:ivar message_id: MessageId operations
35-
:vartype message_id: azure.storage.queue.aio.operations_async.MessageIdOperations
23+
"""AzureQueueStorage.
3624
37-
:param url: The URL of the service account, queue or message that is the
38-
targe of the desired operation.
25+
:ivar service: ServiceOperations operations
26+
:vartype service: azure.storage.queue.aio.operations.ServiceOperations
27+
:ivar queue: QueueOperations operations
28+
:vartype queue: azure.storage.queue.aio.operations.QueueOperations
29+
:ivar messages: MessagesOperations operations
30+
:vartype messages: azure.storage.queue.aio.operations.MessagesOperations
31+
:ivar message_id: MessageIdOperations operations
32+
:vartype message_id: azure.storage.queue.aio.operations.MessageIdOperations
33+
:param url: The URL of the service account, queue or message that is the targe of the desired operation.
3934
:type url: str
4035
"""
4136

4237
def __init__(
43-
self, url, **kwargs):
44-
38+
self,
39+
url: str,
40+
**kwargs: Any
41+
) -> None:
4542
base_url = '{url}'
4643
self._config = AzureQueueStorageConfiguration(url, **kwargs)
4744
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)
4845

4946
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
50-
self.api_version = '2018-03-28'
5147
self._serialize = Serializer(client_models)
48+
self._serialize.client_side_validation = False
5249
self._deserialize = Deserializer(client_models)
5350

5451
self.service = ServiceOperations(
@@ -60,10 +57,12 @@ def __init__(
6057
self.message_id = MessageIdOperations(
6158
self._client, self._config, self._serialize, self._deserialize)
6259

63-
async def close(self):
60+
async def close(self) -> None:
6461
await self._client.close()
65-
async def __aenter__(self):
62+
63+
async def __aenter__(self) -> "AzureQueueStorage":
6664
await self._client.__aenter__()
6765
return self
68-
async def __aexit__(self, *exc_details):
66+
67+
async def __aexit__(self, *exc_details) -> None:
6968
await self._client.__aexit__(*exc_details)
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,52 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

9+
from typing import Any
10+
1211
from azure.core.configuration import Configuration
1312
from azure.core.pipeline import policies
1413

15-
from ..version import VERSION
16-
14+
VERSION = "unknown"
1715

1816
class AzureQueueStorageConfiguration(Configuration):
19-
"""Configuration for AzureQueueStorage
17+
"""Configuration for AzureQueueStorage.
18+
2019
Note that all parameters used to create this instance are saved as instance
2120
attributes.
2221
23-
:param url: The URL of the service account, queue or message that is the
24-
targe of the desired operation.
22+
:param url: The URL of the service account, queue or message that is the targe of the desired operation.
2523
:type url: str
26-
:ivar version: Specifies the version of the operation to use for this
27-
request.
28-
:type version: str
2924
"""
3025

31-
def __init__(self, url, **kwargs):
32-
26+
def __init__(
27+
self,
28+
url: str,
29+
**kwargs: Any
30+
) -> None:
3331
if url is None:
3432
raise ValueError("Parameter 'url' must not be None.")
35-
3633
super(AzureQueueStorageConfiguration, self).__init__(**kwargs)
37-
self._configure(**kwargs)
38-
39-
self.user_agent_policy.add_user_agent('azsdk-python-azurequeuestorage/{}'.format(VERSION))
40-
self.generate_client_request_id = True
41-
self.accept_language = None
4234

4335
self.url = url
4436
self.version = "2018-03-28"
37+
kwargs.setdefault('sdk_moniker', 'azurequeuestorage/{}'.format(VERSION))
38+
self._configure(**kwargs)
4539

46-
def _configure(self, **kwargs):
40+
def _configure(
41+
self,
42+
**kwargs: Any
43+
) -> None:
4744
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
4845
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
4946
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
5047
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
48+
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
5149
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
5250
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
5351
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
52+
self.authentication_policy = kwargs.get('authentication_policy')

0 commit comments

Comments
 (0)