Skip to content

Commit 97b96c6

Browse files
author
SDKAuto
committed
CodeGen from PR 14909 in Azure/azure-rest-api-specs
Merge 42d4715e0e461cf9710a70ca2bf7a21f23f1aee8 into f1448ad
1 parent f3aa604 commit 97b96c6

File tree

85 files changed

+44773
-88
lines changed

Some content is hidden

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

85 files changed

+44773
-88
lines changed

sdk/databox/azure-mgmt-databox/MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
include _meta.json
12
recursive-include tests *.py *.yaml
23
include *.md
34
include azure/__init__.py
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"autorest": "V2",
3+
"use": "@microsoft.azure/autorest.python@~4.0.71",
4+
"commit": "8b4841b645e96479e881de0e536b6403e1ede3d0",
5+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
6+
"autorest_command": "autorest specification/databox/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk [email protected]/autorest.python@~4.0.71 --version=V2",
7+
"readme": "specification/databox/resource-manager/readme.md"
8+
}

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

Lines changed: 153 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,173 @@
1212
from msrest.service_client import SDKClient
1313
from msrest import Serializer, Deserializer
1414

15+
from azure.profiles import KnownProfiles, ProfileDefinition
16+
from azure.profiles.multiapiclient import MultiApiClientMixin
1517
from ._configuration import DataBoxManagementClientConfiguration
16-
from .operations import Operations
17-
from .operations import JobsOperations
18-
from .operations import ServiceOperations
19-
from . import models
18+
from ._operations_mixin import DataBoxManagementClientOperationsMixin
2019

2120

22-
class DataBoxManagementClient(SDKClient):
21+
class DataBoxManagementClient(DataBoxManagementClientOperationsMixin, MultiApiClientMixin, SDKClient):
2322
"""DataBoxManagementClient
2423
24+
This ready contains multiple API versions, to help you deal with all Azure clouds
25+
(Azure Stack, Azure Government, Azure China, etc.).
26+
By default, uses latest API version available on public Azure.
27+
For production, you should stick a particular api-version and/or profile.
28+
The profile sets a mapping between the operation group and an API version.
29+
The api-version parameter sets the default API version if the operation
30+
group is not described in the profile.
31+
2532
:ivar config: Configuration for client.
2633
:vartype config: DataBoxManagementClientConfiguration
2734
28-
:ivar operations: Operations operations
29-
:vartype operations: azure.mgmt.databox.operations.Operations
30-
:ivar jobs: Jobs operations
31-
:vartype jobs: azure.mgmt.databox.operations.JobsOperations
32-
:ivar service: Service operations
33-
:vartype service: azure.mgmt.databox.operations.ServiceOperations
34-
3535
:param credentials: Credentials needed for the client to connect to Azure.
3636
:type credentials: :mod:`A msrestazure Credentials
3737
object<msrestazure.azure_active_directory>`
38-
:param subscription_id: The Subscription Id
38+
:param subscription_id: Subscription credentials which uniquely identify
39+
Microsoft Azure subscription. The subscription ID forms part of the URI
40+
for every service call.
3941
:type subscription_id: str
42+
:param str api_version: API version to use if no profile is provided, or if
43+
missing in profile.
4044
:param str base_url: Service URL
45+
:param profile: A profile definition, from KnownProfiles to dict.
46+
:type profile: azure.profiles.KnownProfiles
4147
"""
4248

43-
def __init__(
44-
self, credentials, subscription_id, base_url=None):
49+
DEFAULT_API_VERSION = '2021-05-01'
50+
_PROFILE_TAG = "azure.mgmt.databox.DataBoxManagementClient"
51+
LATEST_PROFILE = ProfileDefinition({
52+
_PROFILE_TAG: {
53+
None: DEFAULT_API_VERSION,
54+
}},
55+
_PROFILE_TAG + " latest"
56+
)
4557

58+
def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default):
4659
self.config = DataBoxManagementClientConfiguration(credentials, subscription_id, base_url)
47-
super(DataBoxManagementClient, self).__init__(self.config.credentials, self.config)
48-
49-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
50-
self.api_version = '2019-09-01'
51-
self._serialize = Serializer(client_models)
52-
self._deserialize = Deserializer(client_models)
53-
54-
self.operations = Operations(
55-
self._client, self.config, self._serialize, self._deserialize)
56-
self.jobs = JobsOperations(
57-
self._client, self.config, self._serialize, self._deserialize)
58-
self.service = ServiceOperations(
59-
self._client, self.config, self._serialize, self._deserialize)
60+
super(DataBoxManagementClient, self).__init__(
61+
credentials,
62+
self.config,
63+
api_version=api_version,
64+
profile=profile
65+
)
66+
67+
@classmethod
68+
def _models_dict(cls, api_version):
69+
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
70+
71+
@classmethod
72+
def models(cls, api_version=DEFAULT_API_VERSION):
73+
"""Module depends on the API version:
74+
75+
* 2018-01-01: :mod:`v2018_01_01.models<azure.mgmt.databox.v2018_01_01.models>`
76+
* 2019-09-01: :mod:`v2019_09_01.models<azure.mgmt.databox.v2019_09_01.models>`
77+
* 2020-04-01: :mod:`v2020_04_01.models<azure.mgmt.databox.v2020_04_01.models>`
78+
* 2020-11-01: :mod:`v2020_11_01.models<azure.mgmt.databox.v2020_11_01.models>`
79+
* 2021-03-01: :mod:`v2021_03_01.models<azure.mgmt.databox.v2021_03_01.models>`
80+
* 2021-05-01: :mod:`v2021_05_01.models<azure.mgmt.databox.v2021_05_01.models>`
81+
"""
82+
if api_version == '2018-01-01':
83+
from .v2018_01_01 import models
84+
return models
85+
elif api_version == '2019-09-01':
86+
from .v2019_09_01 import models
87+
return models
88+
elif api_version == '2020-04-01':
89+
from .v2020_04_01 import models
90+
return models
91+
elif api_version == '2020-11-01':
92+
from .v2020_11_01 import models
93+
return models
94+
elif api_version == '2021-03-01':
95+
from .v2021_03_01 import models
96+
return models
97+
elif api_version == '2021-05-01':
98+
from .v2021_05_01 import models
99+
return models
100+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
101+
102+
@property
103+
def jobs(self):
104+
"""Instance depends on the API version:
105+
106+
* 2018-01-01: :class:`JobsOperations<azure.mgmt.databox.v2018_01_01.operations.JobsOperations>`
107+
* 2019-09-01: :class:`JobsOperations<azure.mgmt.databox.v2019_09_01.operations.JobsOperations>`
108+
* 2020-04-01: :class:`JobsOperations<azure.mgmt.databox.v2020_04_01.operations.JobsOperations>`
109+
* 2020-11-01: :class:`JobsOperations<azure.mgmt.databox.v2020_11_01.operations.JobsOperations>`
110+
* 2021-03-01: :class:`JobsOperations<azure.mgmt.databox.v2021_03_01.operations.JobsOperations>`
111+
* 2021-05-01: :class:`JobsOperations<azure.mgmt.databox.v2021_05_01.operations.JobsOperations>`
112+
"""
113+
api_version = self._get_api_version('jobs')
114+
if api_version == '2018-01-01':
115+
from .v2018_01_01.operations import JobsOperations as OperationClass
116+
elif api_version == '2019-09-01':
117+
from .v2019_09_01.operations import JobsOperations as OperationClass
118+
elif api_version == '2020-04-01':
119+
from .v2020_04_01.operations import JobsOperations as OperationClass
120+
elif api_version == '2020-11-01':
121+
from .v2020_11_01.operations import JobsOperations as OperationClass
122+
elif api_version == '2021-03-01':
123+
from .v2021_03_01.operations import JobsOperations as OperationClass
124+
elif api_version == '2021-05-01':
125+
from .v2021_05_01.operations import JobsOperations as OperationClass
126+
else:
127+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
128+
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
129+
130+
@property
131+
def operations(self):
132+
"""Instance depends on the API version:
133+
134+
* 2018-01-01: :class:`Operations<azure.mgmt.databox.v2018_01_01.operations.Operations>`
135+
* 2019-09-01: :class:`Operations<azure.mgmt.databox.v2019_09_01.operations.Operations>`
136+
* 2020-04-01: :class:`Operations<azure.mgmt.databox.v2020_04_01.operations.Operations>`
137+
* 2020-11-01: :class:`Operations<azure.mgmt.databox.v2020_11_01.operations.Operations>`
138+
* 2021-03-01: :class:`Operations<azure.mgmt.databox.v2021_03_01.operations.Operations>`
139+
* 2021-05-01: :class:`Operations<azure.mgmt.databox.v2021_05_01.operations.Operations>`
140+
"""
141+
api_version = self._get_api_version('operations')
142+
if api_version == '2018-01-01':
143+
from .v2018_01_01.operations import Operations as OperationClass
144+
elif api_version == '2019-09-01':
145+
from .v2019_09_01.operations import Operations as OperationClass
146+
elif api_version == '2020-04-01':
147+
from .v2020_04_01.operations import Operations as OperationClass
148+
elif api_version == '2020-11-01':
149+
from .v2020_11_01.operations import Operations as OperationClass
150+
elif api_version == '2021-03-01':
151+
from .v2021_03_01.operations import Operations as OperationClass
152+
elif api_version == '2021-05-01':
153+
from .v2021_05_01.operations import Operations as OperationClass
154+
else:
155+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
156+
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
157+
158+
@property
159+
def service(self):
160+
"""Instance depends on the API version:
161+
162+
* 2018-01-01: :class:`ServiceOperations<azure.mgmt.databox.v2018_01_01.operations.ServiceOperations>`
163+
* 2019-09-01: :class:`ServiceOperations<azure.mgmt.databox.v2019_09_01.operations.ServiceOperations>`
164+
* 2020-04-01: :class:`ServiceOperations<azure.mgmt.databox.v2020_04_01.operations.ServiceOperations>`
165+
* 2020-11-01: :class:`ServiceOperations<azure.mgmt.databox.v2020_11_01.operations.ServiceOperations>`
166+
* 2021-03-01: :class:`ServiceOperations<azure.mgmt.databox.v2021_03_01.operations.ServiceOperations>`
167+
* 2021-05-01: :class:`ServiceOperations<azure.mgmt.databox.v2021_05_01.operations.ServiceOperations>`
168+
"""
169+
api_version = self._get_api_version('service')
170+
if api_version == '2018-01-01':
171+
from .v2018_01_01.operations import ServiceOperations as OperationClass
172+
elif api_version == '2019-09-01':
173+
from .v2019_09_01.operations import ServiceOperations as OperationClass
174+
elif api_version == '2020-04-01':
175+
from .v2020_04_01.operations import ServiceOperations as OperationClass
176+
elif api_version == '2020-11-01':
177+
from .v2020_11_01.operations import ServiceOperations as OperationClass
178+
elif api_version == '2021-03-01':
179+
from .v2021_03_01.operations import ServiceOperations as OperationClass
180+
elif api_version == '2021-05-01':
181+
from .v2021_05_01.operations import ServiceOperations as OperationClass
182+
else:
183+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
184+
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
13+
14+
class DataBoxManagementClientOperationsMixin(object):
15+
16+
17+
def mitigate(self, job_name, resource_group_name, customer_resolution_code, custom_headers=None, raw=False, **operation_config):
18+
"""Request to mitigate for a given job.
19+
20+
:param job_name: The name of the job Resource within the specified
21+
resource group. job names must be between 3 and 24 characters in
22+
length and use any alphanumeric and underscore only
23+
:type job_name: str
24+
:param resource_group_name: The Resource Group Name
25+
:type resource_group_name: str
26+
:param customer_resolution_code: Resolution code for the job. Possible
27+
values include: 'None', 'MoveToCleanUpDevice', 'Resume'
28+
:type customer_resolution_code: str or
29+
~azure.mgmt.databox.models.CustomerResolutionCode
30+
:param dict custom_headers: headers that will be added to the request
31+
:param bool raw: returns the direct response alongside the
32+
deserialized response
33+
:param operation_config: :ref:`Operation configuration
34+
overrides<msrest:optionsforoperations>`.
35+
:return: None or ClientRawResponse if raw=true
36+
:rtype: None or ~msrest.pipeline.ClientRawResponse
37+
:raises:
38+
:class:`ApiErrorException<azure.mgmt.databox.models.ApiErrorException>`
39+
40+
"""
41+
api_version = self._get_api_version('mitigate')
42+
if api_version == '2021-03-01':
43+
from .v2021_03_01.operations import DataBoxManagementClientOperationsMixin as OperationClass
44+
elif api_version == '2021-05-01':
45+
from .v2021_05_01.operations import DataBoxManagementClientOperationsMixin as OperationClass
46+
else:
47+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
48+
mixin_instance = OperationClass()
49+
mixin_instance._client = self._client
50+
mixin_instance.config = self.config
51+
mixin_instance._serialize = Serializer(self._models_dict(api_version))
52+
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
53+
mixin_instance.api_version = api_version
54+
return mixin_instance.mitigate(job_name, resource_group_name, customer_resolution_code, custom_headers, raw, **operation_config)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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+
from .v2021_05_01.models import *
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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 ._configuration import DataBoxManagementClientConfiguration
13+
from ._data_box_management_client import DataBoxManagementClient
14+
__all__ = ['DataBoxManagementClient', 'DataBoxManagementClientConfiguration']
15+
16+
from .version import VERSION
17+
18+
__version__ = VERSION
19+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 msrestazure import AzureConfiguration
12+
13+
from .version import VERSION
14+
15+
16+
class DataBoxManagementClientConfiguration(AzureConfiguration):
17+
"""Configuration for DataBoxManagementClient
18+
Note that all parameters used to create this instance are saved as instance
19+
attributes.
20+
21+
:param credentials: Credentials needed for the client to connect to Azure.
22+
:type credentials: :mod:`A msrestazure Credentials
23+
object<msrestazure.azure_active_directory>`
24+
:param subscription_id: The Subscription Id
25+
:type subscription_id: str
26+
:param str base_url: Service URL
27+
"""
28+
29+
def __init__(
30+
self, credentials, subscription_id, base_url=None):
31+
32+
if credentials is None:
33+
raise ValueError("Parameter 'credentials' must not be None.")
34+
if subscription_id is None:
35+
raise ValueError("Parameter 'subscription_id' must not be None.")
36+
if not base_url:
37+
base_url = 'https://management.azure.com'
38+
39+
super(DataBoxManagementClientConfiguration, self).__init__(base_url)
40+
41+
# Starting Autorest.Python 4.0.64, make connection pool activated by default
42+
self.keep_alive = True
43+
44+
self.add_user_agent('azure-mgmt-databox/{}'.format(VERSION))
45+
self.add_user_agent('Azure-SDK-For-Python')
46+
47+
self.credentials = credentials
48+
self.subscription_id = subscription_id

0 commit comments

Comments
 (0)