Skip to content

Commit 7d02c7b

Browse files
00Kai0SDKAuto
and
SDKAuto
authored
T2 frontdoor 2021 02 09 (#16628)
* CodeGen from PR 12831 in Azure/azure-rest-api-specs [T2] python track2 config for frontdoor (#12831) * add python track2 config for frontdoor * fix * test,version,CHANGELOG * fix changelog and version Co-authored-by: SDKAuto <[email protected]>
1 parent c032c0c commit 7d02c7b

Some content is hidden

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

44 files changed

+11858
-4189
lines changed

sdk/network/azure-mgmt-frontdoor/CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# Release History
22

3+
## 1.0.0b1 (2021-02-09)
4+
5+
This is beta preview version.
6+
For detailed changelog please refer to equivalent stable version 10.2.0 (https://pypi.org/project/azure-mgmt-network/10.2.0/)
7+
8+
This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming).
9+
10+
**General breaking changes**
11+
12+
- Credential system has been completly revamped:
13+
14+
- `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/
15+
- `credentials` parameter has been renamed `credential`
16+
17+
- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of
18+
supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies)
19+
- You can't import a `version` module anymore, use `__version__` instead
20+
- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`.
21+
- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed).
22+
- Most of the operation kwarg have changed. Some of the most noticeable:
23+
24+
- `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user
25+
- For a complete set of
26+
supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies)
27+
28+
**General new features**
29+
30+
- Type annotations support using `typing`. SDKs are mypy ready.
31+
- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client.
32+
- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview.
33+
34+
335
## 0.3.0 (2019-10-11)
436

537
- Fixed new network experiment SDK structure

sdk/network/azure-mgmt-frontdoor/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ library.
1414
For a more complete set of Azure libraries, see the
1515
[azure sdk python release](https://aka.ms/azsdk/python/all).
1616

17-
## Usage
17+
# Usage
1818

19-
For code examples, see [Front Door
20-
Service](https://docs.microsoft.com/python/api/overview/azure/) on
21-
docs.microsoft.com.
2219

20+
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
21+
22+
23+
24+
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
25+
Code samples for this package can be found at [Frontdoor Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
26+
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
2327
## Provide Feedback
2428

2529
If you encounter any bugs or have suggestions, please file an issue in
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# 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-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

12-
from ._configuration import FrontDoorManagementClientConfiguration
139
from ._front_door_management_client import FrontDoorManagementClient
14-
__all__ = ['FrontDoorManagementClient', 'FrontDoorManagementClientConfiguration']
15-
16-
from .version import VERSION
10+
from ._version import VERSION
1711

1812
__version__ = VERSION
13+
__all__ = ['FrontDoorManagementClient']
1914

15+
try:
16+
from ._patch import patch_sdk # type: ignore
17+
patch_sdk()
18+
except ImportError:
19+
pass
Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,70 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# 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-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
11-
from msrestazure import AzureConfiguration
128

13-
from .version import VERSION
9+
from typing import TYPE_CHECKING
1410

11+
from azure.core.configuration import Configuration
12+
from azure.core.pipeline import policies
13+
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
14+
15+
from ._version import VERSION
16+
17+
if TYPE_CHECKING:
18+
# pylint: disable=unused-import,ungrouped-imports
19+
from typing import Any
20+
21+
from azure.core.credentials import TokenCredential
22+
23+
24+
class FrontDoorManagementClientConfiguration(Configuration):
25+
"""Configuration for FrontDoorManagementClient.
1526
16-
class FrontDoorManagementClientConfiguration(AzureConfiguration):
17-
"""Configuration for FrontDoorManagementClient
1827
Note that all parameters used to create this instance are saved as instance
1928
attributes.
2029
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 credentials which uniquely
25-
identify the Microsoft Azure subscription. The subscription ID forms part
26-
of the URI for every service call.
30+
:param credential: Credential needed for the client to connect to Azure.
31+
:type credential: ~azure.core.credentials.TokenCredential
32+
:param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
2733
:type subscription_id: str
28-
:param str base_url: Service URL
2934
"""
3035

3136
def __init__(
32-
self, credentials, subscription_id, base_url=None):
33-
34-
if credentials is None:
35-
raise ValueError("Parameter 'credentials' must not be None.")
37+
self,
38+
credential, # type: "TokenCredential"
39+
subscription_id, # type: str
40+
**kwargs # type: Any
41+
):
42+
# type: (...) -> None
43+
if credential is None:
44+
raise ValueError("Parameter 'credential' must not be None.")
3645
if subscription_id is None:
3746
raise ValueError("Parameter 'subscription_id' must not be None.")
38-
if not base_url:
39-
base_url = 'https://management.azure.com'
40-
41-
super(FrontDoorManagementClientConfiguration, self).__init__(base_url)
42-
43-
# Starting Autorest.Python 4.0.64, make connection pool activated by default
44-
self.keep_alive = True
47+
super(FrontDoorManagementClientConfiguration, self).__init__(**kwargs)
4548

46-
self.add_user_agent('azure-mgmt-frontdoor/{}'.format(VERSION))
47-
self.add_user_agent('Azure-SDK-For-Python')
48-
49-
self.credentials = credentials
49+
self.credential = credential
5050
self.subscription_id = subscription_id
51+
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
52+
kwargs.setdefault('sdk_moniker', 'mgmt-frontdoor/{}'.format(VERSION))
53+
self._configure(**kwargs)
54+
55+
def _configure(
56+
self,
57+
**kwargs # type: Any
58+
):
59+
# type: (...) -> None
60+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
61+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
62+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
63+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
64+
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
65+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
66+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
67+
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
68+
self.authentication_policy = kwargs.get('authentication_policy')
69+
if self.credential and not self.authentication_policy:
70+
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Lines changed: 75 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,124 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# 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-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

12-
from msrest.service_client import SDKClient
13-
from msrest import Serializer, Deserializer
9+
from typing import TYPE_CHECKING
10+
11+
from azure.mgmt.core import ARMPipelineClient
12+
from msrest import Deserializer, Serializer
13+
14+
if TYPE_CHECKING:
15+
# pylint: disable=unused-import,ungrouped-imports
16+
from typing import Any, Optional
17+
18+
from azure.core.credentials import TokenCredential
1419

1520
from ._configuration import FrontDoorManagementClientConfiguration
16-
from .operations import FrontDoorManagementClientOperationsMixin
1721
from .operations import NetworkExperimentProfilesOperations
1822
from .operations import PreconfiguredEndpointsOperations
1923
from .operations import ExperimentsOperations
2024
from .operations import ReportsOperations
25+
from .operations import FrontDoorNameAvailabilityOperations
26+
from .operations import FrontDoorNameAvailabilityWithSubscriptionOperations
2127
from .operations import FrontDoorsOperations
2228
from .operations import FrontendEndpointsOperations
2329
from .operations import EndpointsOperations
30+
from .operations import RulesEnginesOperations
2431
from .operations import PoliciesOperations
2532
from .operations import ManagedRuleSetsOperations
2633
from . import models
2734

2835

29-
class FrontDoorManagementClient(FrontDoorManagementClientOperationsMixin, SDKClient):
30-
"""FrontDoor Client
36+
class FrontDoorManagementClient(object):
37+
"""FrontDoor Client.
3138
32-
:ivar config: Configuration for client.
33-
:vartype config: FrontDoorManagementClientConfiguration
34-
35-
:ivar network_experiment_profiles: NetworkExperimentProfiles operations
39+
:ivar network_experiment_profiles: NetworkExperimentProfilesOperations operations
3640
:vartype network_experiment_profiles: azure.mgmt.frontdoor.operations.NetworkExperimentProfilesOperations
37-
:ivar preconfigured_endpoints: PreconfiguredEndpoints operations
41+
:ivar preconfigured_endpoints: PreconfiguredEndpointsOperations operations
3842
:vartype preconfigured_endpoints: azure.mgmt.frontdoor.operations.PreconfiguredEndpointsOperations
39-
:ivar experiments: Experiments operations
43+
:ivar experiments: ExperimentsOperations operations
4044
:vartype experiments: azure.mgmt.frontdoor.operations.ExperimentsOperations
41-
:ivar reports: Reports operations
45+
:ivar reports: ReportsOperations operations
4246
:vartype reports: azure.mgmt.frontdoor.operations.ReportsOperations
43-
:ivar front_doors: FrontDoors operations
47+
:ivar front_door_name_availability: FrontDoorNameAvailabilityOperations operations
48+
:vartype front_door_name_availability: azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityOperations
49+
:ivar front_door_name_availability_with_subscription: FrontDoorNameAvailabilityWithSubscriptionOperations operations
50+
:vartype front_door_name_availability_with_subscription: azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityWithSubscriptionOperations
51+
:ivar front_doors: FrontDoorsOperations operations
4452
:vartype front_doors: azure.mgmt.frontdoor.operations.FrontDoorsOperations
45-
:ivar frontend_endpoints: FrontendEndpoints operations
53+
:ivar frontend_endpoints: FrontendEndpointsOperations operations
4654
:vartype frontend_endpoints: azure.mgmt.frontdoor.operations.FrontendEndpointsOperations
47-
:ivar endpoints: Endpoints operations
55+
:ivar endpoints: EndpointsOperations operations
4856
:vartype endpoints: azure.mgmt.frontdoor.operations.EndpointsOperations
49-
:ivar policies: Policies operations
57+
:ivar rules_engines: RulesEnginesOperations operations
58+
:vartype rules_engines: azure.mgmt.frontdoor.operations.RulesEnginesOperations
59+
:ivar policies: PoliciesOperations operations
5060
:vartype policies: azure.mgmt.frontdoor.operations.PoliciesOperations
51-
:ivar managed_rule_sets: ManagedRuleSets operations
61+
:ivar managed_rule_sets: ManagedRuleSetsOperations operations
5262
:vartype managed_rule_sets: azure.mgmt.frontdoor.operations.ManagedRuleSetsOperations
53-
54-
:param credentials: Credentials needed for the client to connect to Azure.
55-
:type credentials: :mod:`A msrestazure Credentials
56-
object<msrestazure.azure_active_directory>`
57-
:param subscription_id: The subscription credentials which uniquely
58-
identify the Microsoft Azure subscription. The subscription ID forms part
59-
of the URI for every service call.
63+
:param credential: Credential needed for the client to connect to Azure.
64+
:type credential: ~azure.core.credentials.TokenCredential
65+
:param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
6066
:type subscription_id: str
6167
:param str base_url: Service URL
68+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
6269
"""
6370

6471
def __init__(
65-
self, credentials, subscription_id, base_url=None):
66-
67-
self.config = FrontDoorManagementClientConfiguration(credentials, subscription_id, base_url)
68-
super(FrontDoorManagementClient, self).__init__(self.config.credentials, self.config)
72+
self,
73+
credential, # type: "TokenCredential"
74+
subscription_id, # type: str
75+
base_url=None, # type: Optional[str]
76+
**kwargs # type: Any
77+
):
78+
# type: (...) -> None
79+
if not base_url:
80+
base_url = 'https://management.azure.com'
81+
self._config = FrontDoorManagementClientConfiguration(credential, subscription_id, **kwargs)
82+
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6983

7084
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
7185
self._serialize = Serializer(client_models)
7286
self._deserialize = Deserializer(client_models)
7387

7488
self.network_experiment_profiles = NetworkExperimentProfilesOperations(
75-
self._client, self.config, self._serialize, self._deserialize)
89+
self._client, self._config, self._serialize, self._deserialize)
7690
self.preconfigured_endpoints = PreconfiguredEndpointsOperations(
77-
self._client, self.config, self._serialize, self._deserialize)
91+
self._client, self._config, self._serialize, self._deserialize)
7892
self.experiments = ExperimentsOperations(
79-
self._client, self.config, self._serialize, self._deserialize)
93+
self._client, self._config, self._serialize, self._deserialize)
8094
self.reports = ReportsOperations(
81-
self._client, self.config, self._serialize, self._deserialize)
95+
self._client, self._config, self._serialize, self._deserialize)
96+
self.front_door_name_availability = FrontDoorNameAvailabilityOperations(
97+
self._client, self._config, self._serialize, self._deserialize)
98+
self.front_door_name_availability_with_subscription = FrontDoorNameAvailabilityWithSubscriptionOperations(
99+
self._client, self._config, self._serialize, self._deserialize)
82100
self.front_doors = FrontDoorsOperations(
83-
self._client, self.config, self._serialize, self._deserialize)
101+
self._client, self._config, self._serialize, self._deserialize)
84102
self.frontend_endpoints = FrontendEndpointsOperations(
85-
self._client, self.config, self._serialize, self._deserialize)
103+
self._client, self._config, self._serialize, self._deserialize)
86104
self.endpoints = EndpointsOperations(
87-
self._client, self.config, self._serialize, self._deserialize)
105+
self._client, self._config, self._serialize, self._deserialize)
106+
self.rules_engines = RulesEnginesOperations(
107+
self._client, self._config, self._serialize, self._deserialize)
88108
self.policies = PoliciesOperations(
89-
self._client, self.config, self._serialize, self._deserialize)
109+
self._client, self._config, self._serialize, self._deserialize)
90110
self.managed_rule_sets = ManagedRuleSetsOperations(
91-
self._client, self.config, self._serialize, self._deserialize)
111+
self._client, self._config, self._serialize, self._deserialize)
112+
113+
def close(self):
114+
# type: () -> None
115+
self._client.close()
116+
117+
def __enter__(self):
118+
# type: () -> FrontDoorManagementClient
119+
self._client.__enter__()
120+
return self
121+
122+
def __exit__(self, *exc_details):
123+
# type: (Any) -> None
124+
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)