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 BatchManagementClientConfiguration
18+ from .operations import ApplicationOperations , ApplicationPackageOperations , BatchAccountOperations , CertificateOperations , LocationOperations , Operations , PoolOperations , PrivateEndpointConnectionOperations , PrivateLinkResourceOperations
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 BatchManagementClientConfiguration
22- from .operations import BatchAccountOperations
23- from .operations import ApplicationPackageOperations
24- from .operations import ApplicationOperations
25- from .operations import LocationOperations
26- from .operations import Operations
27- from .operations import CertificateOperations
28- from .operations import PrivateLinkResourceOperations
29- from .operations import PrivateEndpointConnectionOperations
30- from .operations import PoolOperations
31- from . import models
32-
3323
34- class BatchManagementClient ( object ) :
24+ class BatchManagementClient :
3525 """Batch Client.
3626
3727 :ivar batch_account: BatchAccountOperations operations
@@ -49,71 +39,71 @@ class BatchManagementClient(object):
4939 :ivar private_link_resource: PrivateLinkResourceOperations operations
5040 :vartype private_link_resource: azure.mgmt.batch.operations.PrivateLinkResourceOperations
5141 :ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations
52- :vartype private_endpoint_connection: azure.mgmt.batch.operations.PrivateEndpointConnectionOperations
42+ :vartype private_endpoint_connection:
43+ azure.mgmt.batch.operations.PrivateEndpointConnectionOperations
5344 :ivar pool: PoolOperations operations
5445 :vartype pool: azure.mgmt.batch.operations.PoolOperations
5546 :param credential: Credential needed for the client to connect to Azure.
5647 :type credential: ~azure.core.credentials.TokenCredential
57- :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
48+ :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
49+ 00000000-0000-0000-0000-000000000000).
5850 :type subscription_id: str
59- :param str base_url: Service URL
60- :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.
6155 """
6256
6357 def __init__ (
6458 self ,
65- credential , # type: "TokenCredential"
66- subscription_id , # type: str
67- base_url = None , # type: Optional[str]
68- ** kwargs # type: Any
69- ):
70- # type: (...) -> None
71- if not base_url :
72- base_url = 'https://management.azure.com'
73- self ._config = BatchManagementClientConfiguration (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 = BatchManagementClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
7465 self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
7566
7667 client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
7768 self ._serialize = Serializer (client_models )
78- self ._serialize .client_side_validation = False
7969 self ._deserialize = Deserializer (client_models )
80-
81- self .batch_account = BatchAccountOperations (
82- self ._client , self ._config , self ._serialize , self ._deserialize )
83- self .application_package = ApplicationPackageOperations (
84- self ._client , self ._config , self ._serialize , self ._deserialize )
85- self .application = ApplicationOperations (
86- self ._client , self ._config , self ._serialize , self ._deserialize )
87- self .location = LocationOperations (
88- self ._client , self ._config , self ._serialize , self ._deserialize )
89- self .operations = Operations (
90- self ._client , self ._config , self ._serialize , self ._deserialize )
91- self .certificate = CertificateOperations (
92- self ._client , self ._config , self ._serialize , self ._deserialize )
93- self .private_link_resource = PrivateLinkResourceOperations (
94- self ._client , self ._config , self ._serialize , self ._deserialize )
95- self .private_endpoint_connection = PrivateEndpointConnectionOperations (
96- self ._client , self ._config , self ._serialize , self ._deserialize )
97- self .pool = PoolOperations (
98- self ._client , self ._config , self ._serialize , self ._deserialize )
99-
100- def _send_request (self , http_request , ** kwargs ):
101- # type: (HttpRequest, Any) -> HttpResponse
70+ self ._serialize .client_side_validation = False
71+ self .batch_account = BatchAccountOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
72+ self .application_package = ApplicationPackageOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
73+ self .application = ApplicationOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
74+ self .location = LocationOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
75+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
76+ self .certificate = CertificateOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
77+ self .private_link_resource = PrivateLinkResourceOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
78+ self .private_endpoint_connection = PrivateEndpointConnectionOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
79+ self .pool = PoolOperations (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 :
10287 """Runs the network request through the client's chained policies.
10388
104- :param http_request: The network request you want to make. Required.
105- :type http_request: ~azure.core.pipeline.transport.HttpRequest
106- :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.
107100 :return: The response of your network call. Does not do error handling on your response.
108- :rtype: ~azure.core.pipeline.transport .HttpResponse
101+ :rtype: ~azure.core.rest .HttpResponse
109102 """
110- path_format_arguments = {
111- 'subscriptionId' : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , 'str' ),
112- }
113- http_request .url = self ._client .format_url (http_request .url , ** path_format_arguments )
114- stream = kwargs .pop ("stream" , True )
115- pipeline_response = self ._client ._pipeline .run (http_request , stream = stream , ** kwargs )
116- 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 )
117107
118108 def close (self ):
119109 # type: () -> None
0 commit comments