66# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77# --------------------------------------------------------------------------
88
9+ from copy import deepcopy
910from typing import TYPE_CHECKING
1011
1112from azure .mgmt .core import ARMPipelineClient
1213from msrest import Deserializer , Serializer
1314
15+ from . import models
16+ from ._configuration import AzureReservationAPIConfiguration
17+ from .operations import AzureReservationAPIOperationsMixin , CalculateExchangeOperations , ExchangeOperations , OperationOperations , QuotaOperations , QuotaRequestStatusOperations , ReservationOperations , ReservationOrderOperations
18+
1419if TYPE_CHECKING :
1520 # pylint: disable=unused-import,ungrouped-imports
1621 from typing import Any , Optional
1722
1823 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-
24+ from azure .core .rest import HttpRequest , HttpResponse
3225
3326class AzureReservationAPI (AzureReservationAPIOperationsMixin ):
3427 """This API describe Azure Reservation.
@@ -49,56 +42,61 @@ class AzureReservationAPI(AzureReservationAPIOperationsMixin):
4942 :vartype quota_request_status: azure.mgmt.reservations.operations.QuotaRequestStatusOperations
5043 :param credential: Credential needed for the client to connect to Azure.
5144 :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.
45+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
46+ :type base_url: str
47+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
48+ Retry-After header is present.
5449 """
5550
5651 def __init__ (
5752 self ,
5853 credential , # type: "TokenCredential"
59- base_url = None , # type: Optional[ str]
54+ base_url = "https://management.azure.com" , # type: str
6055 ** kwargs # type: Any
6156 ):
6257 # type: (...) -> None
63- if not base_url :
64- base_url = 'https://management.azure.com'
65- self ._config = AzureReservationAPIConfiguration (credential , ** kwargs )
58+ self ._config = AzureReservationAPIConfiguration (credential = credential , ** kwargs )
6659 self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
6760
6861 client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
6962 self ._serialize = Serializer (client_models )
70- self ._serialize .client_side_validation = False
7163 self ._deserialize = Deserializer (client_models )
64+ self ._serialize .client_side_validation = False
65+ self .reservation = ReservationOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
66+ self .reservation_order = ReservationOrderOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
67+ self .operation = OperationOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
68+ self .calculate_exchange = CalculateExchangeOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
69+ self .exchange = ExchangeOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
70+ self .quota = QuotaOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
71+ self .quota_request_status = QuotaRequestStatusOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
72+
7273
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
74+ def _send_request (
75+ self ,
76+ request , # type: HttpRequest
77+ ** kwargs # type: Any
78+ ):
79+ # type: (...) -> HttpResponse
9080 """Runs the network request through the client's chained policies.
9181
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.
82+ >>> from azure.core.rest import HttpRequest
83+ >>> request = HttpRequest("GET", "https://www.example.org/")
84+ <HttpRequest [GET], url: 'https://www.example.org/'>
85+ >>> response = client._send_request(request)
86+ <HttpResponse: 200 OK>
87+
88+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
89+
90+ :param request: The network request you want to make. Required.
91+ :type request: ~azure.core.rest.HttpRequest
92+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
9593 :return: The response of your network call. Does not do error handling on your response.
96- :rtype: ~azure.core.pipeline.transport .HttpResponse
94+ :rtype: ~azure.core.rest .HttpResponse
9795 """
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
96+
97+ request_copy = deepcopy ( request )
98+ request_copy . url = self ._client .format_url ( request_copy . url )
99+ return self . _client . send_request ( request_copy , ** kwargs )
102100
103101 def close (self ):
104102 # type: () -> None
0 commit comments