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
1113from azure .mgmt .core import ARMPipelineClient
1214from msrest import Deserializer , Serializer
1315
16+ from . import models
17+ from ._configuration import SubscriptionClientConfiguration
18+ from .operations import AliasOperations , BillingAccountOperations , Operations , SubscriptionOperations , SubscriptionPolicyOperations , SubscriptionsOperations , TenantsOperations
19+
1420if TYPE_CHECKING :
1521 # pylint: disable=unused-import,ungrouped-imports
16- from typing import Any , Optional
17-
1822 from azure .core .credentials import TokenCredential
19- from azure .core .pipeline .transport import HttpRequest , HttpResponse
20-
21- from ._configuration import SubscriptionClientConfiguration
22- from .operations import SubscriptionOperations
23- from .operations import Operations
24- from .operations import AliasOperations
25- from .operations import SubscriptionPolicyOperations
26- from .operations import BillingAccountOperations
27- from . import models
28-
2923
30- class SubscriptionClient ( object ) :
24+ class SubscriptionClient :
3125 """The subscription client.
3226
27+ :ivar subscriptions: SubscriptionsOperations operations
28+ :vartype subscriptions: azure.mgmt.subscription.operations.SubscriptionsOperations
29+ :ivar tenants: TenantsOperations operations
30+ :vartype tenants: azure.mgmt.subscription.operations.TenantsOperations
3331 :ivar subscription: SubscriptionOperations operations
3432 :vartype subscription: azure.mgmt.subscription.operations.SubscriptionOperations
3533 :ivar operations: Operations operations
@@ -42,52 +40,59 @@ class SubscriptionClient(object):
4240 :vartype billing_account: azure.mgmt.subscription.operations.BillingAccountOperations
4341 :param credential: Credential needed for the client to connect to Azure.
4442 :type credential: ~azure.core.credentials.TokenCredential
45- :param str base_url: Service URL
46- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
43+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
44+ :type base_url: str
45+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
46+ Retry-After header is present.
4747 """
4848
4949 def __init__ (
5050 self ,
51- credential , # type: "TokenCredential"
52- base_url = None , # type: Optional[str]
53- ** kwargs # type: Any
54- ):
55- # type: (...) -> None
56- if not base_url :
57- base_url = 'https://management.azure.com'
58- self ._config = SubscriptionClientConfiguration (credential , ** kwargs )
51+ credential : "TokenCredential" ,
52+ base_url : str = "https://management.azure.com" ,
53+ ** kwargs : Any
54+ ) -> None :
55+ self ._config = SubscriptionClientConfiguration (credential = credential , ** kwargs )
5956 self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
6057
6158 client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
6259 self ._serialize = Serializer (client_models )
63- self ._serialize .client_side_validation = False
6460 self ._deserialize = Deserializer (client_models )
61+ self ._serialize .client_side_validation = False
62+ self .subscriptions = SubscriptionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
63+ self .tenants = TenantsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
64+ self .subscription = SubscriptionOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
65+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
66+ self .alias = AliasOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
67+ self .subscription_policy = SubscriptionPolicyOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
68+ self .billing_account = BillingAccountOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
6569
66- self .subscription = SubscriptionOperations (
67- self ._client , self ._config , self ._serialize , self ._deserialize )
68- self .operations = Operations (
69- self ._client , self ._config , self ._serialize , self ._deserialize )
70- self .alias = AliasOperations (
71- self ._client , self ._config , self ._serialize , self ._deserialize )
72- self .subscription_policy = SubscriptionPolicyOperations (
73- self ._client , self ._config , self ._serialize , self ._deserialize )
74- self .billing_account = BillingAccountOperations (
75- self ._client , self ._config , self ._serialize , self ._deserialize )
76-
77- def _send_request (self , http_request , ** kwargs ):
78- # type: (HttpRequest, Any) -> HttpResponse
70+
71+ def _send_request (
72+ self ,
73+ request , # type: HttpRequest
74+ ** kwargs : Any
75+ ) -> HttpResponse :
7976 """Runs the network request through the client's chained policies.
8077
81- :param http_request: The network request you want to make. Required.
82- :type http_request: ~azure.core.pipeline.transport.HttpRequest
83- :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
78+ >>> from azure.core.rest import HttpRequest
79+ >>> request = HttpRequest("GET", "https://www.example.org/")
80+ <HttpRequest [GET], url: 'https://www.example.org/'>
81+ >>> response = client._send_request(request)
82+ <HttpResponse: 200 OK>
83+
84+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
85+
86+ :param request: The network request you want to make. Required.
87+ :type request: ~azure.core.rest.HttpRequest
88+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
8489 :return: The response of your network call. Does not do error handling on your response.
85- :rtype: ~azure.core.pipeline.transport .HttpResponse
90+ :rtype: ~azure.core.rest .HttpResponse
8691 """
87- http_request . url = self . _client . format_url ( http_request . url )
88- stream = kwargs . pop ( "stream" , True )
89- pipeline_response = self ._client ._pipeline . run ( http_request , stream = stream , ** kwargs )
90- return pipeline_response . http_response
92+
93+ request_copy = deepcopy ( request )
94+ request_copy . url = self ._client .format_url ( request_copy . url )
95+ return self . _client . send_request ( request_copy , ** kwargs )
9196
9297 def close (self ):
9398 # type: () -> None
0 commit comments