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