6
6
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
# --------------------------------------------------------------------------
8
8
9
- from typing import TYPE_CHECKING
9
+ from copy import deepcopy
10
+ from typing import Any , Optional , TYPE_CHECKING
10
11
12
+ from azure .core .rest import HttpRequest , HttpResponse
11
13
from azure .mgmt .core import ARMPipelineClient
12
14
from msrest import Deserializer , Serializer
13
15
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
+
14
20
if TYPE_CHECKING :
15
21
# pylint: disable=unused-import,ungrouped-imports
16
- from typing import Any , Optional
17
-
18
22
from azure .core .credentials import TokenCredential
19
23
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 :
50
25
"""The DevTest Labs Client.
51
26
52
27
:ivar provider_operations: ProviderOperationsOperations operations
@@ -72,7 +47,8 @@ class DevTestLabsClient(object):
72
47
:ivar gallery_images: GalleryImagesOperations operations
73
48
:vartype gallery_images: azure.mgmt.devtestlabs.operations.GalleryImagesOperations
74
49
:ivar notification_channels: NotificationChannelsOperations operations
75
- :vartype notification_channels: azure.mgmt.devtestlabs.operations.NotificationChannelsOperations
50
+ :vartype notification_channels:
51
+ azure.mgmt.devtestlabs.operations.NotificationChannelsOperations
76
52
:ivar policy_sets: PolicySetsOperations operations
77
53
:vartype policy_sets: azure.mgmt.devtestlabs.operations.PolicySetsOperations
78
54
:ivar policies: PoliciesOperations operations
@@ -92,89 +68,91 @@ class DevTestLabsClient(object):
92
68
:ivar service_fabrics: ServiceFabricsOperations operations
93
69
:vartype service_fabrics: azure.mgmt.devtestlabs.operations.ServiceFabricsOperations
94
70
: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
96
73
:ivar virtual_machines: VirtualMachinesOperations operations
97
74
:vartype virtual_machines: azure.mgmt.devtestlabs.operations.VirtualMachinesOperations
98
75
: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
100
78
:ivar virtual_networks: VirtualNetworksOperations operations
101
79
:vartype virtual_networks: azure.mgmt.devtestlabs.operations.VirtualNetworksOperations
102
80
:param credential: Credential needed for the client to connect to Azure.
103
81
:type credential: ~azure.core.credentials.TokenCredential
104
82
:param subscription_id: The subscription ID.
105
83
: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.
108
88
"""
109
89
110
90
def __init__ (
111
91
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 )
121
98
self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
122
99
123
100
client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
124
101
self ._serialize = Serializer (client_models )
125
- self ._serialize .client_side_validation = False
126
102
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
+ """
127
152
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 )
178
156
179
157
def close (self ):
180
158
# type: () -> None
0 commit comments