22# --------------------------------------------------------------------------
33# Copyright (c) Microsoft Corporation. All rights reserved.
44# Licensed under the MIT License. See License.txt in the project root for license information.
5- # Code generated by Microsoft (R) AutoRest Code Generator.
5+ # Code generated by Microsoft (R) Python Code Generator.
66# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77# --------------------------------------------------------------------------
88
99from copy import deepcopy
1010from typing import Any , TYPE_CHECKING
11+ from typing_extensions import Self
1112
13+ from azure .core .pipeline import policies
1214from azure .core .rest import HttpRequest , HttpResponse
1315from azure .mgmt .core import ARMPipelineClient
16+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
1417
15- from . import models as _models
1618from ._configuration import AstroMgmtClientConfiguration
1719from ._serialization import Deserializer , Serializer
1820from .operations import Operations , OrganizationsOperations
1921
2022if TYPE_CHECKING :
21- # pylint: disable=unused-import,ungrouped-imports
2223 from azure .core .credentials import TokenCredential
2324
2425
25- class AstroMgmtClient : # pylint: disable=client-accepts-api-version-keyword
26+ class AstroMgmtClient :
2627 """AstroMgmtClient.
2728
2829 :ivar operations: Operations operations
2930 :vartype operations: azure.mgmt.astro.operations.Operations
3031 :ivar organizations: OrganizationsOperations operations
3132 :vartype organizations: azure.mgmt.astro.operations.OrganizationsOperations
32- :param credential: Credential needed for the client to connect to Azure . Required.
33+ :param credential: Credential used to authenticate requests to the service . Required.
3334 :type credential: ~azure.core.credentials.TokenCredential
34- :param subscription_id: The ID of the target subscription. Required.
35+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3536 :type subscription_id: str
36- :param base_url: Service URL . Default value is "https://management.azure.com".
37+ :param base_url: Service host . Default value is "https://management.azure.com".
3738 :type base_url: str
38- :keyword api_version: Api Version . Default value is "2023 -08-01". Note that overriding this
39- default value may result in unsupported behavior.
39+ :keyword api_version: The API version to use for this operation . Default value is "2024 -08-27".
40+ Note that overriding this default value may result in unsupported behavior.
4041 :paramtype api_version: str
4142 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4243 Retry-After header is present.
@@ -49,23 +50,43 @@ def __init__(
4950 base_url : str = "https://management.azure.com" ,
5051 ** kwargs : Any
5152 ) -> None :
52- self ._config = AstroMgmtClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
53- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
54-
55- client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
56- self ._serialize = Serializer (client_models )
57- self ._deserialize = Deserializer (client_models )
53+ _endpoint = "{endpoint}"
54+ self ._config = AstroMgmtClientConfiguration (
55+ credential = credential , subscription_id = subscription_id , base_url = base_url , ** kwargs
56+ )
57+ _policies = kwargs .pop ("policies" , None )
58+ if _policies is None :
59+ _policies = [
60+ policies .RequestIdPolicy (** kwargs ),
61+ self ._config .headers_policy ,
62+ self ._config .user_agent_policy ,
63+ self ._config .proxy_policy ,
64+ policies .ContentDecodePolicy (** kwargs ),
65+ ARMAutoResourceProviderRegistrationPolicy (),
66+ self ._config .redirect_policy ,
67+ self ._config .retry_policy ,
68+ self ._config .authentication_policy ,
69+ self ._config .custom_hook_policy ,
70+ self ._config .logging_policy ,
71+ policies .DistributedTracingPolicy (** kwargs ),
72+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
73+ self ._config .http_logging_policy ,
74+ ]
75+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
76+
77+ self ._serialize = Serializer ()
78+ self ._deserialize = Deserializer ()
5879 self ._serialize .client_side_validation = False
5980 self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
6081 self .organizations = OrganizationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
6182
62- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
83+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
6384 """Runs the network request through the client's chained policies.
6485
6586 >>> from azure.core.rest import HttpRequest
6687 >>> request = HttpRequest("GET", "https://www.example.org/")
6788 <HttpRequest [GET], url: 'https://www.example.org/'>
68- >>> response = client._send_request (request)
89+ >>> response = client.send_request (request)
6990 <HttpResponse: 200 OK>
7091
7192 For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -78,13 +99,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
7899 """
79100
80101 request_copy = deepcopy (request )
81- request_copy .url = self ._client .format_url (request_copy .url )
82- return self ._client .send_request (request_copy , ** kwargs )
102+ path_format_arguments = {
103+ "endpoint" : self ._serialize .url ("self._config.base_url" , self ._config .base_url , "str" , skip_quote = True ),
104+ }
105+
106+ request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
107+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
83108
84109 def close (self ) -> None :
85110 self ._client .close ()
86111
87- def __enter__ (self ) -> "AstroMgmtClient" :
112+ def __enter__ (self ) -> Self :
88113 self ._client .__enter__ ()
89114 return self
90115
0 commit comments