Skip to content

Commit e5ed53c

Browse files
author
SDKAuto
committed
CodeGen from PR 18193 in Azure/azure-rest-api-specs
Merge 65898c1c672899037eff6da141b5a18b5180853a into 9aff6fbac1975af94f6a3bc415be84f67d3311ee
1 parent 14ff5a8 commit e5ed53c

File tree

66 files changed

+16025
-19320
lines changed

Some content is hidden

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

66 files changed

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

sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/__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__ = ['DevTestLabsClient']
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/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_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 DevTestLabsClientConfiguration(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(DevTestLabsClientConfiguration, 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(DevTestLabsClientConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
@@ -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)

sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_dev_test_labs_client.py

Lines changed: 76 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,22 @@
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 DevTestLabsClientConfiguration
18+
from .operations import ArmTemplatesOperations, ArtifactSourcesOperations, ArtifactsOperations, CostsOperations, CustomImagesOperations, DisksOperations, EnvironmentsOperations, FormulasOperations, GalleryImagesOperations, GlobalSchedulesOperations, LabsOperations, NotificationChannelsOperations, Operations, PoliciesOperations, PolicySetsOperations, ProviderOperationsOperations, SchedulesOperations, SecretsOperations, ServiceFabricSchedulesOperations, ServiceFabricsOperations, ServiceRunnersOperations, UsersOperations, VirtualMachineSchedulesOperations, VirtualMachinesOperations, VirtualNetworksOperations
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 DevTestLabsClientConfiguration
21-
from .operations import ProviderOperationsOperations
22-
from .operations import LabsOperations
23-
from .operations import Operations
24-
from .operations import GlobalSchedulesOperations
25-
from .operations import ArtifactSourcesOperations
26-
from .operations import ArmTemplatesOperations
27-
from .operations import ArtifactsOperations
28-
from .operations import CostsOperations
29-
from .operations import CustomImagesOperations
30-
from .operations import FormulasOperations
31-
from .operations import GalleryImagesOperations
32-
from .operations import NotificationChannelsOperations
33-
from .operations import PolicySetsOperations
34-
from .operations import PoliciesOperations
35-
from .operations import SchedulesOperations
36-
from .operations import ServiceRunnersOperations
37-
from .operations import UsersOperations
38-
from .operations import DisksOperations
39-
from .operations import EnvironmentsOperations
40-
from .operations import SecretsOperations
41-
from .operations import ServiceFabricsOperations
42-
from .operations import ServiceFabricSchedulesOperations
43-
from .operations import VirtualMachinesOperations
44-
from .operations import VirtualMachineSchedulesOperations
45-
from .operations import VirtualNetworksOperations
46-
from . import models
47-
48-
49-
class DevTestLabsClient(object):
24+
class DevTestLabsClient:
5025
"""The DevTest Labs Client.
5126
5227
:ivar provider_operations: ProviderOperationsOperations operations
@@ -72,7 +47,8 @@ class DevTestLabsClient(object):
7247
:ivar gallery_images: GalleryImagesOperations operations
7348
:vartype gallery_images: azure.mgmt.devtestlabs.operations.GalleryImagesOperations
7449
:ivar notification_channels: NotificationChannelsOperations operations
75-
:vartype notification_channels: azure.mgmt.devtestlabs.operations.NotificationChannelsOperations
50+
:vartype notification_channels:
51+
azure.mgmt.devtestlabs.operations.NotificationChannelsOperations
7652
:ivar policy_sets: PolicySetsOperations operations
7753
:vartype policy_sets: azure.mgmt.devtestlabs.operations.PolicySetsOperations
7854
:ivar policies: PoliciesOperations operations
@@ -92,89 +68,91 @@ class DevTestLabsClient(object):
9268
:ivar service_fabrics: ServiceFabricsOperations operations
9369
:vartype service_fabrics: azure.mgmt.devtestlabs.operations.ServiceFabricsOperations
9470
:ivar service_fabric_schedules: ServiceFabricSchedulesOperations operations
95-
:vartype service_fabric_schedules: azure.mgmt.devtestlabs.operations.ServiceFabricSchedulesOperations
71+
:vartype service_fabric_schedules:
72+
azure.mgmt.devtestlabs.operations.ServiceFabricSchedulesOperations
9673
:ivar virtual_machines: VirtualMachinesOperations operations
9774
:vartype virtual_machines: azure.mgmt.devtestlabs.operations.VirtualMachinesOperations
9875
:ivar virtual_machine_schedules: VirtualMachineSchedulesOperations operations
99-
:vartype virtual_machine_schedules: azure.mgmt.devtestlabs.operations.VirtualMachineSchedulesOperations
76+
:vartype virtual_machine_schedules:
77+
azure.mgmt.devtestlabs.operations.VirtualMachineSchedulesOperations
10078
:ivar virtual_networks: VirtualNetworksOperations operations
10179
:vartype virtual_networks: azure.mgmt.devtestlabs.operations.VirtualNetworksOperations
10280
:param credential: Credential needed for the client to connect to Azure.
10381
:type credential: ~azure.core.credentials.TokenCredential
10482
:param subscription_id: The subscription ID.
10583
:type subscription_id: str
106-
:param str base_url: Service URL
107-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
84+
:param base_url: Service URL. Default value is 'https://management.azure.com'.
85+
:type base_url: str
86+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
87+
Retry-After header is present.
10888
"""
10989

11090
def __init__(
11191
self,
112-
credential, # type: "TokenCredential"
113-
subscription_id, # type: str
114-
base_url=None, # type: Optional[str]
115-
**kwargs # type: Any
116-
):
117-
# type: (...) -> None
118-
if not base_url:
119-
base_url = 'https://management.azure.com'
120-
self._config = DevTestLabsClientConfiguration(credential, subscription_id, **kwargs)
92+
credential: "TokenCredential",
93+
subscription_id: str,
94+
base_url: str = "https://management.azure.com",
95+
**kwargs: Any
96+
) -> None:
97+
self._config = DevTestLabsClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
12198
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
12299

123100
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
124101
self._serialize = Serializer(client_models)
125-
self._serialize.client_side_validation = False
126102
self._deserialize = Deserializer(client_models)
103+
self._serialize.client_side_validation = False
104+
self.provider_operations = ProviderOperationsOperations(self._client, self._config, self._serialize, self._deserialize)
105+
self.labs = LabsOperations(self._client, self._config, self._serialize, self._deserialize)
106+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
107+
self.global_schedules = GlobalSchedulesOperations(self._client, self._config, self._serialize, self._deserialize)
108+
self.artifact_sources = ArtifactSourcesOperations(self._client, self._config, self._serialize, self._deserialize)
109+
self.arm_templates = ArmTemplatesOperations(self._client, self._config, self._serialize, self._deserialize)
110+
self.artifacts = ArtifactsOperations(self._client, self._config, self._serialize, self._deserialize)
111+
self.costs = CostsOperations(self._client, self._config, self._serialize, self._deserialize)
112+
self.custom_images = CustomImagesOperations(self._client, self._config, self._serialize, self._deserialize)
113+
self.formulas = FormulasOperations(self._client, self._config, self._serialize, self._deserialize)
114+
self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize)
115+
self.notification_channels = NotificationChannelsOperations(self._client, self._config, self._serialize, self._deserialize)
116+
self.policy_sets = PolicySetsOperations(self._client, self._config, self._serialize, self._deserialize)
117+
self.policies = PoliciesOperations(self._client, self._config, self._serialize, self._deserialize)
118+
self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize)
119+
self.service_runners = ServiceRunnersOperations(self._client, self._config, self._serialize, self._deserialize)
120+
self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize)
121+
self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize)
122+
self.environments = EnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize)
123+
self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize)
124+
self.service_fabrics = ServiceFabricsOperations(self._client, self._config, self._serialize, self._deserialize)
125+
self.service_fabric_schedules = ServiceFabricSchedulesOperations(self._client, self._config, self._serialize, self._deserialize)
126+
self.virtual_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize)
127+
self.virtual_machine_schedules = VirtualMachineSchedulesOperations(self._client, self._config, self._serialize, self._deserialize)
128+
self.virtual_networks = VirtualNetworksOperations(self._client, self._config, self._serialize, self._deserialize)
129+
130+
131+
def _send_request(
132+
self,
133+
request, # type: HttpRequest
134+
**kwargs: Any
135+
) -> HttpResponse:
136+
"""Runs the network request through the client's chained policies.
137+
138+
>>> from azure.core.rest import HttpRequest
139+
>>> request = HttpRequest("GET", "https://www.example.org/")
140+
<HttpRequest [GET], url: 'https://www.example.org/'>
141+
>>> response = client._send_request(request)
142+
<HttpResponse: 200 OK>
143+
144+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
145+
146+
:param request: The network request you want to make. Required.
147+
:type request: ~azure.core.rest.HttpRequest
148+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
149+
:return: The response of your network call. Does not do error handling on your response.
150+
:rtype: ~azure.core.rest.HttpResponse
151+
"""
127152

128-
self.provider_operations = ProviderOperationsOperations(
129-
self._client, self._config, self._serialize, self._deserialize)
130-
self.labs = LabsOperations(
131-
self._client, self._config, self._serialize, self._deserialize)
132-
self.operations = Operations(
133-
self._client, self._config, self._serialize, self._deserialize)
134-
self.global_schedules = GlobalSchedulesOperations(
135-
self._client, self._config, self._serialize, self._deserialize)
136-
self.artifact_sources = ArtifactSourcesOperations(
137-
self._client, self._config, self._serialize, self._deserialize)
138-
self.arm_templates = ArmTemplatesOperations(
139-
self._client, self._config, self._serialize, self._deserialize)
140-
self.artifacts = ArtifactsOperations(
141-
self._client, self._config, self._serialize, self._deserialize)
142-
self.costs = CostsOperations(
143-
self._client, self._config, self._serialize, self._deserialize)
144-
self.custom_images = CustomImagesOperations(
145-
self._client, self._config, self._serialize, self._deserialize)
146-
self.formulas = FormulasOperations(
147-
self._client, self._config, self._serialize, self._deserialize)
148-
self.gallery_images = GalleryImagesOperations(
149-
self._client, self._config, self._serialize, self._deserialize)
150-
self.notification_channels = NotificationChannelsOperations(
151-
self._client, self._config, self._serialize, self._deserialize)
152-
self.policy_sets = PolicySetsOperations(
153-
self._client, self._config, self._serialize, self._deserialize)
154-
self.policies = PoliciesOperations(
155-
self._client, self._config, self._serialize, self._deserialize)
156-
self.schedules = SchedulesOperations(
157-
self._client, self._config, self._serialize, self._deserialize)
158-
self.service_runners = ServiceRunnersOperations(
159-
self._client, self._config, self._serialize, self._deserialize)
160-
self.users = UsersOperations(
161-
self._client, self._config, self._serialize, self._deserialize)
162-
self.disks = DisksOperations(
163-
self._client, self._config, self._serialize, self._deserialize)
164-
self.environments = EnvironmentsOperations(
165-
self._client, self._config, self._serialize, self._deserialize)
166-
self.secrets = SecretsOperations(
167-
self._client, self._config, self._serialize, self._deserialize)
168-
self.service_fabrics = ServiceFabricsOperations(
169-
self._client, self._config, self._serialize, self._deserialize)
170-
self.service_fabric_schedules = ServiceFabricSchedulesOperations(
171-
self._client, self._config, self._serialize, self._deserialize)
172-
self.virtual_machines = VirtualMachinesOperations(
173-
self._client, self._config, self._serialize, self._deserialize)
174-
self.virtual_machine_schedules = VirtualMachineSchedulesOperations(
175-
self._client, self._config, self._serialize, self._deserialize)
176-
self.virtual_networks = VirtualNetworksOperations(
177-
self._client, self._config, self._serialize, self._deserialize)
153+
request_copy = deepcopy(request)
154+
request_copy.url = self._client.format_url(request_copy.url)
155+
return self._client.send_request(request_copy, **kwargs)
178156

179157
def close(self):
180158
# type: () -> None

0 commit comments

Comments
 (0)