Skip to content

Commit 56d4424

Browse files
author
SDKAuto
committed
CodeGen from PR 18734 in Azure/azure-rest-api-specs
Merge 06ef497443666b704e52585416b79ec5bfe53ecd into b9e6e16643bf008391b990a09995cf00d2f40a9d
1 parent b881549 commit 56d4424

File tree

215 files changed

+62458
-15071
lines changed

Some content is hidden

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

215 files changed

+62458
-15071
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"autorest": "3.7.2",
3+
"use": [
4+
"@autorest/[email protected]",
5+
"@autorest/[email protected]"
6+
],
7+
"commit": "5543826cdd190aaf306c435b64710512b8261506",
8+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9+
"autorest_command": "autorest specification/databox/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.7.2",
10+
"readme": "specification/databox/resource-manager/readme.md"
11+
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@
88
# Changes may cause incorrect behavior and will be lost if the code is
99
# regenerated.
1010
# --------------------------------------------------------------------------
11-
from typing import Any
11+
from typing import TYPE_CHECKING
1212

1313
from azure.core.configuration import Configuration
1414
from azure.core.pipeline import policies
15-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
15+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1616

1717
from ._version import VERSION
1818

19+
if TYPE_CHECKING:
20+
# pylint: disable=unused-import,ungrouped-imports
21+
from typing import Any
22+
23+
from azure.core.credentials import TokenCredential
1924

2025
class DataBoxManagementClientConfiguration(Configuration):
2126
"""Configuration for DataBoxManagementClient.
@@ -63,4 +68,4 @@ def _configure(
6368
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6469
self.authentication_policy = kwargs.get('authentication_policy')
6570
if self.credential and not self.authentication_policy:
66-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
71+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_data_box_management_client.py

Lines changed: 86 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,22 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from azure.mgmt.core import ARMPipelineClient
13-
from msrest import Serializer, Deserializer
12+
from typing import TYPE_CHECKING
13+
14+
from msrest import Deserializer, Serializer
1415

16+
from azure.mgmt.core import ARMPipelineClient
1517
from azure.profiles import KnownProfiles, ProfileDefinition
1618
from azure.profiles.multiapiclient import MultiApiClientMixin
19+
1720
from ._configuration import DataBoxManagementClientConfiguration
21+
from ._operations_mixin import DataBoxManagementClientOperationsMixin
22+
23+
if TYPE_CHECKING:
24+
# pylint: disable=unused-import,ungrouped-imports
25+
from typing import Any, Optional
26+
27+
from azure.core.credentials import TokenCredential
1828

1929
class _SDKClient(object):
2030
def __init__(self, *args, **kwargs):
@@ -23,7 +33,7 @@ def __init__(self, *args, **kwargs):
2333
"""
2434
pass
2535

26-
class DataBoxManagementClient(MultiApiClientMixin, _SDKClient):
36+
class DataBoxManagementClient(DataBoxManagementClientOperationsMixin, MultiApiClientMixin, _SDKClient):
2737
"""The DataBox Client.
2838
2939
This ready contains multiple API versions, to help you deal with all of the Azure clouds
@@ -38,15 +48,16 @@ class DataBoxManagementClient(MultiApiClientMixin, _SDKClient):
3848
:type credential: ~azure.core.credentials.TokenCredential
3949
:param subscription_id: The Subscription Id.
4050
: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
51+
:param api_version: API version to use if no profile is provided, or if missing in profile.
52+
:type api_version: str
53+
:param base_url: Service URL
54+
:type base_url: str
4455
:param profile: A profile definition, from KnownProfiles to dict.
4556
:type profile: azure.profiles.KnownProfiles
4657
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
4758
"""
4859

49-
DEFAULT_API_VERSION = '2020-11-01'
60+
DEFAULT_API_VERSION = '2022-02-01'
5061
_PROFILE_TAG = "azure.mgmt.databox.DataBoxManagementClient"
5162
LATEST_PROFILE = ProfileDefinition({
5263
_PROFILE_TAG: {
@@ -59,13 +70,11 @@ def __init__(
5970
self,
6071
credential, # type: "TokenCredential"
6172
subscription_id, # type: str
62-
api_version=None,
63-
base_url=None,
64-
profile=KnownProfiles.default,
73+
api_version=None, # type: Optional[str]
74+
base_url="https://management.azure.com", # type: str
75+
profile=KnownProfiles.default, # type: KnownProfiles
6576
**kwargs # type: Any
6677
):
67-
if not base_url:
68-
base_url = 'https://management.azure.com'
6978
self._config = DataBoxManagementClientConfiguration(credential, subscription_id, **kwargs)
7079
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
7180
super(DataBoxManagementClient, self).__init__(
@@ -85,6 +94,11 @@ def models(cls, api_version=DEFAULT_API_VERSION):
8594
* 2019-09-01: :mod:`v2019_09_01.models<azure.mgmt.databox.v2019_09_01.models>`
8695
* 2020-04-01: :mod:`v2020_04_01.models<azure.mgmt.databox.v2020_04_01.models>`
8796
* 2020-11-01: :mod:`v2020_11_01.models<azure.mgmt.databox.v2020_11_01.models>`
97+
* 2021-03-01: :mod:`v2021_03_01.models<azure.mgmt.databox.v2021_03_01.models>`
98+
* 2021-05-01: :mod:`v2021_05_01.models<azure.mgmt.databox.v2021_05_01.models>`
99+
* 2021-08-01-preview: :mod:`v2021_08_01_preview.models<azure.mgmt.databox.v2021_08_01_preview.models>`
100+
* 2021-12-01: :mod:`v2021_12_01.models<azure.mgmt.databox.v2021_12_01.models>`
101+
* 2022-02-01: :mod:`v2022_02_01.models<azure.mgmt.databox.v2022_02_01.models>`
88102
"""
89103
if api_version == '2018-01-01':
90104
from .v2018_01_01 import models
@@ -98,6 +112,21 @@ def models(cls, api_version=DEFAULT_API_VERSION):
98112
elif api_version == '2020-11-01':
99113
from .v2020_11_01 import models
100114
return models
115+
elif api_version == '2021-03-01':
116+
from .v2021_03_01 import models
117+
return models
118+
elif api_version == '2021-05-01':
119+
from .v2021_05_01 import models
120+
return models
121+
elif api_version == '2021-08-01-preview':
122+
from .v2021_08_01_preview import models
123+
return models
124+
elif api_version == '2021-12-01':
125+
from .v2021_12_01 import models
126+
return models
127+
elif api_version == '2022-02-01':
128+
from .v2022_02_01 import models
129+
return models
101130
raise ValueError("API version {} is not available".format(api_version))
102131

103132
@property
@@ -108,6 +137,11 @@ def jobs(self):
108137
* 2019-09-01: :class:`JobsOperations<azure.mgmt.databox.v2019_09_01.operations.JobsOperations>`
109138
* 2020-04-01: :class:`JobsOperations<azure.mgmt.databox.v2020_04_01.operations.JobsOperations>`
110139
* 2020-11-01: :class:`JobsOperations<azure.mgmt.databox.v2020_11_01.operations.JobsOperations>`
140+
* 2021-03-01: :class:`JobsOperations<azure.mgmt.databox.v2021_03_01.operations.JobsOperations>`
141+
* 2021-05-01: :class:`JobsOperations<azure.mgmt.databox.v2021_05_01.operations.JobsOperations>`
142+
* 2021-08-01-preview: :class:`JobsOperations<azure.mgmt.databox.v2021_08_01_preview.operations.JobsOperations>`
143+
* 2021-12-01: :class:`JobsOperations<azure.mgmt.databox.v2021_12_01.operations.JobsOperations>`
144+
* 2022-02-01: :class:`JobsOperations<azure.mgmt.databox.v2022_02_01.operations.JobsOperations>`
111145
"""
112146
api_version = self._get_api_version('jobs')
113147
if api_version == '2018-01-01':
@@ -118,6 +152,16 @@ def jobs(self):
118152
from .v2020_04_01.operations import JobsOperations as OperationClass
119153
elif api_version == '2020-11-01':
120154
from .v2020_11_01.operations import JobsOperations as OperationClass
155+
elif api_version == '2021-03-01':
156+
from .v2021_03_01.operations import JobsOperations as OperationClass
157+
elif api_version == '2021-05-01':
158+
from .v2021_05_01.operations import JobsOperations as OperationClass
159+
elif api_version == '2021-08-01-preview':
160+
from .v2021_08_01_preview.operations import JobsOperations as OperationClass
161+
elif api_version == '2021-12-01':
162+
from .v2021_12_01.operations import JobsOperations as OperationClass
163+
elif api_version == '2022-02-01':
164+
from .v2022_02_01.operations import JobsOperations as OperationClass
121165
else:
122166
raise ValueError("API version {} does not have operation group 'jobs'".format(api_version))
123167
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@@ -130,6 +174,11 @@ def operations(self):
130174
* 2019-09-01: :class:`Operations<azure.mgmt.databox.v2019_09_01.operations.Operations>`
131175
* 2020-04-01: :class:`Operations<azure.mgmt.databox.v2020_04_01.operations.Operations>`
132176
* 2020-11-01: :class:`Operations<azure.mgmt.databox.v2020_11_01.operations.Operations>`
177+
* 2021-03-01: :class:`Operations<azure.mgmt.databox.v2021_03_01.operations.Operations>`
178+
* 2021-05-01: :class:`Operations<azure.mgmt.databox.v2021_05_01.operations.Operations>`
179+
* 2021-08-01-preview: :class:`Operations<azure.mgmt.databox.v2021_08_01_preview.operations.Operations>`
180+
* 2021-12-01: :class:`Operations<azure.mgmt.databox.v2021_12_01.operations.Operations>`
181+
* 2022-02-01: :class:`Operations<azure.mgmt.databox.v2022_02_01.operations.Operations>`
133182
"""
134183
api_version = self._get_api_version('operations')
135184
if api_version == '2018-01-01':
@@ -140,6 +189,16 @@ def operations(self):
140189
from .v2020_04_01.operations import Operations as OperationClass
141190
elif api_version == '2020-11-01':
142191
from .v2020_11_01.operations import Operations as OperationClass
192+
elif api_version == '2021-03-01':
193+
from .v2021_03_01.operations import Operations as OperationClass
194+
elif api_version == '2021-05-01':
195+
from .v2021_05_01.operations import Operations as OperationClass
196+
elif api_version == '2021-08-01-preview':
197+
from .v2021_08_01_preview.operations import Operations as OperationClass
198+
elif api_version == '2021-12-01':
199+
from .v2021_12_01.operations import Operations as OperationClass
200+
elif api_version == '2022-02-01':
201+
from .v2022_02_01.operations import Operations as OperationClass
143202
else:
144203
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
145204
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@@ -152,6 +211,11 @@ def service(self):
152211
* 2019-09-01: :class:`ServiceOperations<azure.mgmt.databox.v2019_09_01.operations.ServiceOperations>`
153212
* 2020-04-01: :class:`ServiceOperations<azure.mgmt.databox.v2020_04_01.operations.ServiceOperations>`
154213
* 2020-11-01: :class:`ServiceOperations<azure.mgmt.databox.v2020_11_01.operations.ServiceOperations>`
214+
* 2021-03-01: :class:`ServiceOperations<azure.mgmt.databox.v2021_03_01.operations.ServiceOperations>`
215+
* 2021-05-01: :class:`ServiceOperations<azure.mgmt.databox.v2021_05_01.operations.ServiceOperations>`
216+
* 2021-08-01-preview: :class:`ServiceOperations<azure.mgmt.databox.v2021_08_01_preview.operations.ServiceOperations>`
217+
* 2021-12-01: :class:`ServiceOperations<azure.mgmt.databox.v2021_12_01.operations.ServiceOperations>`
218+
* 2022-02-01: :class:`ServiceOperations<azure.mgmt.databox.v2022_02_01.operations.ServiceOperations>`
155219
"""
156220
api_version = self._get_api_version('service')
157221
if api_version == '2018-01-01':
@@ -162,6 +226,16 @@ def service(self):
162226
from .v2020_04_01.operations import ServiceOperations as OperationClass
163227
elif api_version == '2020-11-01':
164228
from .v2020_11_01.operations import ServiceOperations as OperationClass
229+
elif api_version == '2021-03-01':
230+
from .v2021_03_01.operations import ServiceOperations as OperationClass
231+
elif api_version == '2021-05-01':
232+
from .v2021_05_01.operations import ServiceOperations as OperationClass
233+
elif api_version == '2021-08-01-preview':
234+
from .v2021_08_01_preview.operations import ServiceOperations as OperationClass
235+
elif api_version == '2021-12-01':
236+
from .v2021_12_01.operations import ServiceOperations as OperationClass
237+
elif api_version == '2022-02-01':
238+
from .v2022_02_01.operations import ServiceOperations as OperationClass
165239
else:
166240
raise ValueError("API version {} does not have operation group 'service'".format(api_version))
167241
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 msrest import Serializer, Deserializer
12+
from typing import TYPE_CHECKING
13+
14+
if TYPE_CHECKING:
15+
# pylint: disable=unused-import,ungrouped-imports
16+
from typing import Any, Optional
17+
18+
19+
class DataBoxManagementClientOperationsMixin(object):
20+
21+
def mitigate( # pylint: disable=inconsistent-return-statements
22+
self,
23+
job_name, # type: str
24+
resource_group_name, # type: str
25+
mitigate_job_request, # type: "_models.MitigateJobRequest"
26+
**kwargs # type: Any
27+
):
28+
# type: (...) -> None
29+
"""Request to mitigate for a given job.
30+
31+
:param job_name: The name of the job Resource within the specified resource group. job names
32+
must be between 3 and 24 characters in length and use any alphanumeric and underscore only.
33+
:type job_name: str
34+
:param resource_group_name: The Resource Group Name.
35+
:type resource_group_name: str
36+
:param mitigate_job_request: Mitigation Request.
37+
:type mitigate_job_request: ~azure.mgmt.databox.v2022_02_01.models.MitigateJobRequest
38+
:keyword callable cls: A custom type or function that will be passed the direct response
39+
:return: None, or the result of cls(response)
40+
:rtype: None
41+
:raises: ~azure.core.exceptions.HttpResponseError
42+
"""
43+
api_version = self._get_api_version('mitigate')
44+
if api_version == '2021-03-01':
45+
from .v2021_03_01.operations import DataBoxManagementClientOperationsMixin as OperationClass
46+
elif api_version == '2021-05-01':
47+
from .v2021_05_01.operations import DataBoxManagementClientOperationsMixin as OperationClass
48+
elif api_version == '2021-08-01-preview':
49+
from .v2021_08_01_preview.operations import DataBoxManagementClientOperationsMixin as OperationClass
50+
elif api_version == '2021-12-01':
51+
from .v2021_12_01.operations import DataBoxManagementClientOperationsMixin as OperationClass
52+
elif api_version == '2022-02-01':
53+
from .v2022_02_01.operations import DataBoxManagementClientOperationsMixin as OperationClass
54+
else:
55+
raise ValueError("API version {} does not have operation 'mitigate'".format(api_version))
56+
mixin_instance = OperationClass()
57+
mixin_instance._client = self._client
58+
mixin_instance._config = self._config
59+
mixin_instance._serialize = Serializer(self._models_dict(api_version))
60+
mixin_instance._serialize.client_side_validation = False
61+
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
62+
return mixin_instance.mitigate(job_name, resource_group_name, mitigate_job_request, **kwargs)

sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_configuration.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@
88
# Changes may cause incorrect behavior and will be lost if the code is
99
# regenerated.
1010
# --------------------------------------------------------------------------
11-
from typing import Any
11+
from typing import Any, TYPE_CHECKING
1212

1313
from azure.core.configuration import Configuration
1414
from azure.core.pipeline import policies
15-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
15+
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
1616

1717
from .._version import VERSION
1818

19+
if TYPE_CHECKING:
20+
# pylint: disable=unused-import,ungrouped-imports
21+
from azure.core.credentials_async import AsyncTokenCredential
1922

2023
class DataBoxManagementClientConfiguration(Configuration):
2124
"""Configuration for DataBoxManagementClient.
@@ -31,8 +34,8 @@ class DataBoxManagementClientConfiguration(Configuration):
3134

3235
def __init__(
3336
self,
34-
credential, # type: "AsyncTokenCredential"
35-
subscription_id, # type: str
37+
credential: "AsyncTokenCredential",
38+
subscription_id: str,
3639
**kwargs # type: Any
3740
) -> None:
3841
if credential is None:
@@ -61,4 +64,4 @@ def _configure(
6164
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
6265
self.authentication_policy = kwargs.get('authentication_policy')
6366
if self.credential and not self.authentication_policy:
64-
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

0 commit comments

Comments
 (0)