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 , TYPE_CHECKING
1011
12+ from azure .core .rest import HttpRequest , HttpResponse
1113from azure .mgmt .core import ARMPipelineClient
12- from msrest import Deserializer , Serializer
14+
15+ from . import models
16+ from ._configuration import HDInsightManagementClientConfiguration
17+ from ._serialization import Deserializer , Serializer
18+ from .operations import (
19+ ApplicationsOperations ,
20+ ClustersOperations ,
21+ ConfigurationsOperations ,
22+ ExtensionsOperations ,
23+ LocationsOperations ,
24+ Operations ,
25+ PrivateEndpointConnectionsOperations ,
26+ PrivateLinkResourcesOperations ,
27+ ScriptActionsOperations ,
28+ ScriptExecutionHistoryOperations ,
29+ VirtualMachinesOperations ,
30+ )
1331
1432if TYPE_CHECKING :
1533 # pylint: disable=unused-import,ungrouped-imports
16- from typing import Any , Optional
17-
1834 from azure .core .credentials import TokenCredential
19- from azure .core .pipeline .transport import HttpRequest , HttpResponse
20-
21- from ._configuration import HDInsightManagementClientConfiguration
22- from .operations import ClustersOperations
23- from .operations import ApplicationsOperations
24- from .operations import LocationsOperations
25- from .operations import ConfigurationsOperations
26- from .operations import ExtensionsOperations
27- from .operations import ScriptActionsOperations
28- from .operations import ScriptExecutionHistoryOperations
29- from .operations import Operations
30- from .operations import VirtualMachinesOperations
31- from .operations import PrivateEndpointConnectionsOperations
32- from .operations import PrivateLinkResourcesOperations
33- from . import models
3435
3536
36- class HDInsightManagementClient ( object ):
37+ class HDInsightManagementClient : # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3738 """HDInsight Management Client.
3839
3940 :ivar clusters: ClustersOperations operations
@@ -49,81 +50,88 @@ class HDInsightManagementClient(object):
4950 :ivar script_actions: ScriptActionsOperations operations
5051 :vartype script_actions: azure.mgmt.hdinsight.operations.ScriptActionsOperations
5152 :ivar script_execution_history: ScriptExecutionHistoryOperations operations
52- :vartype script_execution_history: azure.mgmt.hdinsight.operations.ScriptExecutionHistoryOperations
53+ :vartype script_execution_history:
54+ azure.mgmt.hdinsight.operations.ScriptExecutionHistoryOperations
5355 :ivar operations: Operations operations
5456 :vartype operations: azure.mgmt.hdinsight.operations.Operations
5557 :ivar virtual_machines: VirtualMachinesOperations operations
5658 :vartype virtual_machines: azure.mgmt.hdinsight.operations.VirtualMachinesOperations
5759 :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
58- :vartype private_endpoint_connections: azure.mgmt.hdinsight.operations.PrivateEndpointConnectionsOperations
60+ :vartype private_endpoint_connections:
61+ azure.mgmt.hdinsight.operations.PrivateEndpointConnectionsOperations
5962 :ivar private_link_resources: PrivateLinkResourcesOperations operations
6063 :vartype private_link_resources: azure.mgmt.hdinsight.operations.PrivateLinkResourcesOperations
61- :param credential: Credential needed for the client to connect to Azure.
64+ :param credential: Credential needed for the client to connect to Azure. Required.
6265 :type credential: ~azure.core.credentials.TokenCredential
63- :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
66+ :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure
67+ subscription. The subscription ID forms part of the URI for every service call. Required.
6468 :type subscription_id: str
65- :param str base_url: Service URL
66- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
69+ :param base_url: Service URL. Default value is "https://management.azure.com".
70+ :type base_url: str
71+ :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this
72+ default value may result in unsupported behavior.
73+ :paramtype api_version: str
74+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
75+ Retry-After header is present.
6776 """
6877
6978 def __init__ (
7079 self ,
71- credential , # type: "TokenCredential"
72- subscription_id , # type: str
73- base_url = None , # type: Optional[str]
74- ** kwargs # type: Any
75- ):
76- # type: (...) -> None
77- if not base_url :
78- base_url = 'https://management.azure.com'
79- self ._config = HDInsightManagementClientConfiguration (credential , subscription_id , ** kwargs )
80+ credential : "TokenCredential" ,
81+ subscription_id : str ,
82+ base_url : str = "https://management.azure.com" ,
83+ ** kwargs : Any
84+ ) -> None :
85+ self ._config = HDInsightManagementClientConfiguration (
86+ credential = credential , subscription_id = subscription_id , ** kwargs
87+ )
8088 self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
8189
8290 client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
8391 self ._serialize = Serializer (client_models )
84- self ._serialize .client_side_validation = False
8592 self ._deserialize = Deserializer (client_models )
86-
87- self .clusters = ClustersOperations (
88- self ._client , self ._config , self ._serialize , self ._deserialize )
89- self .applications = ApplicationsOperations (
90- self ._client , self ._config , self ._serialize , self ._deserialize )
91- self .locations = LocationsOperations (
92- self ._client , self ._config , self ._serialize , self ._deserialize )
93- self .configurations = ConfigurationsOperations (
94- self ._client , self ._config , self ._serialize , self ._deserialize )
95- self .extensions = ExtensionsOperations (
96- self ._client , self ._config , self ._serialize , self ._deserialize )
97- self .script_actions = ScriptActionsOperations (
98- self ._client , self ._config , self ._serialize , self ._deserialize )
93+ self ._serialize .client_side_validation = False
94+ self .clusters = ClustersOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
95+ self .applications = ApplicationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
96+ self .locations = LocationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
97+ self .configurations = ConfigurationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
98+ self .extensions = ExtensionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
99+ self .script_actions = ScriptActionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
99100 self .script_execution_history = ScriptExecutionHistoryOperations (
100- self ._client , self ._config , self ._serialize , self ._deserialize )
101- self . operations = Operations (
102- self ._client , self ._config , self ._serialize , self ._deserialize )
101+ self ._client , self ._config , self ._serialize , self ._deserialize
102+ )
103+ self . operations = Operations ( self ._client , self ._config , self ._serialize , self ._deserialize )
103104 self .virtual_machines = VirtualMachinesOperations (
104- self ._client , self ._config , self ._serialize , self ._deserialize )
105+ self ._client , self ._config , self ._serialize , self ._deserialize
106+ )
105107 self .private_endpoint_connections = PrivateEndpointConnectionsOperations (
106- self ._client , self ._config , self ._serialize , self ._deserialize )
108+ self ._client , self ._config , self ._serialize , self ._deserialize
109+ )
107110 self .private_link_resources = PrivateLinkResourcesOperations (
108- self ._client , self ._config , self ._serialize , self ._deserialize )
111+ self ._client , self ._config , self ._serialize , self ._deserialize
112+ )
109113
110- def _send_request (self , http_request , ** kwargs ):
111- # type: (HttpRequest, Any) -> HttpResponse
114+ def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
112115 """Runs the network request through the client's chained policies.
113116
114- :param http_request: The network request you want to make. Required.
115- :type http_request: ~azure.core.pipeline.transport.HttpRequest
116- :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
117+ >>> from azure.core.rest import HttpRequest
118+ >>> request = HttpRequest("GET", "https://www.example.org/")
119+ <HttpRequest [GET], url: 'https://www.example.org/'>
120+ >>> response = client._send_request(request)
121+ <HttpResponse: 200 OK>
122+
123+ For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
124+
125+ :param request: The network request you want to make. Required.
126+ :type request: ~azure.core.rest.HttpRequest
127+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
117128 :return: The response of your network call. Does not do error handling on your response.
118- :rtype: ~azure.core.pipeline.transport .HttpResponse
129+ :rtype: ~azure.core.rest .HttpResponse
119130 """
120- path_format_arguments = {
121- 'subscriptionId' : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , 'str' ),
122- }
123- http_request .url = self ._client .format_url (http_request .url , ** path_format_arguments )
124- stream = kwargs .pop ("stream" , True )
125- pipeline_response = self ._client ._pipeline .run (http_request , stream = stream , ** kwargs )
126- return pipeline_response .http_response
131+
132+ request_copy = deepcopy (request )
133+ request_copy .url = self ._client .format_url (request_copy .url )
134+ return self ._client .send_request (request_copy , ** kwargs )
127135
128136 def close (self ):
129137 # type: () -> None
0 commit comments