Skip to content

Commit b2c9956

Browse files
author
SDKAuto
committed
CodeGen from PR 17836 in Azure/azure-rest-api-specs
Merge 9daafda5e93ba04db19c7e31a442733874498910 into 23cd65e
1 parent e46459c commit b2c9956

20 files changed

+951
-3217
lines changed

sdk/redis/azure-mgmt-redis/_meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"@autorest/python@5.12.0",
55
"@autorest/modelerfour@4.19.3"
66
],
7-
"commit": "b28cdff098a89aab796e38c78b6b71a897fbae47",
7+
"commit": "8978b2452e08ce44327a17bddbb55c593d3bc0f0",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/redis/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
9+
"autorest_command": "autorest specification/redis/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
1010
"readme": "specification/redis/resource-manager/readme.md"
1111
}

sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
@@ -16,8 +16,6 @@
1616

1717
if TYPE_CHECKING:
1818
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2119
from azure.core.credentials import TokenCredential
2220

2321

@@ -35,11 +33,10 @@ class RedisManagementClientConfiguration(Configuration):
3533

3634
def __init__(
3735
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
36+
credential: "TokenCredential",
37+
subscription_id: str,
38+
**kwargs: Any
39+
) -> None:
4340
super(RedisManagementClientConfiguration, self).__init__(**kwargs)
4441
if credential is None:
4542
raise ValueError("Parameter 'credential' must not be None.")

sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"patch_schedules": "PatchSchedulesOperations",
104104
"linked_server": "LinkedServerOperations",
105105
"private_endpoint_connections": "PrivateEndpointConnectionsOperations",
106-
"private_link_resources": "PrivateLinkResourcesOperations"
106+
"private_link_resources": "PrivateLinkResourcesOperations",
107+
"async_operation_status": "AsyncOperationStatusOperations"
107108
}
108109
}

sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_redis_management_client.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,21 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import TYPE_CHECKING
10+
from typing import Any, Optional, TYPE_CHECKING
1111

12+
from azure.core.rest import HttpRequest, HttpResponse
1213
from azure.mgmt.core import ARMPipelineClient
1314
from msrest import Deserializer, Serializer
1415

1516
from . import models
1617
from ._configuration import RedisManagementClientConfiguration
17-
from .operations import FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations
18+
from .operations import AsyncOperationStatusOperations, FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations
1819

1920
if TYPE_CHECKING:
2021
# pylint: disable=unused-import,ungrouped-imports
21-
from typing import Any, Optional
22-
2322
from azure.core.credentials import TokenCredential
24-
from azure.core.rest import HttpRequest, HttpResponse
2523

26-
class RedisManagementClient(object):
24+
class RedisManagementClient:
2725
"""REST API for Azure Redis Cache Service.
2826
2927
:ivar operations: Operations operations
@@ -41,6 +39,8 @@ class RedisManagementClient(object):
4139
azure.mgmt.redis.operations.PrivateEndpointConnectionsOperations
4240
:ivar private_link_resources: PrivateLinkResourcesOperations operations
4341
:vartype private_link_resources: azure.mgmt.redis.operations.PrivateLinkResourcesOperations
42+
:ivar async_operation_status: AsyncOperationStatusOperations operations
43+
:vartype async_operation_status: azure.mgmt.redis.operations.AsyncOperationStatusOperations
4444
:param credential: Credential needed for the client to connect to Azure.
4545
:type credential: ~azure.core.credentials.TokenCredential
4646
:param subscription_id: Gets subscription credentials which uniquely identify the Microsoft
@@ -54,12 +54,11 @@ class RedisManagementClient(object):
5454

5555
def __init__(
5656
self,
57-
credential, # type: "TokenCredential"
58-
subscription_id, # type: str
59-
base_url="https://management.azure.com", # type: str
60-
**kwargs # type: Any
61-
):
62-
# type: (...) -> None
57+
credential: "TokenCredential",
58+
subscription_id: str,
59+
base_url: str = "https://management.azure.com",
60+
**kwargs: Any
61+
) -> None:
6362
self._config = RedisManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
6463
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6564

@@ -74,14 +73,14 @@ def __init__(
7473
self.linked_server = LinkedServerOperations(self._client, self._config, self._serialize, self._deserialize)
7574
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
7675
self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize)
76+
self.async_operation_status = AsyncOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize)
7777

7878

7979
def _send_request(
8080
self,
8181
request, # type: HttpRequest
82-
**kwargs # type: Any
83-
):
84-
# type: (...) -> HttpResponse
82+
**kwargs: Any
83+
) -> HttpResponse:
8584
"""Runs the network request through the client's chained policies.
8685
8786
>>> from azure.core.rest import HttpRequest

sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "13.1.0"
9+
VERSION = "12.0.0b1"

sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_redis_management_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from .. import models
1717
from ._configuration import RedisManagementClientConfiguration
18-
from .operations import FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations
18+
from .operations import AsyncOperationStatusOperations, FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations
1919

2020
if TYPE_CHECKING:
2121
# pylint: disable=unused-import,ungrouped-imports
@@ -39,6 +39,8 @@ class RedisManagementClient:
3939
azure.mgmt.redis.aio.operations.PrivateEndpointConnectionsOperations
4040
:ivar private_link_resources: PrivateLinkResourcesOperations operations
4141
:vartype private_link_resources: azure.mgmt.redis.aio.operations.PrivateLinkResourcesOperations
42+
:ivar async_operation_status: AsyncOperationStatusOperations operations
43+
:vartype async_operation_status: azure.mgmt.redis.aio.operations.AsyncOperationStatusOperations
4244
:param credential: Credential needed for the client to connect to Azure.
4345
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
4446
:param subscription_id: Gets subscription credentials which uniquely identify the Microsoft
@@ -71,6 +73,7 @@ def __init__(
7173
self.linked_server = LinkedServerOperations(self._client, self._config, self._serialize, self._deserialize)
7274
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
7375
self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize)
76+
self.async_operation_status = AsyncOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize)
7477

7578

7679
def _send_request(

sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from ._linked_server_operations import LinkedServerOperations
1414
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
1515
from ._private_link_resources_operations import PrivateLinkResourcesOperations
16+
from ._async_operation_status_operations import AsyncOperationStatusOperations
1617

1718
__all__ = [
1819
'Operations',
@@ -22,4 +23,5 @@
2223
'LinkedServerOperations',
2324
'PrivateEndpointConnectionsOperations',
2425
'PrivateLinkResourcesOperations',
26+
'AsyncOperationStatusOperations',
2527
]
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
import functools
9+
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
10+
import warnings
11+
12+
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
13+
from azure.core.pipeline import PipelineResponse
14+
from azure.core.pipeline.transport import AsyncHttpResponse
15+
from azure.core.rest import HttpRequest
16+
from azure.core.tracing.decorator_async import distributed_trace_async
17+
from azure.mgmt.core.exceptions import ARMErrorFormat
18+
19+
from ... import models as _models
20+
from ..._vendor import _convert_request
21+
from ...operations._async_operation_status_operations import build_get_request
22+
T = TypeVar('T')
23+
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
24+
25+
class AsyncOperationStatusOperations:
26+
"""AsyncOperationStatusOperations async operations.
27+
28+
You should not instantiate this class directly. Instead, you should create a Client instance that
29+
instantiates it for you and attaches it as an attribute.
30+
31+
:ivar models: Alias to model classes used in this operation group.
32+
:type models: ~azure.mgmt.redis.models
33+
:param client: Client for service requests.
34+
:param config: Configuration of service client.
35+
:param serializer: An object model serializer.
36+
:param deserializer: An object model deserializer.
37+
"""
38+
39+
models = _models
40+
41+
def __init__(self, client, config, serializer, deserializer) -> None:
42+
self._client = client
43+
self._serialize = serializer
44+
self._deserialize = deserializer
45+
self._config = config
46+
47+
@distributed_trace_async
48+
async def get(
49+
self,
50+
location: str,
51+
operation_id: str,
52+
**kwargs: Any
53+
) -> "_models.OperationStatus":
54+
"""For checking the ongoing status of an operation.
55+
56+
:param location: The location at which operation was triggered.
57+
:type location: str
58+
:param operation_id: The ID of asynchronous operation.
59+
:type operation_id: str
60+
:keyword callable cls: A custom type or function that will be passed the direct response
61+
:return: OperationStatus, or the result of cls(response)
62+
:rtype: ~azure.mgmt.redis.models.OperationStatus
63+
:raises: ~azure.core.exceptions.HttpResponseError
64+
"""
65+
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"]
66+
error_map = {
67+
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
68+
}
69+
error_map.update(kwargs.pop('error_map', {}))
70+
71+
72+
request = build_get_request(
73+
location=location,
74+
operation_id=operation_id,
75+
subscription_id=self._config.subscription_id,
76+
template_url=self.get.metadata['url'],
77+
)
78+
request = _convert_request(request)
79+
request.url = self._client.format_url(request.url)
80+
81+
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
82+
response = pipeline_response.http_response
83+
84+
if response.status_code not in [200]:
85+
map_error(status_code=response.status_code, response=response, error_map=error_map)
86+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
87+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
88+
89+
deserialized = self._deserialize('OperationStatus', pipeline_response)
90+
91+
if cls:
92+
return cls(pipeline_response, deserialized, {})
93+
94+
return deserialized
95+
96+
get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}'} # type: ignore
97+

0 commit comments

Comments
 (0)