88
99from copy import deepcopy
1010from typing import Any , TYPE_CHECKING
11+ from typing_extensions import Self
1112
1213from azure .core import PipelineClient
1314from azure .core .pipeline import policies
1415from azure .core .rest import HttpRequest , HttpResponse
1516
16- from ._configuration import DevCenterClientConfiguration
17- from ._operations import DevCenterClientOperationsMixin
17+ from ._configuration import (
18+ DeploymentEnvironmentsClientConfiguration ,
19+ DevBoxesClientConfiguration ,
20+ DevCenterClientConfiguration ,
21+ )
22+ from ._operations import (
23+ DeploymentEnvironmentsClientOperationsMixin ,
24+ DevBoxesClientOperationsMixin ,
25+ DevCenterClientOperationsMixin ,
26+ )
1827from ._serialization import Deserializer , Serializer
1928
2029if TYPE_CHECKING :
2534class DevCenterClient (DevCenterClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword
2635 """DevCenterClient.
2736
37+ :param endpoint: The DevCenter-specific URI to operate on. Required.
38+ :type endpoint: str
39+ :param credential: Credential used to authenticate requests to the service. Required.
40+ :type credential: ~azure.core.credentials.TokenCredential
41+ :keyword api_version: The API version to use for this operation. Default value is "2023-04-01".
42+ Note that overriding this default value may result in unsupported behavior.
43+ :paramtype api_version: str
44+ """
45+
46+ def __init__ (self , endpoint : str , credential : "TokenCredential" , ** kwargs : Any ) -> None :
47+ _endpoint = "{endpoint}"
48+ self ._config = DevCenterClientConfiguration (endpoint = endpoint , credential = credential , ** kwargs )
49+ _policies = kwargs .pop ("policies" , None )
50+ if _policies is None :
51+ _policies = [
52+ policies .RequestIdPolicy (** kwargs ),
53+ self ._config .headers_policy ,
54+ self ._config .user_agent_policy ,
55+ self ._config .proxy_policy ,
56+ policies .ContentDecodePolicy (** kwargs ),
57+ self ._config .redirect_policy ,
58+ self ._config .retry_policy ,
59+ self ._config .authentication_policy ,
60+ self ._config .custom_hook_policy ,
61+ self ._config .logging_policy ,
62+ policies .DistributedTracingPolicy (** kwargs ),
63+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
64+ self ._config .http_logging_policy ,
65+ ]
66+ self ._client : PipelineClient = PipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
67+
68+ self ._serialize = Serializer ()
69+ self ._deserialize = Deserializer ()
70+ self ._serialize .client_side_validation = False
71+
72+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
73+ """Runs the network request through the client's chained policies.
74+
75+ >>> from azure.core.rest import HttpRequest
76+ >>> request = HttpRequest("GET", "https://www.example.org/")
77+ <HttpRequest [GET], url: 'https://www.example.org/'>
78+ >>> response = client.send_request(request)
79+ <HttpResponse: 200 OK>
80+
81+ For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
82+
83+ :param request: The network request you want to make. Required.
84+ :type request: ~azure.core.rest.HttpRequest
85+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
86+ :return: The response of your network call. Does not do error handling on your response.
87+ :rtype: ~azure.core.rest.HttpResponse
88+ """
89+
90+ request_copy = deepcopy (request )
91+ path_format_arguments = {
92+ "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" , skip_quote = True ),
93+ }
94+
95+ request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
96+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
97+
98+ def close (self ) -> None :
99+ self ._client .close ()
100+
101+ def __enter__ (self ) -> Self :
102+ self ._client .__enter__ ()
103+ return self
104+
105+ def __exit__ (self , * exc_details : Any ) -> None :
106+ self ._client .__exit__ (* exc_details )
107+
108+
109+ class DevBoxesClient (DevBoxesClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword
110+ """DevBoxesClient.
111+
28112 :param endpoint: The DevCenter-specific URI to operate on. Required.
29113 :type endpoint: str
30114 :param credential: Credential used to authenticate requests to the service. Required.
@@ -38,7 +122,86 @@ class DevCenterClient(DevCenterClientOperationsMixin): # pylint: disable=client
38122
39123 def __init__ (self , endpoint : str , credential : "TokenCredential" , ** kwargs : Any ) -> None :
40124 _endpoint = "{endpoint}"
41- self ._config = DevCenterClientConfiguration (endpoint = endpoint , credential = credential , ** kwargs )
125+ self ._config = DevBoxesClientConfiguration (endpoint = endpoint , credential = credential , ** kwargs )
126+ _policies = kwargs .pop ("policies" , None )
127+ if _policies is None :
128+ _policies = [
129+ policies .RequestIdPolicy (** kwargs ),
130+ self ._config .headers_policy ,
131+ self ._config .user_agent_policy ,
132+ self ._config .proxy_policy ,
133+ policies .ContentDecodePolicy (** kwargs ),
134+ self ._config .redirect_policy ,
135+ self ._config .retry_policy ,
136+ self ._config .authentication_policy ,
137+ self ._config .custom_hook_policy ,
138+ self ._config .logging_policy ,
139+ policies .DistributedTracingPolicy (** kwargs ),
140+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
141+ self ._config .http_logging_policy ,
142+ ]
143+ self ._client : PipelineClient = PipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
144+
145+ self ._serialize = Serializer ()
146+ self ._deserialize = Deserializer ()
147+ self ._serialize .client_side_validation = False
148+
149+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
150+ """Runs the network request through the client's chained policies.
151+
152+ >>> from azure.core.rest import HttpRequest
153+ >>> request = HttpRequest("GET", "https://www.example.org/")
154+ <HttpRequest [GET], url: 'https://www.example.org/'>
155+ >>> response = client.send_request(request)
156+ <HttpResponse: 200 OK>
157+
158+ For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
159+
160+ :param request: The network request you want to make. Required.
161+ :type request: ~azure.core.rest.HttpRequest
162+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
163+ :return: The response of your network call. Does not do error handling on your response.
164+ :rtype: ~azure.core.rest.HttpResponse
165+ """
166+
167+ request_copy = deepcopy (request )
168+ path_format_arguments = {
169+ "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" , skip_quote = True ),
170+ }
171+
172+ request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
173+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
174+
175+ def close (self ) -> None :
176+ self ._client .close ()
177+
178+ def __enter__ (self ) -> Self :
179+ self ._client .__enter__ ()
180+ return self
181+
182+ def __exit__ (self , * exc_details : Any ) -> None :
183+ self ._client .__exit__ (* exc_details )
184+
185+
186+ class DeploymentEnvironmentsClient (
187+ DeploymentEnvironmentsClientOperationsMixin
188+ ): # pylint: disable=client-accepts-api-version-keyword
189+ """DeploymentEnvironmentsClient.
190+
191+ :param endpoint: The DevCenter-specific URI to operate on. Required.
192+ :type endpoint: str
193+ :param credential: Credential used to authenticate requests to the service. Required.
194+ :type credential: ~azure.core.credentials.TokenCredential
195+ :keyword api_version: The API version to use for this operation. Default value is "2023-04-01".
196+ Note that overriding this default value may result in unsupported behavior.
197+ :paramtype api_version: str
198+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
199+ Retry-After header is present.
200+ """
201+
202+ def __init__ (self , endpoint : str , credential : "TokenCredential" , ** kwargs : Any ) -> None :
203+ _endpoint = "{endpoint}"
204+ self ._config = DeploymentEnvironmentsClientConfiguration (endpoint = endpoint , credential = credential , ** kwargs )
42205 _policies = kwargs .pop ("policies" , None )
43206 if _policies is None :
44207 _policies = [
@@ -91,7 +254,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
91254 def close (self ) -> None :
92255 self ._client .close ()
93256
94- def __enter__ (self ) -> "DevCenterClient" :
257+ def __enter__ (self ) -> Self :
95258 self ._client .__enter__ ()
96259 return self
97260
0 commit comments