diff --git a/sdk/reservations/azure-mgmt-reservations/_meta.json b/sdk/reservations/azure-mgmt-reservations/_meta.json index 484ec4c5386d..689bf068cdc2 100644 --- a/sdk/reservations/azure-mgmt-reservations/_meta.json +++ b/sdk/reservations/azure-mgmt-reservations/_meta.json @@ -1,11 +1,11 @@ { - "commit": "3751704f5318f1175875c94b66af769db917f2d3", + "commit": "8f54b1a7488beedbd4eab5b538018173be5e9c54", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.16", + "@autorest/python@6.4.3", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/reservations/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/reservations/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.3 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/reservations/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py index 48be8e85ee18..af6bfc121153 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py @@ -68,7 +68,7 @@ def __init__( self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = AzureReservationAPIConfiguration(credential=credential, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -121,5 +121,5 @@ def __enter__(self) -> "AzureReservationAPI": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py index f30401ec2040..e5754a47ce68 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_azure_reservation_api.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_azure_reservation_api.py index 464ed0cff67a..52a6e8d015fe 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_azure_reservation_api.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_azure_reservation_api.py @@ -69,7 +69,7 @@ def __init__( self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = AzureReservationAPIConfiguration(credential=credential, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -122,5 +122,5 @@ async def __aenter__(self) -> "AzureReservationAPI": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_azure_reservation_api_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_azure_reservation_api_operations.py index b695c4fd9e73..09fe3adb1a5a 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_azure_reservation_api_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_azure_reservation_api_operations.py @@ -142,8 +142,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -196,8 +197,9 @@ async def get_applied_reservation_list(self, subscription_id: str, **kwargs: Any request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_exchange_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_exchange_operations.py index 8bbacc2ec04e..f23e50779caf 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_exchange_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_exchange_operations.py @@ -96,8 +96,9 @@ async def _post_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -191,7 +192,7 @@ async def begin_post( Calculates price for exchanging ``Reservations`` if there are no policy errors. :param body: Request containing purchases and refunds that need to be executed. Is either a - model type or a IO type. Required. + CalculateExchangeRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.CalculateExchangeRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_refund_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_refund_operations.py index 25409ef2cf3c..76788303128d 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_refund_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_refund_operations.py @@ -113,8 +113,8 @@ async def post( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed for calculating refund of a reservation. Is either a model type - or a IO type. Required. + :param body: Information needed for calculating refund of a reservation. Is either a + CalculateRefundRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.CalculateRefundRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -160,8 +160,9 @@ async def post( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_exchange_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_exchange_operations.py index 8d714f8a0988..db4da9a551ee 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_exchange_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_exchange_operations.py @@ -96,8 +96,9 @@ async def _post_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -191,7 +192,7 @@ async def begin_post( Returns one or more ``Reservations`` in exchange for one or more ``Reservation`` purchases. :param body: Request containing the refunds and purchases that need to be executed. Is either a - model type or a IO type. Required. + ExchangeRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.ExchangeRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_operation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_operation_operations.py index 10336203e255..012aaf57ba68 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_operation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_operation_operations.py @@ -112,8 +112,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_operations.py index c17b51d91b23..89604ffec619 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_operations.py @@ -114,8 +114,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -189,8 +190,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -353,8 +355,8 @@ async def begin_create_or_update( Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. Required. :type resource_name: str - :param create_quota_request: Quota requests payload. Is either a model type or a IO type. - Required. + :param create_quota_request: Quota requests payload. Is either a CurrentQuotaLimitBase type or + a IO type. Required. :type create_quota_request: ~azure.mgmt.reservations.models.CurrentQuotaLimitBase or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -478,8 +480,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,8 +636,8 @@ async def begin_update( Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. Required. :type resource_name: str - :param create_quota_request: Payload for the quota request. Is either a model type or a IO - type. Required. + :param create_quota_request: Payload for the quota request. Is either a CurrentQuotaLimitBase + type or a IO type. Required. :type create_quota_request: ~azure.mgmt.reservations.models.CurrentQuotaLimitBase or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -774,8 +777,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_request_status_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_request_status_operations.py index 481d7a3c94fc..5709cb3868aa 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_request_status_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_quota_request_status_operations.py @@ -106,8 +106,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,8 +220,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py index 5bf8999c8b60..2da44f011183 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py @@ -115,8 +115,9 @@ async def _available_scopes_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -229,8 +230,8 @@ async def begin_available_scopes( :type reservation_order_id: str :param reservation_id: Id of the reservation item. Required. :type reservation_id: str - :param body: Scopes to be checked for eligibility. Is either a model type or a IO type. - Required. + :param body: Scopes to be checked for eligibility. Is either a AvailableScopeRequest type or a + IO type. Required. :type body: ~azure.mgmt.reservations.models.AvailableScopeRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -336,8 +337,9 @@ async def _split_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -438,8 +440,8 @@ async def begin_split( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed to Split a reservation item. Is either a model type or a IO - type. Required. + :param body: Information needed to Split a reservation item. Is either a SplitRequest type or a + IO type. Required. :type body: ~azure.mgmt.reservations.models.SplitRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -544,8 +546,9 @@ async def _merge_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -649,8 +652,8 @@ async def begin_merge( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed for commercial request for a reservation. Is either a model - type or a IO type. Required. + :param body: Information needed for commercial request for a reservation. Is either a + MergeRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.MergeRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -774,8 +777,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -835,8 +839,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -897,8 +902,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1015,7 +1021,7 @@ async def begin_update( :type reservation_order_id: str :param reservation_id: Id of the reservation item. Required. :type reservation_id: str - :param parameters: Information needed to patch a reservation item. Is either a model type or a + :param parameters: Information needed to patch a reservation item. Is either a Patch type or a IO type. Required. :type parameters: ~azure.mgmt.reservations.models.Patch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1127,8 +1133,9 @@ async def archive( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1187,8 +1194,9 @@ async def unarchive( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1268,8 +1276,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1374,8 +1383,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_order_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_order_operations.py index b9b8db867ab8..e66167d5961b 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_order_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_order_operations.py @@ -112,8 +112,8 @@ async def calculate( Calculate price for placing a ``ReservationOrder``. - :param body: Information needed for calculate or purchase reservation. Is either a model type - or a IO type. Required. + :param body: Information needed for calculate or purchase reservation. Is either a + PurchaseRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.PurchaseRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -158,8 +158,9 @@ async def calculate( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,8 +235,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -289,8 +291,9 @@ async def _purchase_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -392,8 +395,8 @@ async def begin_purchase( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed for calculate or purchase reservation. Is either a model type - or a IO type. Required. + :param body: Information needed for calculate or purchase reservation. Is either a + PurchaseRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.PurchaseRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -501,8 +504,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -581,8 +585,8 @@ async def change_directory( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed to change directory of reservation order. Is either a model - type or a IO type. Required. + :param body: Information needed to change directory of reservation order. Is either a + ChangeDirectoryRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.ChangeDirectoryRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -628,8 +632,9 @@ async def change_directory( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_return_operations_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_return_operations_operations.py index 0b82c6c62bea..8aa42db67501 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_return_operations_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_return_operations_operations.py @@ -60,7 +60,7 @@ def __init__(self, *args, **kwargs) -> None: async def _post_initial( self, reservation_order_id: str, body: Union[_models.RefundRequest, IO], **kwargs: Any - ) -> _models.RefundResponse: + ) -> Union[_models.ReservationOrderResponse, _models.RefundResponse]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -74,7 +74,7 @@ async def _post_initial( api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RefundResponse] = kwargs.pop("cls", None) + cls: ClsType[Union[_models.ReservationOrderResponse, _models.RefundResponse]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -97,26 +97,31 @@ async def _post_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if response.status_code == 200: + deserialized = self._deserialize("ReservationOrderResponse", pipeline_response) - deserialized = self._deserialize("RefundResponse", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("RefundResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore _post_initial.metadata = {"url": "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return"} @@ -128,7 +133,7 @@ async def begin_post( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RefundResponse]: + ) -> AsyncLROPoller[_models.ReservationOrderResponse]: """Return a reservation. Return a reservation and get refund information. @@ -148,16 +153,18 @@ async def begin_post( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RefundResponse or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.RefundResponse] + :return: An instance of AsyncLROPoller that returns either ReservationOrderResponse or An + instance of AsyncLROPoller that returns either RefundResponse or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.ReservationOrderResponse] or + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def begin_post( self, reservation_order_id: str, body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RefundResponse]: + ) -> AsyncLROPoller[_models.ReservationOrderResponse]: """Return a reservation. Return a reservation and get refund information. @@ -177,24 +184,26 @@ async def begin_post( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RefundResponse or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.RefundResponse] + :return: An instance of AsyncLROPoller that returns either ReservationOrderResponse or An + instance of AsyncLROPoller that returns either RefundResponse or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.ReservationOrderResponse] or + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_post( self, reservation_order_id: str, body: Union[_models.RefundRequest, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.RefundResponse]: + ) -> AsyncLROPoller[_models.ReservationOrderResponse]: """Return a reservation. Return a reservation and get refund information. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed for returning reservation. Is either a model type or a IO type. - Required. + :param body: Information needed for returning reservation. Is either a RefundRequest type or a + IO type. Required. :type body: ~azure.mgmt.reservations.models.RefundRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -207,9 +216,11 @@ async def begin_post( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RefundResponse or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.RefundResponse] + :return: An instance of AsyncLROPoller that returns either ReservationOrderResponse or An + instance of AsyncLROPoller that returns either RefundResponse or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.ReservationOrderResponse] or + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -217,7 +228,7 @@ async def begin_post( api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RefundResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.ReservationOrderResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -235,13 +246,9 @@ async def begin_post( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("RefundResponse", pipeline_response) + deserialized = self._deserialize("ReservationOrderResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py index 139b6eeb7976..2ee33e288759 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py @@ -850,19 +850,38 @@ class CatalogMsrp(_serialization.Model): :ivar p1_y: Amount in pricing currency. Tax not included. :vartype p1_y: ~azure.mgmt.reservations.models.Price + :ivar p3_y: Amount in pricing currency. Tax not included. + :vartype p3_y: ~azure.mgmt.reservations.models.Price + :ivar p5_y: Amount in pricing currency. Tax not included. + :vartype p5_y: ~azure.mgmt.reservations.models.Price """ _attribute_map = { "p1_y": {"key": "p1Y", "type": "Price"}, + "p3_y": {"key": "p3Y", "type": "Price"}, + "p5_y": {"key": "p5Y", "type": "Price"}, } - def __init__(self, *, p1_y: Optional["_models.Price"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + p1_y: Optional["_models.Price"] = None, + p3_y: Optional["_models.Price"] = None, + p5_y: Optional["_models.Price"] = None, + **kwargs: Any + ) -> None: """ :keyword p1_y: Amount in pricing currency. Tax not included. :paramtype p1_y: ~azure.mgmt.reservations.models.Price + :keyword p3_y: Amount in pricing currency. Tax not included. + :paramtype p3_y: ~azure.mgmt.reservations.models.Price + :keyword p5_y: Amount in pricing currency. Tax not included. + :paramtype p5_y: ~azure.mgmt.reservations.models.Price """ super().__init__(**kwargs) self.p1_y = p1_y + self.p3_y = p3_y + self.p5_y = p5_y class CatalogsResult(_serialization.Model): @@ -1793,7 +1812,8 @@ class Patch(_serialization.Model): "ManagementGroup". :vartype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType :ivar applied_scopes: List of the subscriptions that the benefit will be applied. Do not - specify if AppliedScopeType is Shared. + specify if AppliedScopeType is Shared. This property will be deprecated and replaced by + appliedScopeProperties instead for Single AppliedScopeType. :vartype applied_scopes: list[str] :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is @@ -1844,7 +1864,8 @@ def __init__( and "ManagementGroup". :paramtype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType :keyword applied_scopes: List of the subscriptions that the benefit will be applied. Do not - specify if AppliedScopeType is Shared. + specify if AppliedScopeType is Shared. This property will be deprecated and replaced by + appliedScopeProperties instead for Single AppliedScopeType. :paramtype applied_scopes: list[str] :keyword applied_scope_properties: Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType @@ -2075,7 +2096,8 @@ class PurchaseRequest(_serialization.Model): # pylint: disable=too-many-instanc "ManagementGroup". :vartype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType :ivar applied_scopes: List of the subscriptions that the benefit will be applied. Do not - specify if AppliedScopeType is Shared. + specify if AppliedScopeType is Shared. This property will be deprecated and replaced by + appliedScopeProperties instead for Single AppliedScopeType. :vartype applied_scopes: list[str] :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is @@ -2159,7 +2181,8 @@ def __init__( and "ManagementGroup". :paramtype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType :keyword applied_scopes: List of the subscriptions that the benefit will be applied. Do not - specify if AppliedScopeType is Shared. + specify if AppliedScopeType is Shared. This property will be deprecated and replaced by + appliedScopeProperties instead for Single AppliedScopeType. :paramtype applied_scopes: list[str] :keyword applied_scope_properties: Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py index 81344fc6ab41..b39b73ae919d 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py @@ -218,8 +218,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -272,8 +273,9 @@ def get_applied_reservation_list(self, subscription_id: str, **kwargs: Any) -> _ request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_exchange_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_exchange_operations.py index 6cd2da2deebb..05ac93b8952e 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_exchange_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_exchange_operations.py @@ -120,8 +120,9 @@ def _post_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -215,7 +216,7 @@ def begin_post( Calculates price for exchanging ``Reservations`` if there are no policy errors. :param body: Request containing purchases and refunds that need to be executed. Is either a - model type or a IO type. Required. + CalculateExchangeRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.CalculateExchangeRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_refund_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_refund_operations.py index f2881e9be3aa..c817f58dd1e1 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_refund_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_refund_operations.py @@ -144,8 +144,8 @@ def post( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed for calculating refund of a reservation. Is either a model type - or a IO type. Required. + :param body: Information needed for calculating refund of a reservation. Is either a + CalculateRefundRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.CalculateRefundRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -191,8 +191,9 @@ def post( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_exchange_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_exchange_operations.py index 5c3d35fc4762..2ba2ee3fd5b3 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_exchange_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_exchange_operations.py @@ -120,8 +120,9 @@ def _post_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -215,7 +216,7 @@ def begin_post( Returns one or more ``Reservations`` in exchange for one or more ``Reservation`` purchases. :param body: Request containing the refunds and purchases that need to be executed. Is either a - model type or a IO type. Required. + ExchangeRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.ExchangeRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_operation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_operation_operations.py index bf3b599edaa0..2320e172654f 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_operation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_operation_operations.py @@ -132,8 +132,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_operations.py index ea8080c32a3a..c4293126cbba 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_operations.py @@ -241,8 +241,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,8 +317,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -476,8 +478,8 @@ def begin_create_or_update( Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. Required. :type resource_name: str - :param create_quota_request: Quota requests payload. Is either a model type or a IO type. - Required. + :param create_quota_request: Quota requests payload. Is either a CurrentQuotaLimitBase type or + a IO type. Required. :type create_quota_request: ~azure.mgmt.reservations.models.CurrentQuotaLimitBase or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -598,8 +600,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -749,8 +752,8 @@ def begin_update( Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. Required. :type resource_name: str - :param create_quota_request: Payload for the quota request. Is either a model type or a IO - type. Required. + :param create_quota_request: Payload for the quota request. Is either a CurrentQuotaLimitBase + type or a IO type. Required. :type create_quota_request: ~azure.mgmt.reservations.models.CurrentQuotaLimitBase or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -886,8 +889,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_request_status_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_request_status_operations.py index f86a2fcfd396..31eda8d54d29 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_request_status_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_quota_request_status_operations.py @@ -181,8 +181,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,8 +294,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py index f7c679bacfc6..2c3f0a52a654 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py @@ -403,8 +403,9 @@ def _available_scopes_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,8 +516,8 @@ def begin_available_scopes( :type reservation_order_id: str :param reservation_id: Id of the reservation item. Required. :type reservation_id: str - :param body: Scopes to be checked for eligibility. Is either a model type or a IO type. - Required. + :param body: Scopes to be checked for eligibility. Is either a AvailableScopeRequest type or a + IO type. Required. :type body: ~azure.mgmt.reservations.models.AvailableScopeRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -621,8 +622,9 @@ def _split_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -723,8 +725,8 @@ def begin_split( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed to Split a reservation item. Is either a model type or a IO - type. Required. + :param body: Information needed to Split a reservation item. Is either a SplitRequest type or a + IO type. Required. :type body: ~azure.mgmt.reservations.models.SplitRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -829,8 +831,9 @@ def _merge_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -934,8 +937,8 @@ def begin_merge( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed for commercial request for a reservation. Is either a model - type or a IO type. Required. + :param body: Information needed for commercial request for a reservation. Is either a + MergeRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.MergeRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1058,8 +1061,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1119,8 +1123,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1181,8 +1186,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1299,7 +1305,7 @@ def begin_update( :type reservation_order_id: str :param reservation_id: Id of the reservation item. Required. :type reservation_id: str - :param parameters: Information needed to patch a reservation item. Is either a model type or a + :param parameters: Information needed to patch a reservation item. Is either a Patch type or a IO type. Required. :type parameters: ~azure.mgmt.reservations.models.Patch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1410,8 +1416,9 @@ def archive( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1470,8 +1477,9 @@ def unarchive( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1550,8 +1558,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1655,8 +1664,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_order_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_order_operations.py index e9015230bf9b..b32eff038626 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_order_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_order_operations.py @@ -228,8 +228,8 @@ def calculate(self, body: Union[_models.PurchaseRequest, IO], **kwargs: Any) -> Calculate price for placing a ``ReservationOrder``. - :param body: Information needed for calculate or purchase reservation. Is either a model type - or a IO type. Required. + :param body: Information needed for calculate or purchase reservation. Is either a + PurchaseRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.PurchaseRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -274,8 +274,9 @@ def calculate(self, body: Union[_models.PurchaseRequest, IO], **kwargs: Any) -> request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -349,8 +350,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -404,8 +406,9 @@ def _purchase_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,8 +508,8 @@ def begin_purchase( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed for calculate or purchase reservation. Is either a model type - or a IO type. Required. + :param body: Information needed for calculate or purchase reservation. Is either a + PurchaseRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.PurchaseRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -613,8 +616,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -693,8 +697,8 @@ def change_directory( :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed to change directory of reservation order. Is either a model - type or a IO type. Required. + :param body: Information needed to change directory of reservation order. Is either a + ChangeDirectoryRequest type or a IO type. Required. :type body: ~azure.mgmt.reservations.models.ChangeDirectoryRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -740,8 +744,9 @@ def change_directory( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_return_operations_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_return_operations_operations.py index 83fbadec45d9..e849a71c7282 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_return_operations_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_return_operations_operations.py @@ -89,7 +89,7 @@ def __init__(self, *args, **kwargs): def _post_initial( self, reservation_order_id: str, body: Union[_models.RefundRequest, IO], **kwargs: Any - ) -> _models.RefundResponse: + ) -> Union[_models.ReservationOrderResponse, _models.RefundResponse]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -103,7 +103,7 @@ def _post_initial( api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RefundResponse] = kwargs.pop("cls", None) + cls: ClsType[Union[_models.ReservationOrderResponse, _models.RefundResponse]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,26 +126,31 @@ def _post_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if response.status_code == 200: + deserialized = self._deserialize("ReservationOrderResponse", pipeline_response) - deserialized = self._deserialize("RefundResponse", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("RefundResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore _post_initial.metadata = {"url": "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return"} @@ -157,7 +162,7 @@ def begin_post( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RefundResponse]: + ) -> LROPoller[_models.ReservationOrderResponse]: """Return a reservation. Return a reservation and get refund information. @@ -177,16 +182,17 @@ def begin_post( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RefundResponse or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.RefundResponse] + :return: An instance of LROPoller that returns either ReservationOrderResponse or An instance + of LROPoller that returns either RefundResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.ReservationOrderResponse] + or ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @overload def begin_post( self, reservation_order_id: str, body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RefundResponse]: + ) -> LROPoller[_models.ReservationOrderResponse]: """Return a reservation. Return a reservation and get refund information. @@ -206,24 +212,25 @@ def begin_post( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RefundResponse or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.RefundResponse] + :return: An instance of LROPoller that returns either ReservationOrderResponse or An instance + of LROPoller that returns either RefundResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.ReservationOrderResponse] + or ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def begin_post( self, reservation_order_id: str, body: Union[_models.RefundRequest, IO], **kwargs: Any - ) -> LROPoller[_models.RefundResponse]: + ) -> LROPoller[_models.ReservationOrderResponse]: """Return a reservation. Return a reservation and get refund information. :param reservation_order_id: Order Id of the reservation. Required. :type reservation_order_id: str - :param body: Information needed for returning reservation. Is either a model type or a IO type. - Required. + :param body: Information needed for returning reservation. Is either a RefundRequest type or a + IO type. Required. :type body: ~azure.mgmt.reservations.models.RefundRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -236,9 +243,10 @@ def begin_post( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RefundResponse or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.RefundResponse] + :return: An instance of LROPoller that returns either ReservationOrderResponse or An instance + of LROPoller that returns either RefundResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.ReservationOrderResponse] + or ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.RefundResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -246,7 +254,7 @@ def begin_post( api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RefundResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.ReservationOrderResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -264,13 +272,9 @@ def begin_post( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("RefundResponse", pipeline_response) + deserialized = self._deserialize("ReservationOrderResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: diff --git a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_quota_request_status_in_progress.py b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_quota_request_status_in_progress.py index 8ac441fdb796..fac3646705a1 100644 --- a/sdk/reservations/azure-mgmt-reservations/generated_samples/get_quota_request_status_in_progress.py +++ b/sdk/reservations/azure-mgmt-reservations/generated_samples/get_quota_request_status_in_progress.py @@ -31,7 +31,7 @@ def main(): response = client.quota_request_status.get( subscription_id="00000000-0000-0000-0000-000000000000", provider_id="Microsoft.Compute", - location="eastus", + location="westus", id="2B5C8515-37D8-4B6A-879B-CD641A2CF605", ) print(response)