Skip to content

Commit 2fd38a0

Browse files
author
SDKAuto
committed
CodeGen from PR 18208 in Azure/azure-rest-api-specs
Merge 4772ab9f3e13afc920d577bea23077ec30e32528 into 2abe647120f14bb145968a5543ead8ed51394498
1 parent 14ff5a8 commit 2fd38a0

40 files changed

+5410
-7049
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": "d6191d641c750189751bde4466749fa589265abc",
8+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9+
"autorest_command": "autorest specification/frontdoor/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/frontdoor/resource-manager/readme.md"
11+
}

sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
__version__ = VERSION
1313
__all__ = ['FrontDoorManagementClient']
1414

15-
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
18-
except ImportError:
19-
pass
15+
# `._patch.py` is used for handwritten extensions to the generated code
16+
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17+
from ._patch import patch_sdk
18+
patch_sdk()

sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_configuration.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
13+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1414

1515
from ._version import VERSION
1616

1717
if TYPE_CHECKING:
1818
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2119
from azure.core.credentials import TokenCredential
2220

2321

@@ -35,16 +33,15 @@ class FrontDoorManagementClientConfiguration(Configuration):
3533

3634
def __init__(
3735
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
36+
credential: "TokenCredential",
37+
subscription_id: str,
38+
**kwargs: Any
39+
) -> None:
40+
super(FrontDoorManagementClientConfiguration, self).__init__(**kwargs)
4341
if credential is None:
4442
raise ValueError("Parameter 'credential' must not be None.")
4543
if subscription_id is None:
4644
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(FrontDoorManagementClientConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
@@ -67,4 +64,4 @@ def _configure(
6764
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6865
self.authentication_policy = kwargs.get('authentication_policy')
6966
if self.credential and not self.authentication_policy:
70-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_front_door_management_client.py

Lines changed: 69 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,41 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from copy import deepcopy
10+
from typing import Any, Optional, TYPE_CHECKING
1011

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
1214
from msrest import Deserializer, Serializer
1315

16+
from . import models
17+
from ._configuration import FrontDoorManagementClientConfiguration
18+
from .operations import EndpointsOperations, ExperimentsOperations, FrontDoorNameAvailabilityOperations, FrontDoorNameAvailabilityWithSubscriptionOperations, FrontDoorsOperations, FrontendEndpointsOperations, ManagedRuleSetsOperations, NetworkExperimentProfilesOperations, PoliciesOperations, PreconfiguredEndpointsOperations, ReportsOperations, RulesEnginesOperations
19+
1420
if TYPE_CHECKING:
1521
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1822
from azure.core.credentials import TokenCredential
1923

20-
from ._configuration import FrontDoorManagementClientConfiguration
21-
from .operations import NetworkExperimentProfilesOperations
22-
from .operations import PreconfiguredEndpointsOperations
23-
from .operations import ExperimentsOperations
24-
from .operations import ReportsOperations
25-
from .operations import FrontDoorNameAvailabilityOperations
26-
from .operations import FrontDoorNameAvailabilityWithSubscriptionOperations
27-
from .operations import FrontDoorsOperations
28-
from .operations import FrontendEndpointsOperations
29-
from .operations import EndpointsOperations
30-
from .operations import RulesEnginesOperations
31-
from .operations import PoliciesOperations
32-
from .operations import ManagedRuleSetsOperations
33-
from . import models
34-
35-
36-
class FrontDoorManagementClient(object):
24+
class FrontDoorManagementClient:
3725
"""FrontDoor Client.
3826
3927
:ivar network_experiment_profiles: NetworkExperimentProfilesOperations operations
40-
:vartype network_experiment_profiles: azure.mgmt.frontdoor.operations.NetworkExperimentProfilesOperations
28+
:vartype network_experiment_profiles:
29+
azure.mgmt.frontdoor.operations.NetworkExperimentProfilesOperations
4130
:ivar preconfigured_endpoints: PreconfiguredEndpointsOperations operations
42-
:vartype preconfigured_endpoints: azure.mgmt.frontdoor.operations.PreconfiguredEndpointsOperations
31+
:vartype preconfigured_endpoints:
32+
azure.mgmt.frontdoor.operations.PreconfiguredEndpointsOperations
4333
:ivar experiments: ExperimentsOperations operations
4434
:vartype experiments: azure.mgmt.frontdoor.operations.ExperimentsOperations
4535
:ivar reports: ReportsOperations operations
4636
:vartype reports: azure.mgmt.frontdoor.operations.ReportsOperations
4737
: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
38+
:vartype front_door_name_availability:
39+
azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityOperations
40+
:ivar front_door_name_availability_with_subscription:
41+
FrontDoorNameAvailabilityWithSubscriptionOperations operations
42+
:vartype front_door_name_availability_with_subscription:
43+
azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityWithSubscriptionOperations
5144
:ivar front_doors: FrontDoorsOperations operations
5245
:vartype front_doors: azure.mgmt.frontdoor.operations.FrontDoorsOperations
5346
:ivar frontend_endpoints: FrontendEndpointsOperations operations
@@ -62,54 +55,68 @@ class FrontDoorManagementClient(object):
6255
:vartype managed_rule_sets: azure.mgmt.frontdoor.operations.ManagedRuleSetsOperations
6356
:param credential: Credential needed for the client to connect to Azure.
6457
: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.
58+
:param subscription_id: The subscription credentials which uniquely identify the Microsoft
59+
Azure subscription. The subscription ID forms part of the URI for every service call.
6660
:type subscription_id: str
67-
: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.
61+
:param base_url: Service URL. Default value is 'https://management.azure.com'.
62+
:type base_url: str
63+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
64+
Retry-After header is present.
6965
"""
7066

7167
def __init__(
7268
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)
69+
credential: "TokenCredential",
70+
subscription_id: str,
71+
base_url: str = "https://management.azure.com",
72+
**kwargs: Any
73+
) -> None:
74+
self._config = FrontDoorManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
8275
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
8376

8477
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
8578
self._serialize = Serializer(client_models)
86-
self._serialize.client_side_validation = False
8779
self._deserialize = Deserializer(client_models)
80+
self._serialize.client_side_validation = False
81+
self.network_experiment_profiles = NetworkExperimentProfilesOperations(self._client, self._config, self._serialize, self._deserialize)
82+
self.preconfigured_endpoints = PreconfiguredEndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
83+
self.experiments = ExperimentsOperations(self._client, self._config, self._serialize, self._deserialize)
84+
self.reports = ReportsOperations(self._client, self._config, self._serialize, self._deserialize)
85+
self.front_door_name_availability = FrontDoorNameAvailabilityOperations(self._client, self._config, self._serialize, self._deserialize)
86+
self.front_door_name_availability_with_subscription = FrontDoorNameAvailabilityWithSubscriptionOperations(self._client, self._config, self._serialize, self._deserialize)
87+
self.front_doors = FrontDoorsOperations(self._client, self._config, self._serialize, self._deserialize)
88+
self.frontend_endpoints = FrontendEndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
89+
self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
90+
self.rules_engines = RulesEnginesOperations(self._client, self._config, self._serialize, self._deserialize)
91+
self.policies = PoliciesOperations(self._client, self._config, self._serialize, self._deserialize)
92+
self.managed_rule_sets = ManagedRuleSetsOperations(self._client, self._config, self._serialize, self._deserialize)
93+
94+
95+
def _send_request(
96+
self,
97+
request, # type: HttpRequest
98+
**kwargs: Any
99+
) -> HttpResponse:
100+
"""Runs the network request through the client's chained policies.
101+
102+
>>> from azure.core.rest import HttpRequest
103+
>>> request = HttpRequest("GET", "https://www.example.org/")
104+
<HttpRequest [GET], url: 'https://www.example.org/'>
105+
>>> response = client._send_request(request)
106+
<HttpResponse: 200 OK>
107+
108+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
109+
110+
:param request: The network request you want to make. Required.
111+
:type request: ~azure.core.rest.HttpRequest
112+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
113+
:return: The response of your network call. Does not do error handling on your response.
114+
:rtype: ~azure.core.rest.HttpResponse
115+
"""
88116

89-
self.network_experiment_profiles = NetworkExperimentProfilesOperations(
90-
self._client, self._config, self._serialize, self._deserialize)
91-
self.preconfigured_endpoints = PreconfiguredEndpointsOperations(
92-
self._client, self._config, self._serialize, self._deserialize)
93-
self.experiments = ExperimentsOperations(
94-
self._client, self._config, self._serialize, self._deserialize)
95-
self.reports = ReportsOperations(
96-
self._client, self._config, self._serialize, self._deserialize)
97-
self.front_door_name_availability = FrontDoorNameAvailabilityOperations(
98-
self._client, self._config, self._serialize, self._deserialize)
99-
self.front_door_name_availability_with_subscription = FrontDoorNameAvailabilityWithSubscriptionOperations(
100-
self._client, self._config, self._serialize, self._deserialize)
101-
self.front_doors = FrontDoorsOperations(
102-
self._client, self._config, self._serialize, self._deserialize)
103-
self.frontend_endpoints = FrontendEndpointsOperations(
104-
self._client, self._config, self._serialize, self._deserialize)
105-
self.endpoints = EndpointsOperations(
106-
self._client, self._config, self._serialize, self._deserialize)
107-
self.rules_engines = RulesEnginesOperations(
108-
self._client, self._config, self._serialize, self._deserialize)
109-
self.policies = PoliciesOperations(
110-
self._client, self._config, self._serialize, self._deserialize)
111-
self.managed_rule_sets = ManagedRuleSetsOperations(
112-
self._client, self._config, self._serialize, self._deserialize)
117+
request_copy = deepcopy(request)
118+
request_copy.url = self._client.format_url(request_copy.url)
119+
return self._client.send_request(request_copy, **kwargs)
113120

114121
def close(self):
115122
# type: () -> None

sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_metadata.json

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
"name": "FrontDoorManagementClient",
66
"filename": "_front_door_management_client",
77
"description": "FrontDoor Client.",
8-
"base_url": "\u0027https://management.azure.com\u0027",
9-
"custom_base_url": null,
8+
"host_value": "\"https://management.azure.com\"",
9+
"parameterized_host_template": null,
1010
"azure_arm": true,
1111
"has_lro_operations": true,
12-
"client_side_validation": false
12+
"client_side_validation": false,
13+
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"FrontDoorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
14+
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"FrontDoorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
1315
},
1416
"global_parameters": {
1517
"sync": {
@@ -28,28 +30,71 @@
2830
},
2931
"async": {
3032
"credential": {
31-
"signature": "credential, # type: \"AsyncTokenCredential\"",
33+
"signature": "credential: \"AsyncTokenCredential\",",
3234
"description": "Credential needed for the client to connect to Azure.",
3335
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
3436
"required": true
3537
},
3638
"subscription_id": {
37-
"signature": "subscription_id, # type: str",
39+
"signature": "subscription_id: str,",
3840
"description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
3941
"docstring_type": "str",
4042
"required": true
4143
}
4244
},
4345
"constant": {
4446
},
45-
"call": "credential, subscription_id"
47+
"call": "credential, subscription_id",
48+
"service_client_specific": {
49+
"sync": {
50+
"api_version": {
51+
"signature": "api_version=None, # type: Optional[str]",
52+
"description": "API version to use if no profile is provided, or if missing in profile.",
53+
"docstring_type": "str",
54+
"required": false
55+
},
56+
"base_url": {
57+
"signature": "base_url=\"https://management.azure.com\", # type: str",
58+
"description": "Service URL",
59+
"docstring_type": "str",
60+
"required": false
61+
},
62+
"profile": {
63+
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
64+
"description": "A profile definition, from KnownProfiles to dict.",
65+
"docstring_type": "azure.profiles.KnownProfiles",
66+
"required": false
67+
}
68+
},
69+
"async": {
70+
"api_version": {
71+
"signature": "api_version: Optional[str] = None,",
72+
"description": "API version to use if no profile is provided, or if missing in profile.",
73+
"docstring_type": "str",
74+
"required": false
75+
},
76+
"base_url": {
77+
"signature": "base_url: str = \"https://management.azure.com\",",
78+
"description": "Service URL",
79+
"docstring_type": "str",
80+
"required": false
81+
},
82+
"profile": {
83+
"signature": "profile: KnownProfiles = KnownProfiles.default,",
84+
"description": "A profile definition, from KnownProfiles to dict.",
85+
"docstring_type": "azure.profiles.KnownProfiles",
86+
"required": false
87+
}
88+
}
89+
}
4690
},
4791
"config": {
4892
"credential": true,
4993
"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
94+
"credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
95+
"credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
96+
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
97+
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
5398
},
5499
"operation_groups": {
55100
"network_experiment_profiles": "NetworkExperimentProfilesOperations",
@@ -64,9 +109,5 @@
64109
"rules_engines": "RulesEnginesOperations",
65110
"policies": "PoliciesOperations",
66111
"managed_rule_sets": "ManagedRuleSetsOperations"
67-
},
68-
"operation_mixins": {
69-
},
70-
"sync_imports": "None",
71-
"async_imports": "None"
112+
}
72113
}

0 commit comments

Comments
 (0)