Skip to content

Commit e8336ae

Browse files
author
SDKAuto
committed
CodeGen from PR 11639 in Azure/azure-rest-api-specs
add openapi-subtype (Azure#11639)
1 parent 772528f commit e8336ae

29 files changed

+5249
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
9+
from ._adp_management_client import AdpManagementClient
10+
__all__ = ['AdpManagementClient']
11+
12+
try:
13+
from ._patch import patch_sdk # type: ignore
14+
patch_sdk()
15+
except ImportError:
16+
pass
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from azure.mgmt.core import ARMPipelineClient
13+
from msrest import Serializer, Deserializer
14+
15+
from azure.profiles import KnownProfiles, ProfileDefinition
16+
from azure.profiles.multiapiclient import MultiApiClientMixin
17+
from ._configuration import AdpManagementClientConfiguration
18+
19+
class _SDKClient(object):
20+
def __init__(self, *args, **kwargs):
21+
"""This is a fake class to support current implemetation of MultiApiClientMixin."
22+
Will be removed in final version of multiapi azure-core based client
23+
"""
24+
pass
25+
26+
class AdpManagementClient(MultiApiClientMixin, _SDKClient):
27+
"""Microsoft Autonomous Development Platform.
28+
29+
This ready contains multiple API versions, to help you deal with all of the Azure clouds
30+
(Azure Stack, Azure Government, Azure China, etc.).
31+
By default, it uses the latest API version available on public Azure.
32+
For production, you should stick to a particular api-version and/or profile.
33+
The profile sets a mapping between an operation group and its API version.
34+
The api-version parameter sets the default API version if the operation
35+
group is not described in the profile.
36+
37+
:param credential: Credential needed for the client to connect to Azure.
38+
:type credential: ~azure.core.credentials.TokenCredential
39+
:param subscription_id: The ID of the target subscription.
40+
:type subscription_id: str
41+
:param str api_version: API version to use if no profile is provided, or if
42+
missing in profile.
43+
:param str base_url: Service URL
44+
:param profile: A profile definition, from KnownProfiles to dict.
45+
:type profile: azure.profiles.KnownProfiles
46+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
47+
"""
48+
49+
DEFAULT_API_VERSION = '2020-07-01-preview'
50+
_PROFILE_TAG = "azure.mgmt.adp.AdpManagementClient"
51+
LATEST_PROFILE = ProfileDefinition({
52+
_PROFILE_TAG: {
53+
None: DEFAULT_API_VERSION,
54+
}},
55+
_PROFILE_TAG + " latest"
56+
)
57+
58+
def __init__(
59+
self,
60+
credential, # type: "TokenCredential"
61+
subscription_id, # type: str
62+
api_version=None,
63+
base_url=None,
64+
profile=KnownProfiles.default,
65+
**kwargs # type: Any
66+
):
67+
if not base_url:
68+
base_url = 'https://management.azure.com'
69+
self._config = AdpManagementClientConfiguration(credential, subscription_id, **kwargs)
70+
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
71+
super(AdpManagementClient, self).__init__(
72+
api_version=api_version,
73+
profile=profile
74+
)
75+
76+
@classmethod
77+
def _models_dict(cls, api_version):
78+
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
79+
80+
@classmethod
81+
def models(cls, api_version=DEFAULT_API_VERSION):
82+
"""Module depends on the API version:
83+
84+
* 2020-07-01-preview: :mod:`v2020_07_01_preview.models<azure.mgmt.adp.v2020_07_01_preview.models>`
85+
"""
86+
if api_version == '2020-07-01-preview':
87+
from .v2020_07_01_preview import models
88+
return models
89+
raise ValueError("API version {} is not available".format(api_version))
90+
91+
@property
92+
def accounts(self):
93+
"""Instance depends on the API version:
94+
95+
* 2020-07-01-preview: :class:`AccountsOperations<azure.mgmt.adp.v2020_07_01_preview.operations.AccountsOperations>`
96+
"""
97+
api_version = self._get_api_version('accounts')
98+
if api_version == '2020-07-01-preview':
99+
from .v2020_07_01_preview.operations import AccountsOperations as OperationClass
100+
else:
101+
raise ValueError("API version {} does not have operation group 'accounts'".format(api_version))
102+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
103+
104+
@property
105+
def data_pools(self):
106+
"""Instance depends on the API version:
107+
108+
* 2020-07-01-preview: :class:`DataPoolsOperations<azure.mgmt.adp.v2020_07_01_preview.operations.DataPoolsOperations>`
109+
"""
110+
api_version = self._get_api_version('data_pools')
111+
if api_version == '2020-07-01-preview':
112+
from .v2020_07_01_preview.operations import DataPoolsOperations as OperationClass
113+
else:
114+
raise ValueError("API version {} does not have operation group 'data_pools'".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 operations(self):
119+
"""Instance depends on the API version:
120+
121+
* 2020-07-01-preview: :class:`Operations<azure.mgmt.adp.v2020_07_01_preview.operations.Operations>`
122+
"""
123+
api_version = self._get_api_version('operations')
124+
if api_version == '2020-07-01-preview':
125+
from .v2020_07_01_preview.operations import Operations as OperationClass
126+
else:
127+
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
128+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
129+
130+
def close(self):
131+
self._client.close()
132+
def __enter__(self):
133+
self._client.__enter__()
134+
return self
135+
def __exit__(self, *exc_details):
136+
self._client.__exit__(*exc_details)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
from typing import Any
12+
13+
from azure.core.configuration import Configuration
14+
from azure.core.pipeline import policies
15+
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
16+
17+
from ._version import VERSION
18+
19+
20+
class AdpManagementClientConfiguration(Configuration):
21+
"""Configuration for AdpManagementClient.
22+
23+
Note that all parameters used to create this instance are saved as instance
24+
attributes.
25+
26+
:param credential: Credential needed for the client to connect to Azure.
27+
:type credential: ~azure.core.credentials.TokenCredential
28+
:param subscription_id: The ID of the target subscription.
29+
:type subscription_id: str
30+
"""
31+
32+
def __init__(
33+
self,
34+
credential, # type: "TokenCredential"
35+
subscription_id, # type: str
36+
**kwargs # type: Any
37+
):
38+
# type: (...) -> None
39+
if credential is None:
40+
raise ValueError("Parameter 'credential' must not be None.")
41+
if subscription_id is None:
42+
raise ValueError("Parameter 'subscription_id' must not be None.")
43+
super(AdpManagementClientConfiguration, self).__init__(**kwargs)
44+
45+
self.credential = credential
46+
self.subscription_id = subscription_id
47+
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
48+
kwargs.setdefault('sdk_moniker', 'azure-mgmt-adp/{}'.format(VERSION))
49+
self._configure(**kwargs)
50+
51+
def _configure(
52+
self,
53+
**kwargs # type: Any
54+
):
55+
# type: (...) -> None
56+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
57+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
58+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
59+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
60+
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
61+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
62+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
63+
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
64+
self.authentication_policy = kwargs.get('authentication_policy')
65+
if self.credential and not self.authentication_policy:
66+
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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
5+
# license information.
6+
# --------------------------------------------------------------------------
7+
8+
VERSION = "0.1.0"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
9+
from ._adp_management_client import AdpManagementClient
10+
__all__ = ['AdpManagementClient']
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from azure.mgmt.core import AsyncARMPipelineClient
13+
from msrest import Serializer, Deserializer
14+
15+
from azure.profiles import KnownProfiles, ProfileDefinition
16+
from azure.profiles.multiapiclient import MultiApiClientMixin
17+
from ._configuration import AdpManagementClientConfiguration
18+
19+
class _SDKClient(object):
20+
def __init__(self, *args, **kwargs):
21+
"""This is a fake class to support current implemetation of MultiApiClientMixin."
22+
Will be removed in final version of multiapi azure-core based client
23+
"""
24+
pass
25+
26+
class AdpManagementClient(MultiApiClientMixin, _SDKClient):
27+
"""Microsoft Autonomous Development Platform.
28+
29+
This ready contains multiple API versions, to help you deal with all of the Azure clouds
30+
(Azure Stack, Azure Government, Azure China, etc.).
31+
By default, it uses the latest API version available on public Azure.
32+
For production, you should stick to a particular api-version and/or profile.
33+
The profile sets a mapping between an operation group and its API version.
34+
The api-version parameter sets the default API version if the operation
35+
group is not described in the profile.
36+
37+
:param credential: Credential needed for the client to connect to Azure.
38+
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
39+
:param subscription_id: The ID of the target subscription.
40+
:type subscription_id: str
41+
:param str api_version: API version to use if no profile is provided, or if
42+
missing in profile.
43+
:param str base_url: Service URL
44+
:param profile: A profile definition, from KnownProfiles to dict.
45+
:type profile: azure.profiles.KnownProfiles
46+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
47+
"""
48+
49+
DEFAULT_API_VERSION = '2020-07-01-preview'
50+
_PROFILE_TAG = "azure.mgmt.adp.AdpManagementClient"
51+
LATEST_PROFILE = ProfileDefinition({
52+
_PROFILE_TAG: {
53+
None: DEFAULT_API_VERSION,
54+
}},
55+
_PROFILE_TAG + " latest"
56+
)
57+
58+
def __init__(
59+
self,
60+
credential, # type: "AsyncTokenCredential"
61+
subscription_id, # type: str
62+
api_version=None,
63+
base_url=None,
64+
profile=KnownProfiles.default,
65+
**kwargs # type: Any
66+
) -> None:
67+
if not base_url:
68+
base_url = 'https://management.azure.com'
69+
self._config = AdpManagementClientConfiguration(credential, subscription_id, **kwargs)
70+
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
71+
super(AdpManagementClient, self).__init__(
72+
api_version=api_version,
73+
profile=profile
74+
)
75+
76+
@classmethod
77+
def _models_dict(cls, api_version):
78+
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
79+
80+
@classmethod
81+
def models(cls, api_version=DEFAULT_API_VERSION):
82+
"""Module depends on the API version:
83+
84+
* 2020-07-01-preview: :mod:`v2020_07_01_preview.models<azure.mgmt.adp.v2020_07_01_preview.models>`
85+
"""
86+
if api_version == '2020-07-01-preview':
87+
from ..v2020_07_01_preview import models
88+
return models
89+
raise ValueError("API version {} is not available".format(api_version))
90+
91+
@property
92+
def accounts(self):
93+
"""Instance depends on the API version:
94+
95+
* 2020-07-01-preview: :class:`AccountsOperations<azure.mgmt.adp.v2020_07_01_preview.aio.operations.AccountsOperations>`
96+
"""
97+
api_version = self._get_api_version('accounts')
98+
if api_version == '2020-07-01-preview':
99+
from ..v2020_07_01_preview.aio.operations import AccountsOperations as OperationClass
100+
else:
101+
raise ValueError("API version {} does not have operation group 'accounts'".format(api_version))
102+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
103+
104+
@property
105+
def data_pools(self):
106+
"""Instance depends on the API version:
107+
108+
* 2020-07-01-preview: :class:`DataPoolsOperations<azure.mgmt.adp.v2020_07_01_preview.aio.operations.DataPoolsOperations>`
109+
"""
110+
api_version = self._get_api_version('data_pools')
111+
if api_version == '2020-07-01-preview':
112+
from ..v2020_07_01_preview.aio.operations import DataPoolsOperations as OperationClass
113+
else:
114+
raise ValueError("API version {} does not have operation group 'data_pools'".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 operations(self):
119+
"""Instance depends on the API version:
120+
121+
* 2020-07-01-preview: :class:`Operations<azure.mgmt.adp.v2020_07_01_preview.aio.operations.Operations>`
122+
"""
123+
api_version = self._get_api_version('operations')
124+
if api_version == '2020-07-01-preview':
125+
from ..v2020_07_01_preview.aio.operations import Operations as OperationClass
126+
else:
127+
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
128+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
129+
130+
async def close(self):
131+
await self._client.close()
132+
async def __aenter__(self):
133+
await self._client.__aenter__()
134+
return self
135+
async def __aexit__(self, *exc_details):
136+
await self._client.__aexit__(*exc_details)

0 commit comments

Comments
 (0)