Skip to content

Commit fb3e04b

Browse files
author
SDKAuto
committed
CodeGen from PR 12831 in Azure/azure-rest-api-specs
[T2] python track2 config for frontdoor (Azure#12831) * add python track2 config for frontdoor * fix
1 parent 8622843 commit fb3e04b

Some content is hidden

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

41 files changed

+11817
-4184
lines changed
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)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"chosen_version": "",
3+
"total_api_version_list": ["2019-11-01", "2020-05-01", "2020-11-01"],
4+
"client": {
5+
"name": "FrontDoorManagementClient",
6+
"filename": "_front_door_management_client",
7+
"description": "FrontDoor Client.",
8+
"base_url": "\u0027https://management.azure.com\u0027",
9+
"custom_base_url": null,
10+
"azure_arm": true,
11+
"has_lro_operations": true,
12+
"client_side_validation": true
13+
},
14+
"global_parameters": {
15+
"sync": {
16+
"credential": {
17+
"signature": "credential, # type: \"TokenCredential\"",
18+
"description": "Credential needed for the client to connect to Azure.",
19+
"docstring_type": "~azure.core.credentials.TokenCredential",
20+
"required": true
21+
},
22+
"subscription_id": {
23+
"signature": "subscription_id, # type: str",
24+
"description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
25+
"docstring_type": "str",
26+
"required": true
27+
}
28+
},
29+
"async": {
30+
"credential": {
31+
"signature": "credential, # type: \"AsyncTokenCredential\"",
32+
"description": "Credential needed for the client to connect to Azure.",
33+
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
34+
"required": true
35+
},
36+
"subscription_id": {
37+
"signature": "subscription_id, # type: str",
38+
"description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
39+
"docstring_type": "str",
40+
"required": true
41+
}
42+
},
43+
"constant": {
44+
},
45+
"call": "credential, subscription_id"
46+
},
47+
"config": {
48+
"credential": true,
49+
"credential_scopes": ["https://management.azure.com/.default"],
50+
"credential_default_policy_type": "BearerTokenCredentialPolicy",
51+
"credential_default_policy_type_has_async_version": true,
52+
"credential_key_header_name": null
53+
},
54+
"operation_groups": {
55+
"network_experiment_profiles": "NetworkExperimentProfilesOperations",
56+
"preconfigured_endpoints": "PreconfiguredEndpointsOperations",
57+
"experiments": "ExperimentsOperations",
58+
"reports": "ReportsOperations",
59+
"front_door_name_availability": "FrontDoorNameAvailabilityOperations",
60+
"front_door_name_availability_with_subscription": "FrontDoorNameAvailabilityWithSubscriptionOperations",
61+
"front_doors": "FrontDoorsOperations",
62+
"frontend_endpoints": "FrontendEndpointsOperations",
63+
"endpoints": "EndpointsOperations",
64+
"rules_engines": "RulesEnginesOperations",
65+
"policies": "PoliciesOperations",
66+
"managed_rule_sets": "ManagedRuleSetsOperations"
67+
},
68+
"operation_mixins": {
69+
},
70+
"sync_imports": "None",
71+
"async_imports": "None"
72+
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
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-
VERSION = "0.3.0"
13-
9+
VERSION = "0.1.0"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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 license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from ._front_door_management_client import FrontDoorManagementClient
10+
__all__ = ['FrontDoorManagementClient']

0 commit comments

Comments
 (0)