Skip to content

Commit d9d8a74

Browse files
author
SDKAuto
committed
CodeGen from PR 16989 in Azure/azure-rest-api-specs
Merge f8ed9c9124d302e0e7458645c79682165233f351 into 9275002
1 parent da0e1d7 commit d9d8a74

File tree

190 files changed

+48226
-14527
lines changed

Some content is hidden

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

190 files changed

+48226
-14527
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": "ccfdf6dbdcbfda578b026925f363b3b3232f9cae",
8+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9+
"autorest_command": "autorest specification/databox/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/[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: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,21 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

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

14+
from azure.mgmt.core import ARMPipelineClient
1515
from azure.profiles import KnownProfiles, ProfileDefinition
1616
from azure.profiles.multiapiclient import MultiApiClientMixin
17+
from msrest import Deserializer, Serializer
18+
1719
from ._configuration import DataBoxManagementClientConfiguration
20+
from ._operations_mixin import DataBoxManagementClientOperationsMixin
21+
22+
if TYPE_CHECKING:
23+
# pylint: disable=unused-import,ungrouped-imports
24+
from typing import Any, Optional
25+
26+
from azure.core.credentials import TokenCredential
1827

1928
class _SDKClient(object):
2029
def __init__(self, *args, **kwargs):
@@ -23,7 +32,7 @@ def __init__(self, *args, **kwargs):
2332
"""
2433
pass
2534

26-
class DataBoxManagementClient(MultiApiClientMixin, _SDKClient):
35+
class DataBoxManagementClient(DataBoxManagementClientOperationsMixin, MultiApiClientMixin, _SDKClient):
2736
"""The DataBox Client.
2837
2938
This ready contains multiple API versions, to help you deal with all of the Azure clouds
@@ -38,15 +47,16 @@ class DataBoxManagementClient(MultiApiClientMixin, _SDKClient):
3847
:type credential: ~azure.core.credentials.TokenCredential
3948
:param subscription_id: The Subscription Id.
4049
: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
50+
:param api_version: API version to use if no profile is provided, or if missing in profile.
51+
:type api_version: str
52+
:param base_url: Service URL
53+
:type base_url: str
4454
:param profile: A profile definition, from KnownProfiles to dict.
4555
:type profile: azure.profiles.KnownProfiles
4656
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
4757
"""
4858

49-
DEFAULT_API_VERSION = '2020-11-01'
59+
DEFAULT_API_VERSION = '2021-12-01'
5060
_PROFILE_TAG = "azure.mgmt.databox.DataBoxManagementClient"
5161
LATEST_PROFILE = ProfileDefinition({
5262
_PROFILE_TAG: {
@@ -59,13 +69,11 @@ def __init__(
5969
self,
6070
credential, # type: "TokenCredential"
6171
subscription_id, # type: str
62-
api_version=None,
63-
base_url=None,
64-
profile=KnownProfiles.default,
72+
api_version=None, # type: Optional[str]
73+
base_url="https://management.azure.com", # type: str
74+
profile=KnownProfiles.default, # type: KnownProfiles
6575
**kwargs # type: Any
6676
):
67-
if not base_url:
68-
base_url = 'https://management.azure.com'
6977
self._config = DataBoxManagementClientConfiguration(credential, subscription_id, **kwargs)
7078
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
7179
super(DataBoxManagementClient, self).__init__(
@@ -85,6 +93,10 @@ def models(cls, api_version=DEFAULT_API_VERSION):
8593
* 2019-09-01: :mod:`v2019_09_01.models<azure.mgmt.databox.v2019_09_01.models>`
8694
* 2020-04-01: :mod:`v2020_04_01.models<azure.mgmt.databox.v2020_04_01.models>`
8795
* 2020-11-01: :mod:`v2020_11_01.models<azure.mgmt.databox.v2020_11_01.models>`
96+
* 2021-03-01: :mod:`v2021_03_01.models<azure.mgmt.databox.v2021_03_01.models>`
97+
* 2021-05-01: :mod:`v2021_05_01.models<azure.mgmt.databox.v2021_05_01.models>`
98+
* 2021-08-01-preview: :mod:`v2021_08_01_preview.models<azure.mgmt.databox.v2021_08_01_preview.models>`
99+
* 2021-12-01: :mod:`v2021_12_01.models<azure.mgmt.databox.v2021_12_01.models>`
88100
"""
89101
if api_version == '2018-01-01':
90102
from .v2018_01_01 import models
@@ -98,6 +110,18 @@ def models(cls, api_version=DEFAULT_API_VERSION):
98110
elif api_version == '2020-11-01':
99111
from .v2020_11_01 import models
100112
return models
113+
elif api_version == '2021-03-01':
114+
from .v2021_03_01 import models
115+
return models
116+
elif api_version == '2021-05-01':
117+
from .v2021_05_01 import models
118+
return models
119+
elif api_version == '2021-08-01-preview':
120+
from .v2021_08_01_preview import models
121+
return models
122+
elif api_version == '2021-12-01':
123+
from .v2021_12_01 import models
124+
return models
101125
raise ValueError("API version {} is not available".format(api_version))
102126

103127
@property
@@ -108,6 +132,10 @@ def jobs(self):
108132
* 2019-09-01: :class:`JobsOperations<azure.mgmt.databox.v2019_09_01.operations.JobsOperations>`
109133
* 2020-04-01: :class:`JobsOperations<azure.mgmt.databox.v2020_04_01.operations.JobsOperations>`
110134
* 2020-11-01: :class:`JobsOperations<azure.mgmt.databox.v2020_11_01.operations.JobsOperations>`
135+
* 2021-03-01: :class:`JobsOperations<azure.mgmt.databox.v2021_03_01.operations.JobsOperations>`
136+
* 2021-05-01: :class:`JobsOperations<azure.mgmt.databox.v2021_05_01.operations.JobsOperations>`
137+
* 2021-08-01-preview: :class:`JobsOperations<azure.mgmt.databox.v2021_08_01_preview.operations.JobsOperations>`
138+
* 2021-12-01: :class:`JobsOperations<azure.mgmt.databox.v2021_12_01.operations.JobsOperations>`
111139
"""
112140
api_version = self._get_api_version('jobs')
113141
if api_version == '2018-01-01':
@@ -118,6 +146,14 @@ def jobs(self):
118146
from .v2020_04_01.operations import JobsOperations as OperationClass
119147
elif api_version == '2020-11-01':
120148
from .v2020_11_01.operations import JobsOperations as OperationClass
149+
elif api_version == '2021-03-01':
150+
from .v2021_03_01.operations import JobsOperations as OperationClass
151+
elif api_version == '2021-05-01':
152+
from .v2021_05_01.operations import JobsOperations as OperationClass
153+
elif api_version == '2021-08-01-preview':
154+
from .v2021_08_01_preview.operations import JobsOperations as OperationClass
155+
elif api_version == '2021-12-01':
156+
from .v2021_12_01.operations import JobsOperations as OperationClass
121157
else:
122158
raise ValueError("API version {} does not have operation group 'jobs'".format(api_version))
123159
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@@ -130,6 +166,10 @@ def operations(self):
130166
* 2019-09-01: :class:`Operations<azure.mgmt.databox.v2019_09_01.operations.Operations>`
131167
* 2020-04-01: :class:`Operations<azure.mgmt.databox.v2020_04_01.operations.Operations>`
132168
* 2020-11-01: :class:`Operations<azure.mgmt.databox.v2020_11_01.operations.Operations>`
169+
* 2021-03-01: :class:`Operations<azure.mgmt.databox.v2021_03_01.operations.Operations>`
170+
* 2021-05-01: :class:`Operations<azure.mgmt.databox.v2021_05_01.operations.Operations>`
171+
* 2021-08-01-preview: :class:`Operations<azure.mgmt.databox.v2021_08_01_preview.operations.Operations>`
172+
* 2021-12-01: :class:`Operations<azure.mgmt.databox.v2021_12_01.operations.Operations>`
133173
"""
134174
api_version = self._get_api_version('operations')
135175
if api_version == '2018-01-01':
@@ -140,6 +180,14 @@ def operations(self):
140180
from .v2020_04_01.operations import Operations as OperationClass
141181
elif api_version == '2020-11-01':
142182
from .v2020_11_01.operations import Operations as OperationClass
183+
elif api_version == '2021-03-01':
184+
from .v2021_03_01.operations import Operations as OperationClass
185+
elif api_version == '2021-05-01':
186+
from .v2021_05_01.operations import Operations as OperationClass
187+
elif api_version == '2021-08-01-preview':
188+
from .v2021_08_01_preview.operations import Operations as OperationClass
189+
elif api_version == '2021-12-01':
190+
from .v2021_12_01.operations import Operations as OperationClass
143191
else:
144192
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
145193
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@@ -152,6 +200,10 @@ def service(self):
152200
* 2019-09-01: :class:`ServiceOperations<azure.mgmt.databox.v2019_09_01.operations.ServiceOperations>`
153201
* 2020-04-01: :class:`ServiceOperations<azure.mgmt.databox.v2020_04_01.operations.ServiceOperations>`
154202
* 2020-11-01: :class:`ServiceOperations<azure.mgmt.databox.v2020_11_01.operations.ServiceOperations>`
203+
* 2021-03-01: :class:`ServiceOperations<azure.mgmt.databox.v2021_03_01.operations.ServiceOperations>`
204+
* 2021-05-01: :class:`ServiceOperations<azure.mgmt.databox.v2021_05_01.operations.ServiceOperations>`
205+
* 2021-08-01-preview: :class:`ServiceOperations<azure.mgmt.databox.v2021_08_01_preview.operations.ServiceOperations>`
206+
* 2021-12-01: :class:`ServiceOperations<azure.mgmt.databox.v2021_12_01.operations.ServiceOperations>`
155207
"""
156208
api_version = self._get_api_version('service')
157209
if api_version == '2018-01-01':
@@ -162,6 +214,14 @@ def service(self):
162214
from .v2020_04_01.operations import ServiceOperations as OperationClass
163215
elif api_version == '2020-11-01':
164216
from .v2020_11_01.operations import ServiceOperations as OperationClass
217+
elif api_version == '2021-03-01':
218+
from .v2021_03_01.operations import ServiceOperations as OperationClass
219+
elif api_version == '2021-05-01':
220+
from .v2021_05_01.operations import ServiceOperations as OperationClass
221+
elif api_version == '2021-08-01-preview':
222+
from .v2021_08_01_preview.operations import ServiceOperations as OperationClass
223+
elif api_version == '2021-12-01':
224+
from .v2021_12_01.operations import ServiceOperations as OperationClass
165225
else:
166226
raise ValueError("API version {} does not have operation group 'service'".format(api_version))
167227
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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(
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.v2021_12_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+
else:
53+
raise ValueError("API version {} does not have operation 'mitigate'".format(api_version))
54+
mixin_instance = OperationClass()
55+
mixin_instance._client = self._client
56+
mixin_instance._config = self._config
57+
mixin_instance._serialize = Serializer(self._models_dict(api_version))
58+
mixin_instance._serialize.client_side_validation = False
59+
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
60+
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)