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 AzureReservationAPIConfiguration
18+ from .operations import AzureReservationAPIOperationsMixin , CalculateExchangeOperations , ExchangeOperations , OperationOperations , QuotaOperations , QuotaRequestStatusOperations , ReservationOperations , ReservationOrderOperations
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 AzureReservationAPIConfiguration
22- from .operations import ReservationOperations
23- from .operations import AzureReservationAPIOperationsMixin
24- from .operations import ReservationOrderOperations
25- from .operations import OperationOperations
26- from .operations import CalculateExchangeOperations
27- from .operations import ExchangeOperations
28- from .operations import QuotaOperations
29- from .operations import QuotaRequestStatusOperations
30- from . import models
31-
3223
3324class AzureReservationAPI (AzureReservationAPIOperationsMixin ):
3425 """This API describe Azure Reservation.
@@ -49,56 +40,59 @@ class AzureReservationAPI(AzureReservationAPIOperationsMixin):
4940 :vartype quota_request_status: azure.mgmt.reservations.operations.QuotaRequestStatusOperations
5041 :param credential: Credential needed for the client to connect to Azure.
5142 :type credential: ~azure.core.credentials.TokenCredential
52- :param str base_url: Service URL
53- :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.
5447 """
5548
5649 def __init__ (
5750 self ,
58- credential , # type: "TokenCredential"
59- base_url = None , # type: Optional[str]
60- ** kwargs # type: Any
61- ):
62- # type: (...) -> None
63- if not base_url :
64- base_url = 'https://management.azure.com'
65- self ._config = AzureReservationAPIConfiguration (credential , ** kwargs )
51+ credential : "TokenCredential" ,
52+ base_url : str = "https://management.azure.com" ,
53+ ** kwargs : Any
54+ ) -> None :
55+ self ._config = AzureReservationAPIConfiguration (credential = credential , ** kwargs )
6656 self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
6757
6858 client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
6959 self ._serialize = Serializer (client_models )
70- self ._serialize .client_side_validation = False
7160 self ._deserialize = Deserializer (client_models )
61+ self ._serialize .client_side_validation = False
62+ self .reservation = ReservationOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
63+ self .reservation_order = ReservationOrderOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
64+ self .operation = OperationOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
65+ self .calculate_exchange = CalculateExchangeOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
66+ self .exchange = ExchangeOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
67+ self .quota = QuotaOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
68+ self .quota_request_status = QuotaRequestStatusOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
7269
73- self .reservation = ReservationOperations (
74- self ._client , self ._config , self ._serialize , self ._deserialize )
75- self .reservation_order = ReservationOrderOperations (
76- self ._client , self ._config , self ._serialize , self ._deserialize )
77- self .operation = OperationOperations (
78- self ._client , self ._config , self ._serialize , self ._deserialize )
79- self .calculate_exchange = CalculateExchangeOperations (
80- self ._client , self ._config , self ._serialize , self ._deserialize )
81- self .exchange = ExchangeOperations (
82- self ._client , self ._config , self ._serialize , self ._deserialize )
83- self .quota = QuotaOperations (
84- self ._client , self ._config , self ._serialize , self ._deserialize )
85- self .quota_request_status = QuotaRequestStatusOperations (
86- self ._client , self ._config , self ._serialize , self ._deserialize )
87-
88- def _send_request (self , http_request , ** kwargs ):
89- # type: (HttpRequest, Any) -> HttpResponse
70+
71+ def _send_request (
72+ self ,
73+ request , # type: HttpRequest
74+ ** kwargs : Any
75+ ) -> HttpResponse :
9076 """Runs the network request through the client's chained policies.
9177
92- :param http_request: The network request you want to make. Required.
93- :type http_request: ~azure.core.pipeline.transport.HttpRequest
94- :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.
9589 :return: The response of your network call. Does not do error handling on your response.
96- :rtype: ~azure.core.pipeline.transport .HttpResponse
90+ :rtype: ~azure.core.rest .HttpResponse
9791 """
98- http_request . url = self . _client . format_url ( http_request . url )
99- stream = kwargs . pop ( "stream" , True )
100- pipeline_response = self ._client ._pipeline . run ( http_request , stream = stream , ** kwargs )
101- 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 )
10296
10397 def close (self ):
10498 # type: () -> None
0 commit comments