Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sdk/reservations/azure-mgmt-reservations/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "3751704f5318f1175875c94b66af769db917f2d3",
"commit": "7775b97f53c75feef63e98fac8638f24345a2132",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.2.16",
"@autorest/python@6.4.0",
"@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.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"readme": "specification/reservations/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,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.
Expand Down Expand Up @@ -633,8 +633,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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,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.
Expand Down Expand Up @@ -438,8 +438,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.
Expand Down Expand Up @@ -649,8 +649,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.
Expand Down Expand Up @@ -1015,7 +1015,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'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -392,8 +392,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.
Expand Down Expand Up @@ -581,8 +581,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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -103,20 +103,24 @@ async def _post_initial(

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"}

Expand All @@ -128,7 +132,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.
Expand All @@ -148,16 +152,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.
Expand All @@ -177,24 +183,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.
Expand All @@ -207,17 +215,19 @@ 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 {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

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)
Expand All @@ -235,13 +245,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:
Expand Down
Loading