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 CognitiveServicesManagementClientConfiguration
18+ from .operations import AccountsOperations , CognitiveServicesManagementClientOperationsMixin , CommitmentPlansOperations , CommitmentTiersOperations , DeletedAccountsOperations , DeploymentsOperations , Operations , PrivateEndpointConnectionsOperations , PrivateLinkResourcesOperations , ResourceSkusOperations
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 CognitiveServicesManagementClientConfiguration
22- from .operations import AccountsOperations
23- from .operations import DeletedAccountsOperations
24- from .operations import ResourceSkusOperations
25- from .operations import Operations
26- from .operations import CognitiveServicesManagementClientOperationsMixin
27- from .operations import CommitmentTiersOperations
28- from .operations import PrivateEndpointConnectionsOperations
29- from .operations import PrivateLinkResourcesOperations
30- from .operations import DeploymentsOperations
31- from .operations import CommitmentPlansOperations
32- from . import models
33-
3423
3524class CognitiveServicesManagementClient (CognitiveServicesManagementClientOperationsMixin ):
3625 """Cognitive Services Management Client.
@@ -46,9 +35,11 @@ class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperati
4635 :ivar commitment_tiers: CommitmentTiersOperations operations
4736 :vartype commitment_tiers: azure.mgmt.cognitiveservices.operations.CommitmentTiersOperations
4837 :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
49- :vartype private_endpoint_connections: azure.mgmt.cognitiveservices.operations.PrivateEndpointConnectionsOperations
38+ :vartype private_endpoint_connections:
39+ azure.mgmt.cognitiveservices.operations.PrivateEndpointConnectionsOperations
5040 :ivar private_link_resources: PrivateLinkResourcesOperations operations
51- :vartype private_link_resources: azure.mgmt.cognitiveservices.operations.PrivateLinkResourcesOperations
41+ :vartype private_link_resources:
42+ azure.mgmt.cognitiveservices.operations.PrivateLinkResourcesOperations
5243 :ivar deployments: DeploymentsOperations operations
5344 :vartype deployments: azure.mgmt.cognitiveservices.operations.DeploymentsOperations
5445 :ivar commitment_plans: CommitmentPlansOperations operations
@@ -57,64 +48,62 @@ class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperati
5748 :type credential: ~azure.core.credentials.TokenCredential
5849 :param subscription_id: The ID of the target subscription.
5950 :type subscription_id: str
60- :param str base_url: Service URL
61- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
51+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
52+ :type base_url: str
53+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
54+ Retry-After header is present.
6255 """
6356
6457 def __init__ (
6558 self ,
66- credential , # type: "TokenCredential"
67- subscription_id , # type: str
68- base_url = None , # type: Optional[str]
69- ** kwargs # type: Any
70- ):
71- # type: (...) -> None
72- if not base_url :
73- base_url = 'https://management.azure.com'
74- self ._config = CognitiveServicesManagementClientConfiguration (credential , subscription_id , ** kwargs )
59+ credential : "TokenCredential" ,
60+ subscription_id : str ,
61+ base_url : str = "https://management.azure.com" ,
62+ ** kwargs : Any
63+ ) -> None :
64+ self ._config = CognitiveServicesManagementClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
7565 self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
7666
7767 client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
7868 self ._serialize = Serializer (client_models )
79- self ._serialize .client_side_validation = False
8069 self ._deserialize = Deserializer (client_models )
81-
82- self .accounts = AccountsOperations (
83- self ._client , self ._config , self ._serialize , self ._deserialize )
84- self .deleted_accounts = DeletedAccountsOperations (
85- self ._client , self ._config , self ._serialize , self ._deserialize )
86- self .resource_skus = ResourceSkusOperations (
87- self ._client , self ._config , self ._serialize , self ._deserialize )
88- self .operations = Operations (
89- self ._client , self ._config , self ._serialize , self ._deserialize )
90- self .commitment_tiers = CommitmentTiersOperations (
91- self ._client , self ._config , self ._serialize , self ._deserialize )
92- self .private_endpoint_connections = PrivateEndpointConnectionsOperations (
93- self ._client , self ._config , self ._serialize , self ._deserialize )
94- self .private_link_resources = PrivateLinkResourcesOperations (
95- self ._client , self ._config , self ._serialize , self ._deserialize )
96- self .deployments = DeploymentsOperations (
97- self ._client , self ._config , self ._serialize , self ._deserialize )
98- self .commitment_plans = CommitmentPlansOperations (
99- self ._client , self ._config , self ._serialize , self ._deserialize )
100-
101- def _send_request (self , http_request , ** kwargs ):
102- # type: (HttpRequest, Any) -> HttpResponse
70+ self ._serialize .client_side_validation = False
71+ self .accounts = AccountsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
72+ self .deleted_accounts = DeletedAccountsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
73+ self .resource_skus = ResourceSkusOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
74+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
75+ self .commitment_tiers = CommitmentTiersOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
76+ self .private_endpoint_connections = PrivateEndpointConnectionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
77+ self .private_link_resources = PrivateLinkResourcesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
78+ self .deployments = DeploymentsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
79+ self .commitment_plans = CommitmentPlansOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
80+
81+
82+ def _send_request (
83+ self ,
84+ request , # type: HttpRequest
85+ ** kwargs : Any
86+ ) -> HttpResponse :
10387 """Runs the network request through the client's chained policies.
10488
105- :param http_request: The network request you want to make. Required.
106- :type http_request: ~azure.core.pipeline.transport.HttpRequest
107- :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
89+ >>> from azure.core.rest import HttpRequest
90+ >>> request = HttpRequest("GET", "https://www.example.org/")
91+ <HttpRequest [GET], url: 'https://www.example.org/'>
92+ >>> response = client._send_request(request)
93+ <HttpResponse: 200 OK>
94+
95+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
96+
97+ :param request: The network request you want to make. Required.
98+ :type request: ~azure.core.rest.HttpRequest
99+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
108100 :return: The response of your network call. Does not do error handling on your response.
109- :rtype: ~azure.core.pipeline.transport .HttpResponse
101+ :rtype: ~azure.core.rest .HttpResponse
110102 """
111- path_format_arguments = {
112- 'subscriptionId' : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , 'str' , min_length = 1 ),
113- }
114- http_request .url = self ._client .format_url (http_request .url , ** path_format_arguments )
115- stream = kwargs .pop ("stream" , True )
116- pipeline_response = self ._client ._pipeline .run (http_request , stream = stream , ** kwargs )
117- return pipeline_response .http_response
103+
104+ request_copy = deepcopy (request )
105+ request_copy .url = self ._client .format_url (request_copy .url )
106+ return self ._client .send_request (request_copy , ** kwargs )
118107
119108 def close (self ):
120109 # type: () -> None
0 commit comments