Skip to content

Commit 0359a70

Browse files
author
SDKAuto
committed
CodeGen from PR 3579 in openapi-env-test/azure-rest-api-specs
Merge a1fed63cc93ff7ebf23a0c0673dfbd8b6820f0eb into f9591714949b2f82a233fe0c89908b8873250603
1 parent c5e873e commit 0359a70

File tree

74 files changed

+17193
-2465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+17193
-2465
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.7.2",
2+
"autorest": "3.8.4",
33
"use": [
4-
"@autorest/python@5.13.0",
5-
"@autorest/modelerfour@4.19.3"
4+
"@autorest/python@6.1.4",
5+
"@autorest/modelerfour@4.23.5"
66
],
7-
"commit": "08894fa8d66cb44dc62a73f7a09530f905985fa3",
8-
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/appconfiguration/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
7+
"commit": "65909f9e91a64162f394f257958c172a2c5b4de5",
8+
"repository_url": "https://github.com/openapi-env-test/azure-rest-api-specs",
9+
"autorest_command": "autorest specification/appconfiguration/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.1.4 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False",
1010
"readme": "specification/appconfiguration/resource-manager/readme.md"
1111
}

sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
# --------------------------------------------------------------------------
88

99
from ._app_configuration_management_client import AppConfigurationManagementClient
10+
__all__ = ['AppConfigurationManagementClient']
11+
12+
try:
13+
from ._patch import patch_sdk # type: ignore
14+
patch_sdk()
15+
except ImportError:
16+
pass
17+
1018
from ._version import VERSION
1119

1220
__version__ = VERSION
13-
__all__ = ['AppConfigurationManagementClient']
14-
15-
# `._patch.py` is used for handwritten extensions to the generated code
16-
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17-
from ._patch import patch_sdk
18-
patch_sdk()
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,200 @@
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 license information.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
57
# Code generated by Microsoft (R) AutoRest Code Generator.
6-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
710
# --------------------------------------------------------------------------
811

9-
from copy import deepcopy
10-
from typing import Any, TYPE_CHECKING
12+
from typing import Any, Optional, TYPE_CHECKING
1113

12-
from msrest import Deserializer, Serializer
13-
14-
from azure.core.rest import HttpRequest, HttpResponse
1514
from azure.mgmt.core import ARMPipelineClient
15+
from azure.profiles import KnownProfiles, ProfileDefinition
16+
from azure.profiles.multiapiclient import MultiApiClientMixin
1617

17-
from . import models
1818
from ._configuration import AppConfigurationManagementClientConfiguration
19-
from .operations import ConfigurationStoresOperations, KeyValuesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations
19+
from ._serialization import Deserializer, Serializer
2020

2121
if TYPE_CHECKING:
2222
# pylint: disable=unused-import,ungrouped-imports
2323
from azure.core.credentials import TokenCredential
2424

25-
class AppConfigurationManagementClient:
25+
class _SDKClient(object):
26+
def __init__(self, *args, **kwargs):
27+
"""This is a fake class to support current implemetation of MultiApiClientMixin."
28+
Will be removed in final version of multiapi azure-core based client
29+
"""
30+
pass
31+
32+
class AppConfigurationManagementClient(MultiApiClientMixin, _SDKClient):
2633
"""AppConfigurationManagementClient.
2734
28-
:ivar configuration_stores: ConfigurationStoresOperations operations
29-
:vartype configuration_stores:
30-
azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations
31-
:ivar operations: Operations operations
32-
:vartype operations: azure.mgmt.appconfiguration.operations.Operations
33-
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
34-
:vartype private_endpoint_connections:
35-
azure.mgmt.appconfiguration.operations.PrivateEndpointConnectionsOperations
36-
:ivar private_link_resources: PrivateLinkResourcesOperations operations
37-
:vartype private_link_resources:
38-
azure.mgmt.appconfiguration.operations.PrivateLinkResourcesOperations
39-
:ivar key_values: KeyValuesOperations operations
40-
:vartype key_values: azure.mgmt.appconfiguration.operations.KeyValuesOperations
41-
:param credential: Credential needed for the client to connect to Azure.
35+
This ready contains multiple API versions, to help you deal with all of the Azure clouds
36+
(Azure Stack, Azure Government, Azure China, etc.).
37+
By default, it uses the latest API version available on public Azure.
38+
For production, you should stick to a particular api-version and/or profile.
39+
The profile sets a mapping between an operation group and its API version.
40+
The api-version parameter sets the default API version if the operation
41+
group is not described in the profile.
42+
43+
:param credential: Credential needed for the client to connect to Azure. Required.
4244
:type credential: ~azure.core.credentials.TokenCredential
43-
:param subscription_id: The Microsoft Azure subscription ID.
45+
:param subscription_id: The Microsoft Azure subscription ID. Required.
4446
:type subscription_id: str
45-
:param base_url: Service URL. Default value is "https://management.azure.com".
47+
:param api_version: API version to use if no profile is provided, or if missing in profile.
48+
:type api_version: str
49+
:param base_url: Service URL
4650
:type base_url: str
47-
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
48-
default value may result in unsupported behavior.
49-
:paramtype api_version: str
50-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
51-
Retry-After header is present.
51+
:param profile: A profile definition, from KnownProfiles to dict.
52+
:type profile: azure.profiles.KnownProfiles
53+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
5254
"""
5355

56+
DEFAULT_API_VERSION = '2022-05-01'
57+
_PROFILE_TAG = "azure.mgmt.appconfiguration.AppConfigurationManagementClient"
58+
LATEST_PROFILE = ProfileDefinition({
59+
_PROFILE_TAG: {
60+
None: DEFAULT_API_VERSION,
61+
'replicas': '2022-03-01-preview',
62+
}},
63+
_PROFILE_TAG + " latest"
64+
)
65+
5466
def __init__(
5567
self,
5668
credential: "TokenCredential",
5769
subscription_id: str,
70+
api_version=None, # type: Optional[str]
5871
base_url: str = "https://management.azure.com",
59-
**kwargs: Any
60-
) -> None:
61-
self._config = AppConfigurationManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
72+
profile=KnownProfiles.default, # type: KnownProfiles
73+
**kwargs # type: Any
74+
):
75+
self._config = AppConfigurationManagementClientConfiguration(credential, subscription_id, **kwargs)
6276
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
77+
super(AppConfigurationManagementClient, self).__init__(
78+
api_version=api_version,
79+
profile=profile
80+
)
6381

64-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
65-
self._serialize = Serializer(client_models)
66-
self._deserialize = Deserializer(client_models)
67-
self._serialize.client_side_validation = False
68-
self.configuration_stores = ConfigurationStoresOperations(self._client, self._config, self._serialize, self._deserialize)
69-
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
70-
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
71-
self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize)
72-
self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize)
82+
@classmethod
83+
def _models_dict(cls, api_version):
84+
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
7385

86+
@classmethod
87+
def models(cls, api_version=DEFAULT_API_VERSION):
88+
"""Module depends on the API version:
7489
75-
def _send_request(
76-
self,
77-
request: HttpRequest,
78-
**kwargs: Any
79-
) -> HttpResponse:
80-
"""Runs the network request through the client's chained policies.
81-
82-
>>> from azure.core.rest import HttpRequest
83-
>>> request = HttpRequest("GET", "https://www.example.org/")
84-
<HttpRequest [GET], url: 'https://www.example.org/'>
85-
>>> response = client._send_request(request)
86-
<HttpResponse: 200 OK>
87-
88-
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
89-
90-
:param request: The network request you want to make. Required.
91-
:type request: ~azure.core.rest.HttpRequest
92-
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
93-
:return: The response of your network call. Does not do error handling on your response.
94-
:rtype: ~azure.core.rest.HttpResponse
90+
* 2022-03-01-preview: :mod:`v2022_03_01_preview.models<azure.mgmt.appconfiguration.v2022_03_01_preview.models>`
91+
* 2022-05-01: :mod:`v2022_05_01.models<azure.mgmt.appconfiguration.v2022_05_01.models>`
9592
"""
96-
97-
request_copy = deepcopy(request)
98-
request_copy.url = self._client.format_url(request_copy.url)
99-
return self._client.send_request(request_copy, **kwargs)
93+
if api_version == '2022-03-01-preview':
94+
from .v2022_03_01_preview import models
95+
return models
96+
elif api_version == '2022-05-01':
97+
from .v2022_05_01 import models
98+
return models
99+
raise ValueError("API version {} is not available".format(api_version))
100+
101+
@property
102+
def configuration_stores(self):
103+
"""Instance depends on the API version:
104+
105+
* 2022-03-01-preview: :class:`ConfigurationStoresOperations<azure.mgmt.appconfiguration.v2022_03_01_preview.operations.ConfigurationStoresOperations>`
106+
* 2022-05-01: :class:`ConfigurationStoresOperations<azure.mgmt.appconfiguration.v2022_05_01.operations.ConfigurationStoresOperations>`
107+
"""
108+
api_version = self._get_api_version('configuration_stores')
109+
if api_version == '2022-03-01-preview':
110+
from .v2022_03_01_preview.operations import ConfigurationStoresOperations as OperationClass
111+
elif api_version == '2022-05-01':
112+
from .v2022_05_01.operations import ConfigurationStoresOperations as OperationClass
113+
else:
114+
raise ValueError("API version {} does not have operation group 'configuration_stores'".format(api_version))
115+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
116+
117+
@property
118+
def key_values(self):
119+
"""Instance depends on the API version:
120+
121+
* 2022-03-01-preview: :class:`KeyValuesOperations<azure.mgmt.appconfiguration.v2022_03_01_preview.operations.KeyValuesOperations>`
122+
* 2022-05-01: :class:`KeyValuesOperations<azure.mgmt.appconfiguration.v2022_05_01.operations.KeyValuesOperations>`
123+
"""
124+
api_version = self._get_api_version('key_values')
125+
if api_version == '2022-03-01-preview':
126+
from .v2022_03_01_preview.operations import KeyValuesOperations as OperationClass
127+
elif api_version == '2022-05-01':
128+
from .v2022_05_01.operations import KeyValuesOperations as OperationClass
129+
else:
130+
raise ValueError("API version {} does not have operation group 'key_values'".format(api_version))
131+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
132+
133+
@property
134+
def operations(self):
135+
"""Instance depends on the API version:
136+
137+
* 2022-03-01-preview: :class:`Operations<azure.mgmt.appconfiguration.v2022_03_01_preview.operations.Operations>`
138+
* 2022-05-01: :class:`Operations<azure.mgmt.appconfiguration.v2022_05_01.operations.Operations>`
139+
"""
140+
api_version = self._get_api_version('operations')
141+
if api_version == '2022-03-01-preview':
142+
from .v2022_03_01_preview.operations import Operations as OperationClass
143+
elif api_version == '2022-05-01':
144+
from .v2022_05_01.operations import Operations as OperationClass
145+
else:
146+
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
147+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
148+
149+
@property
150+
def private_endpoint_connections(self):
151+
"""Instance depends on the API version:
152+
153+
* 2022-03-01-preview: :class:`PrivateEndpointConnectionsOperations<azure.mgmt.appconfiguration.v2022_03_01_preview.operations.PrivateEndpointConnectionsOperations>`
154+
* 2022-05-01: :class:`PrivateEndpointConnectionsOperations<azure.mgmt.appconfiguration.v2022_05_01.operations.PrivateEndpointConnectionsOperations>`
155+
"""
156+
api_version = self._get_api_version('private_endpoint_connections')
157+
if api_version == '2022-03-01-preview':
158+
from .v2022_03_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass
159+
elif api_version == '2022-05-01':
160+
from .v2022_05_01.operations import PrivateEndpointConnectionsOperations as OperationClass
161+
else:
162+
raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version))
163+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
164+
165+
@property
166+
def private_link_resources(self):
167+
"""Instance depends on the API version:
168+
169+
* 2022-03-01-preview: :class:`PrivateLinkResourcesOperations<azure.mgmt.appconfiguration.v2022_03_01_preview.operations.PrivateLinkResourcesOperations>`
170+
* 2022-05-01: :class:`PrivateLinkResourcesOperations<azure.mgmt.appconfiguration.v2022_05_01.operations.PrivateLinkResourcesOperations>`
171+
"""
172+
api_version = self._get_api_version('private_link_resources')
173+
if api_version == '2022-03-01-preview':
174+
from .v2022_03_01_preview.operations import PrivateLinkResourcesOperations as OperationClass
175+
elif api_version == '2022-05-01':
176+
from .v2022_05_01.operations import PrivateLinkResourcesOperations as OperationClass
177+
else:
178+
raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version))
179+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
180+
181+
@property
182+
def replicas(self):
183+
"""Instance depends on the API version:
184+
185+
* 2022-03-01-preview: :class:`ReplicasOperations<azure.mgmt.appconfiguration.v2022_03_01_preview.operations.ReplicasOperations>`
186+
"""
187+
api_version = self._get_api_version('replicas')
188+
if api_version == '2022-03-01-preview':
189+
from .v2022_03_01_preview.operations import ReplicasOperations as OperationClass
190+
else:
191+
raise ValueError("API version {} does not have operation group 'replicas'".format(api_version))
192+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
100193

101194
def close(self):
102-
# type: () -> None
103195
self._client.close()
104-
105196
def __enter__(self):
106-
# type: () -> AppConfigurationManagementClient
107197
self._client.__enter__()
108198
return self
109-
110199
def __exit__(self, *exc_details):
111-
# type: (Any) -> None
112200
self._client.__exit__(*exc_details)

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

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
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 license information.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
57
# Code generated by Microsoft (R) AutoRest Code Generator.
6-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
710
# --------------------------------------------------------------------------
8-
911
from typing import Any, TYPE_CHECKING
1012

1113
from azure.core.configuration import Configuration
@@ -18,41 +20,35 @@
1820
# pylint: disable=unused-import,ungrouped-imports
1921
from azure.core.credentials import TokenCredential
2022

21-
22-
class AppConfigurationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
23+
class AppConfigurationManagementClientConfiguration(Configuration):
2324
"""Configuration for AppConfigurationManagementClient.
2425
2526
Note that all parameters used to create this instance are saved as instance
2627
attributes.
2728
28-
:param credential: Credential needed for the client to connect to Azure.
29+
:param credential: Credential needed for the client to connect to Azure. Required.
2930
:type credential: ~azure.core.credentials.TokenCredential
30-
:param subscription_id: The Microsoft Azure subscription ID.
31+
:param subscription_id: The Microsoft Azure subscription ID. Required.
3132
:type subscription_id: str
32-
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
33-
default value may result in unsupported behavior.
34-
:paramtype api_version: str
3533
"""
3634

3735
def __init__(
3836
self,
3937
credential: "TokenCredential",
4038
subscription_id: str,
41-
**kwargs: Any
42-
) -> None:
43-
super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs)
44-
api_version = kwargs.pop('api_version', "2022-05-01") # type: str
45-
39+
**kwargs # type: Any
40+
):
41+
# type: (...) -> None
4642
if credential is None:
4743
raise ValueError("Parameter 'credential' must not be None.")
4844
if subscription_id is None:
4945
raise ValueError("Parameter 'subscription_id' must not be None.")
46+
super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs)
5047

5148
self.credential = credential
5249
self.subscription_id = subscription_id
53-
self.api_version = api_version
5450
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
55-
kwargs.setdefault('sdk_moniker', 'mgmt-appconfiguration/{}'.format(VERSION))
51+
kwargs.setdefault('sdk_moniker', 'azure-mgmt-appconfiguration/{}'.format(VERSION))
5652
self._configure(**kwargs)
5753

5854
def _configure(

0 commit comments

Comments
 (0)