Skip to content

Commit cc37a54

Browse files
AutorestCIlmazuel
authored andcommitted
[AutoPR] dns/resource-manager (#2874)
* MultiAPI DNS client * Generated from 702b6047761782d41a490bd89b5585b6264fd91c (#2873) DNS multi-api Python * DNS packaging
1 parent d474dfc commit cc37a54

File tree

87 files changed

+3665
-220
lines changed

Some content is hidden

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

87 files changed

+3665
-220
lines changed

azure-mgmt-dns/HISTORY.rst

+36
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,42 @@
33
Release History
44
===============
55

6+
2.0.0rc2 (2018-07-05)
7+
+++++++++++++++++++++
8+
9+
**Features**
10+
11+
- Client class can be used as a context manager to keep the underlying HTTP session open for performance
12+
13+
**General Breaking changes**
14+
15+
This version uses a next-generation code generator that *might* introduce breaking changes.
16+
17+
- Model signatures now use only keyword-argument syntax. All positional arguments must be re-written as keyword-arguments.
18+
To keep auto-completion in most cases, models are now generated for Python 2 and Python 3. Python 3 uses the "*" syntax for keyword-only arguments.
19+
- Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to improve the behavior when unrecognized enum values are encountered.
20+
While this is not a breaking change, the distinctions are important, and are documented here:
21+
https://docs.python.org/3/library/enum.html#others
22+
At a glance:
23+
24+
- "is" should not be used at all.
25+
- "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be prefered.
26+
27+
- New Long Running Operation:
28+
29+
- Return type changes from `msrestazure.azure_operation.AzureOperationPoller` to `msrest.polling.LROPoller`. External API is the same.
30+
- Return type is now **always** a `msrest.polling.LROPoller`, regardless of the optional parameters used.
31+
- The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`,
32+
without polling, now this returns an LROPoller. After polling, the final resource will be returned as a `ClientRawResponse`.
33+
- New `polling` parameter. The default behavior is `Polling=True` which will poll using ARM algorithm. When `Polling=False`,
34+
the response of the initial call will be returned without polling.
35+
- `polling` parameter accepts instances of subclasses of `msrest.polling.PollingMethod`.
36+
- `add_done_callback` will no longer raise if called after polling is finished, but will instead execute the callback right away.
37+
38+
**Bugfixes**
39+
40+
- Compatibility of the sdist with wheel 0.31.0
41+
642
2.0.0rc1 (2018-03-14)
743
+++++++++++++++++++++
844

azure-mgmt-dns/azure/mgmt/dns/dns_management_client.py

+87-27
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from msrest.service_client import ServiceClient
12+
from msrest.service_client import SDKClient
1313
from msrest import Serializer, Deserializer
1414
from msrestazure import AzureConfiguration
15+
16+
from azure.profiles import KnownProfiles, ProfileDefinition
17+
from azure.profiles.multiapiclient import MultiApiClientMixin
1518
from .version import VERSION
16-
from .operations.record_sets_operations import RecordSetsOperations
17-
from .operations.zones_operations import ZonesOperations
18-
from . import models
1919

2020

2121
class DnsManagementClientConfiguration(AzureConfiguration):
@@ -26,8 +26,7 @@ class DnsManagementClientConfiguration(AzureConfiguration):
2626
:param credentials: Credentials needed for the client to connect to Azure.
2727
:type credentials: :mod:`A msrestazure Credentials
2828
object<msrestazure.azure_active_directory>`
29-
:param subscription_id: Specifies the Azure subscription ID, which
30-
uniquely identifies the Microsoft Azure subscription.
29+
:param subscription_id: The Microsoft Azure subscription ID.
3130
:type subscription_id: str
3231
:param str base_url: Service URL
3332
"""
@@ -51,38 +50,99 @@ def __init__(
5150
self.subscription_id = subscription_id
5251

5352

54-
class DnsManagementClient(object):
53+
class DnsManagementClient(MultiApiClientMixin, SDKClient):
5554
"""The DNS Management Client.
5655
56+
This ready contains multiple API versions, to help you deal with all Azure clouds
57+
(Azure Stack, Azure Government, Azure China, etc.).
58+
By default, uses latest API version available on public Azure.
59+
For production, you should stick a particular api-version and/or profile.
60+
The profile sets a mapping between the operation group and an API version.
61+
The api-version parameter sets the default API version if the operation
62+
group is not described in the profile.
63+
5764
:ivar config: Configuration for client.
5865
:vartype config: DnsManagementClientConfiguration
5966
60-
:ivar record_sets: RecordSets operations
61-
:vartype record_sets: azure.mgmt.dns.operations.RecordSetsOperations
62-
:ivar zones: Zones operations
63-
:vartype zones: azure.mgmt.dns.operations.ZonesOperations
64-
6567
:param credentials: Credentials needed for the client to connect to Azure.
6668
:type credentials: :mod:`A msrestazure Credentials
6769
object<msrestazure.azure_active_directory>`
68-
:param subscription_id: Specifies the Azure subscription ID, which
69-
uniquely identifies the Microsoft Azure subscription.
70+
:param subscription_id: The Microsoft Azure subscription ID.
7071
:type subscription_id: str
72+
:param str api_version: API version to use if no profile is provided, or if
73+
missing in profile.
7174
:param str base_url: Service URL
75+
:param profile: A profile definition, from KnownProfiles to dict.
76+
:type profile: azure.profiles.KnownProfiles
7277
"""
7378

74-
def __init__(
75-
self, credentials, subscription_id, base_url=None):
79+
DEFAULT_API_VERSION = '2018-03-01-preview'
80+
_PROFILE_TAG = "azure.mgmt.dns.DnsManagementClient"
81+
LATEST_PROFILE = ProfileDefinition({
82+
_PROFILE_TAG: {
83+
None: DEFAULT_API_VERSION
84+
}},
85+
_PROFILE_TAG + " latest"
86+
)
7687

88+
def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default):
7789
self.config = DnsManagementClientConfiguration(credentials, subscription_id, base_url)
78-
self._client = ServiceClient(self.config.credentials, self.config)
79-
80-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
81-
self.api_version = '2018-03-01-preview'
82-
self._serialize = Serializer(client_models)
83-
self._deserialize = Deserializer(client_models)
84-
85-
self.record_sets = RecordSetsOperations(
86-
self._client, self.config, self._serialize, self._deserialize)
87-
self.zones = ZonesOperations(
88-
self._client, self.config, self._serialize, self._deserialize)
90+
super(DnsManagementClient, self).__init__(
91+
credentials,
92+
self.config,
93+
api_version=api_version,
94+
profile=profile
95+
)
96+
97+
############ Generated from here ############
98+
99+
@classmethod
100+
def _models_dict(cls, api_version):
101+
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
102+
103+
@classmethod
104+
def models(cls, api_version=DEFAULT_API_VERSION):
105+
"""Module depends on the API version:
106+
107+
* 2016-04-01: :mod:`v2016_04_01.models<azure.mgmt.dns.v2016_04_01.models>`
108+
* 2018-03-01-preview: :mod:`v2018_03_01_preview.models<azure.mgmt.dns.v2018_03_01_preview.models>`
109+
"""
110+
if api_version == '2016-04-01':
111+
from .v2016_04_01 import models
112+
return models
113+
elif api_version == '2018-03-01-preview':
114+
from .v2018_03_01_preview import models
115+
return models
116+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
117+
118+
@property
119+
def record_sets(self):
120+
"""Instance depends on the API version:
121+
122+
* 2016-04-01: :class:`RecordSetsOperations<azure.mgmt.dns.v2016_04_01.operations.RecordSetsOperations>`
123+
* 2018-03-01-preview: :class:`RecordSetsOperations<azure.mgmt.dns.v2018_03_01_preview.operations.RecordSetsOperations>`
124+
"""
125+
api_version = self._get_api_version('record_sets')
126+
if api_version == '2016-04-01':
127+
from .v2016_04_01.operations import RecordSetsOperations as OperationClass
128+
elif api_version == '2018-03-01-preview':
129+
from .v2018_03_01_preview.operations import RecordSetsOperations as OperationClass
130+
else:
131+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
132+
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
133+
134+
@property
135+
def zones(self):
136+
"""Instance depends on the API version:
137+
138+
* 2016-04-01: :class:`ZonesOperations<azure.mgmt.dns.v2016_04_01.operations.ZonesOperations>`
139+
* 2018-03-01-preview: :class:`ZonesOperations<azure.mgmt.dns.v2018_03_01_preview.operations.ZonesOperations>`
140+
"""
141+
api_version = self._get_api_version('zones')
142+
if api_version == '2016-04-01':
143+
from .v2016_04_01.operations import ZonesOperations as OperationClass
144+
elif api_version == '2018-03-01-preview':
145+
from .v2018_03_01_preview.operations import ZonesOperations as OperationClass
146+
else:
147+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
148+
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
+7
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 .v2018_03_01_preview.models import *

azure-mgmt-dns/azure/mgmt/dns/models/__init__.py

-56
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 .dns_management_client import DnsManagementClient
13+
from .version import VERSION
14+
15+
__all__ = ['DnsManagementClient']
16+
17+
__version__ = VERSION
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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 msrest.service_client import SDKClient
13+
from msrest import Serializer, Deserializer
14+
from msrestazure import AzureConfiguration
15+
from .version import VERSION
16+
from .operations.record_sets_operations import RecordSetsOperations
17+
from .operations.zones_operations import ZonesOperations
18+
from . import models
19+
20+
21+
class DnsManagementClientConfiguration(AzureConfiguration):
22+
"""Configuration for DnsManagementClient
23+
Note that all parameters used to create this instance are saved as instance
24+
attributes.
25+
26+
:param credentials: Credentials needed for the client to connect to Azure.
27+
:type credentials: :mod:`A msrestazure Credentials
28+
object<msrestazure.azure_active_directory>`
29+
:param subscription_id: Specifies the Azure subscription ID, which
30+
uniquely identifies the Microsoft Azure subscription.
31+
:type subscription_id: str
32+
:param str base_url: Service URL
33+
"""
34+
35+
def __init__(
36+
self, credentials, subscription_id, base_url=None):
37+
38+
if credentials is None:
39+
raise ValueError("Parameter 'credentials' must not be None.")
40+
if subscription_id is None:
41+
raise ValueError("Parameter 'subscription_id' must not be None.")
42+
if not base_url:
43+
base_url = 'https://management.azure.com'
44+
45+
super(DnsManagementClientConfiguration, self).__init__(base_url)
46+
47+
self.add_user_agent('azure-mgmt-dns/{}'.format(VERSION))
48+
self.add_user_agent('Azure-SDK-For-Python')
49+
50+
self.credentials = credentials
51+
self.subscription_id = subscription_id
52+
53+
54+
class DnsManagementClient(SDKClient):
55+
"""The DNS Management Client.
56+
57+
:ivar config: Configuration for client.
58+
:vartype config: DnsManagementClientConfiguration
59+
60+
:ivar record_sets: RecordSets operations
61+
:vartype record_sets: azure.mgmt.dns.v2016_04_01.operations.RecordSetsOperations
62+
:ivar zones: Zones operations
63+
:vartype zones: azure.mgmt.dns.v2016_04_01.operations.ZonesOperations
64+
65+
:param credentials: Credentials needed for the client to connect to Azure.
66+
:type credentials: :mod:`A msrestazure Credentials
67+
object<msrestazure.azure_active_directory>`
68+
:param subscription_id: Specifies the Azure subscription ID, which
69+
uniquely identifies the Microsoft Azure subscription.
70+
:type subscription_id: str
71+
:param str base_url: Service URL
72+
"""
73+
74+
def __init__(
75+
self, credentials, subscription_id, base_url=None):
76+
77+
self.config = DnsManagementClientConfiguration(credentials, subscription_id, base_url)
78+
super(DnsManagementClient, self).__init__(self.config.credentials, self.config)
79+
80+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
81+
self.api_version = '2016-04-01'
82+
self._serialize = Serializer(client_models)
83+
self._deserialize = Deserializer(client_models)
84+
85+
self.record_sets = RecordSetsOperations(
86+
self._client, self.config, self._serialize, self._deserialize)
87+
self.zones = ZonesOperations(
88+
self._client, self.config, self._serialize, self._deserialize)

0 commit comments

Comments
 (0)