Skip to content

Commit 43d2f07

Browse files
author
SDKAuto
committed
CodeGen from PR 17518 in Azure/azure-rest-api-specs
Merge e3bd25fbff4c01840ee35a27af6b0480605eabcd into 5582a35
1 parent 0ef48ce commit 43d2f07

File tree

64 files changed

+17966
-19953
lines changed

Some content is hidden

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

64 files changed

+17966
-19953
lines changed

sdk/cdn/azure-mgmt-cdn/_meta.json

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

sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/__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__ = ['CdnManagementClient']
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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_cdn_management_client.py

Lines changed: 82 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,24 @@
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 CdnManagementClientConfiguration
18+
from .operations import AFDCustomDomainsOperations, AFDEndpointsOperations, AFDOriginGroupsOperations, AFDOriginsOperations, AFDProfilesOperations, CdnManagementClientOperationsMixin, CustomDomainsOperations, EdgeNodesOperations, EndpointsOperations, LogAnalyticsOperations, ManagedRuleSetsOperations, Operations, OriginGroupsOperations, OriginsOperations, PoliciesOperations, ProfilesOperations, ResourceUsageOperations, RoutesOperations, RuleSetsOperations, RulesOperations, SecretsOperations, SecurityPoliciesOperations, ValidateOperations
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 CdnManagementClientConfiguration
21-
from .operations import ProfilesOperations
22-
from .operations import EndpointsOperations
23-
from .operations import OriginsOperations
24-
from .operations import OriginGroupsOperations
25-
from .operations import CustomDomainsOperations
26-
from .operations import CdnManagementClientOperationsMixin
27-
from .operations import ResourceUsageOperations
28-
from .operations import Operations
29-
from .operations import EdgeNodesOperations
30-
from .operations import AFDProfilesOperations
31-
from .operations import AFDCustomDomainsOperations
32-
from .operations import AFDEndpointsOperations
33-
from .operations import AFDOriginGroupsOperations
34-
from .operations import AFDOriginsOperations
35-
from .operations import RoutesOperations
36-
from .operations import RuleSetsOperations
37-
from .operations import RulesOperations
38-
from .operations import SecurityPoliciesOperations
39-
from .operations import SecretsOperations
40-
from .operations import ValidateOperations
41-
from .operations import LogAnalyticsOperations
42-
from .operations import PoliciesOperations
43-
from .operations import ManagedRuleSetsOperations
44-
from . import models
45-
46-
4724
class CdnManagementClient(CdnManagementClientOperationsMixin):
4825
"""Cdn Management Client.
4926
50-
:ivar profiles: ProfilesOperations operations
51-
:vartype profiles: azure.mgmt.cdn.operations.ProfilesOperations
52-
:ivar endpoints: EndpointsOperations operations
53-
:vartype endpoints: azure.mgmt.cdn.operations.EndpointsOperations
54-
:ivar origins: OriginsOperations operations
55-
:vartype origins: azure.mgmt.cdn.operations.OriginsOperations
56-
:ivar origin_groups: OriginGroupsOperations operations
57-
:vartype origin_groups: azure.mgmt.cdn.operations.OriginGroupsOperations
58-
:ivar custom_domains: CustomDomainsOperations operations
59-
:vartype custom_domains: azure.mgmt.cdn.operations.CustomDomainsOperations
60-
:ivar resource_usage: ResourceUsageOperations operations
61-
:vartype resource_usage: azure.mgmt.cdn.operations.ResourceUsageOperations
62-
:ivar operations: Operations operations
63-
:vartype operations: azure.mgmt.cdn.operations.Operations
64-
:ivar edge_nodes: EdgeNodesOperations operations
65-
:vartype edge_nodes: azure.mgmt.cdn.operations.EdgeNodesOperations
6627
:ivar afd_profiles: AFDProfilesOperations operations
6728
:vartype afd_profiles: azure.mgmt.cdn.operations.AFDProfilesOperations
6829
:ivar afd_custom_domains: AFDCustomDomainsOperations operations
@@ -87,6 +48,22 @@ class CdnManagementClient(CdnManagementClientOperationsMixin):
8748
:vartype validate: azure.mgmt.cdn.operations.ValidateOperations
8849
:ivar log_analytics: LogAnalyticsOperations operations
8950
:vartype log_analytics: azure.mgmt.cdn.operations.LogAnalyticsOperations
51+
:ivar profiles: ProfilesOperations operations
52+
:vartype profiles: azure.mgmt.cdn.operations.ProfilesOperations
53+
:ivar endpoints: EndpointsOperations operations
54+
:vartype endpoints: azure.mgmt.cdn.operations.EndpointsOperations
55+
:ivar origins: OriginsOperations operations
56+
:vartype origins: azure.mgmt.cdn.operations.OriginsOperations
57+
:ivar origin_groups: OriginGroupsOperations operations
58+
:vartype origin_groups: azure.mgmt.cdn.operations.OriginGroupsOperations
59+
:ivar custom_domains: CustomDomainsOperations operations
60+
:vartype custom_domains: azure.mgmt.cdn.operations.CustomDomainsOperations
61+
:ivar resource_usage: ResourceUsageOperations operations
62+
:vartype resource_usage: azure.mgmt.cdn.operations.ResourceUsageOperations
63+
:ivar operations: Operations operations
64+
:vartype operations: azure.mgmt.cdn.operations.Operations
65+
:ivar edge_nodes: EdgeNodesOperations operations
66+
:vartype edge_nodes: azure.mgmt.cdn.operations.EdgeNodesOperations
9067
:ivar policies: PoliciesOperations operations
9168
:vartype policies: azure.mgmt.cdn.operations.PoliciesOperations
9269
:ivar managed_rule_sets: ManagedRuleSetsOperations operations
@@ -95,72 +72,75 @@ class CdnManagementClient(CdnManagementClientOperationsMixin):
9572
:type credential: ~azure.core.credentials.TokenCredential
9673
:param subscription_id: Azure Subscription ID.
9774
:type subscription_id: str
98-
:param str base_url: Service URL
99-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
75+
:param base_url: Service URL. Default value is 'https://management.azure.com'.
76+
:type base_url: str
77+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
78+
Retry-After header is present.
10079
"""
10180

10281
def __init__(
10382
self,
104-
credential, # type: "TokenCredential"
105-
subscription_id, # type: str
106-
base_url=None, # type: Optional[str]
107-
**kwargs # type: Any
108-
):
109-
# type: (...) -> None
110-
if not base_url:
111-
base_url = 'https://management.azure.com'
112-
self._config = CdnManagementClientConfiguration(credential, subscription_id, **kwargs)
83+
credential: "TokenCredential",
84+
subscription_id: str,
85+
base_url: str = "https://management.azure.com",
86+
**kwargs: Any
87+
) -> None:
88+
self._config = CdnManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
11389
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
11490

11591
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
11692
self._serialize = Serializer(client_models)
117-
self._serialize.client_side_validation = False
11893
self._deserialize = Deserializer(client_models)
94+
self._serialize.client_side_validation = False
95+
self.afd_profiles = AFDProfilesOperations(self._client, self._config, self._serialize, self._deserialize)
96+
self.afd_custom_domains = AFDCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize)
97+
self.afd_endpoints = AFDEndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
98+
self.afd_origin_groups = AFDOriginGroupsOperations(self._client, self._config, self._serialize, self._deserialize)
99+
self.afd_origins = AFDOriginsOperations(self._client, self._config, self._serialize, self._deserialize)
100+
self.routes = RoutesOperations(self._client, self._config, self._serialize, self._deserialize)
101+
self.rule_sets = RuleSetsOperations(self._client, self._config, self._serialize, self._deserialize)
102+
self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize)
103+
self.security_policies = SecurityPoliciesOperations(self._client, self._config, self._serialize, self._deserialize)
104+
self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize)
105+
self.validate = ValidateOperations(self._client, self._config, self._serialize, self._deserialize)
106+
self.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize)
107+
self.profiles = ProfilesOperations(self._client, self._config, self._serialize, self._deserialize)
108+
self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
109+
self.origins = OriginsOperations(self._client, self._config, self._serialize, self._deserialize)
110+
self.origin_groups = OriginGroupsOperations(self._client, self._config, self._serialize, self._deserialize)
111+
self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize)
112+
self.resource_usage = ResourceUsageOperations(self._client, self._config, self._serialize, self._deserialize)
113+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
114+
self.edge_nodes = EdgeNodesOperations(self._client, self._config, self._serialize, self._deserialize)
115+
self.policies = PoliciesOperations(self._client, self._config, self._serialize, self._deserialize)
116+
self.managed_rule_sets = ManagedRuleSetsOperations(self._client, self._config, self._serialize, self._deserialize)
117+
118+
119+
def _send_request(
120+
self,
121+
request, # type: HttpRequest
122+
**kwargs: Any
123+
) -> HttpResponse:
124+
"""Runs the network request through the client's chained policies.
125+
126+
>>> from azure.core.rest import HttpRequest
127+
>>> request = HttpRequest("GET", "https://www.example.org/")
128+
<HttpRequest [GET], url: 'https://www.example.org/'>
129+
>>> response = client._send_request(request)
130+
<HttpResponse: 200 OK>
131+
132+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
133+
134+
:param request: The network request you want to make. Required.
135+
:type request: ~azure.core.rest.HttpRequest
136+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
137+
:return: The response of your network call. Does not do error handling on your response.
138+
:rtype: ~azure.core.rest.HttpResponse
139+
"""
119140

120-
self.profiles = ProfilesOperations(
121-
self._client, self._config, self._serialize, self._deserialize)
122-
self.endpoints = EndpointsOperations(
123-
self._client, self._config, self._serialize, self._deserialize)
124-
self.origins = OriginsOperations(
125-
self._client, self._config, self._serialize, self._deserialize)
126-
self.origin_groups = OriginGroupsOperations(
127-
self._client, self._config, self._serialize, self._deserialize)
128-
self.custom_domains = CustomDomainsOperations(
129-
self._client, self._config, self._serialize, self._deserialize)
130-
self.resource_usage = ResourceUsageOperations(
131-
self._client, self._config, self._serialize, self._deserialize)
132-
self.operations = Operations(
133-
self._client, self._config, self._serialize, self._deserialize)
134-
self.edge_nodes = EdgeNodesOperations(
135-
self._client, self._config, self._serialize, self._deserialize)
136-
self.afd_profiles = AFDProfilesOperations(
137-
self._client, self._config, self._serialize, self._deserialize)
138-
self.afd_custom_domains = AFDCustomDomainsOperations(
139-
self._client, self._config, self._serialize, self._deserialize)
140-
self.afd_endpoints = AFDEndpointsOperations(
141-
self._client, self._config, self._serialize, self._deserialize)
142-
self.afd_origin_groups = AFDOriginGroupsOperations(
143-
self._client, self._config, self._serialize, self._deserialize)
144-
self.afd_origins = AFDOriginsOperations(
145-
self._client, self._config, self._serialize, self._deserialize)
146-
self.routes = RoutesOperations(
147-
self._client, self._config, self._serialize, self._deserialize)
148-
self.rule_sets = RuleSetsOperations(
149-
self._client, self._config, self._serialize, self._deserialize)
150-
self.rules = RulesOperations(
151-
self._client, self._config, self._serialize, self._deserialize)
152-
self.security_policies = SecurityPoliciesOperations(
153-
self._client, self._config, self._serialize, self._deserialize)
154-
self.secrets = SecretsOperations(
155-
self._client, self._config, self._serialize, self._deserialize)
156-
self.validate = ValidateOperations(
157-
self._client, self._config, self._serialize, self._deserialize)
158-
self.log_analytics = LogAnalyticsOperations(
159-
self._client, self._config, self._serialize, self._deserialize)
160-
self.policies = PoliciesOperations(
161-
self._client, self._config, self._serialize, self._deserialize)
162-
self.managed_rule_sets = ManagedRuleSetsOperations(
163-
self._client, self._config, self._serialize, self._deserialize)
141+
request_copy = deepcopy(request)
142+
request_copy.url = self._client.format_url(request_copy.url)
143+
return self._client.send_request(request_copy, **kwargs)
164144

165145
def close(self):
166146
# type: () -> None

sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_configuration.py

Lines changed: 9 additions & 12 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,20 +33,19 @@ class CdnManagementClientConfiguration(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(CdnManagementClientConfiguration, 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(CdnManagementClientConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
51-
self.api_version = "2020-09-01"
48+
self.api_version = "2021-06-01"
5249
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
5350
kwargs.setdefault('sdk_moniker', 'mgmt-cdn/{}'.format(VERSION))
5451
self._configure(**kwargs)
@@ -68,4 +65,4 @@ def _configure(
6865
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6966
self.authentication_policy = kwargs.get('authentication_policy')
7067
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
68+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

0 commit comments

Comments
 (0)