diff --git a/sdk/reservations/azure-mgmt-reservations/_meta.json b/sdk/reservations/azure-mgmt-reservations/_meta.json index 2fbac189a8674..a415778e22fdc 100644 --- a/sdk/reservations/azure-mgmt-reservations/_meta.json +++ b/sdk/reservations/azure-mgmt-reservations/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.0", - "@autorest/modelerfour@4.19.1" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "aac59eea2fb1c142fd371c9c1886f33713e494a2", + "commit": "5a1b7262be0a4f6a9004d35403b854429475cdf4", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/reservations/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.1 --version=3.4.2", + "autorest_command": "autorest specification/reservations/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/reservations/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/__init__.py index 5fe5ad755e816..b532c1a982f0c 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AzureReservationAPI'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() 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 2ab9b6c599750..a69f3f3f6d0af 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 @@ -6,29 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import AzureReservationAPIConfiguration +from .operations import AzureReservationAPIOperationsMixin, CalculateExchangeOperations, ExchangeOperations, OperationOperations, QuotaOperations, QuotaRequestStatusOperations, ReservationOperations, ReservationOrderOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import AzureReservationAPIConfiguration -from .operations import ReservationOperations -from .operations import AzureReservationAPIOperationsMixin -from .operations import ReservationOrderOperations -from .operations import OperationOperations -from .operations import CalculateExchangeOperations -from .operations import ExchangeOperations -from .operations import QuotaOperations -from .operations import QuotaRequestStatusOperations -from . import models - class AzureReservationAPI(AzureReservationAPIOperationsMixin): """This API describe Azure Reservation. @@ -49,56 +40,59 @@ class AzureReservationAPI(AzureReservationAPIOperationsMixin): :vartype quota_request_status: azure.mgmt.reservations.operations.QuotaRequestStatusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureReservationAPIConfiguration(credential, **kwargs) + 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) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.reservation = ReservationOperations(self._client, self._config, self._serialize, self._deserialize) + self.reservation_order = ReservationOrderOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) + self.calculate_exchange = CalculateExchangeOperations(self._client, self._config, self._serialize, self._deserialize) + self.exchange = ExchangeOperations(self._client, self._config, self._serialize, self._deserialize) + self.quota = QuotaOperations(self._client, self._config, self._serialize, self._deserialize) + self.quota_request_status = QuotaRequestStatusOperations(self._client, self._config, self._serialize, self._deserialize) - self.reservation = ReservationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.reservation_order = ReservationOrderOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.calculate_exchange = CalculateExchangeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.exchange = ExchangeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.quota = QuotaOperations( - self._client, self._config, self._serialize, self._deserialize) - self.quota_request_status = QuotaRequestStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - http_request.url = self._client.format_url(http_request.url) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_configuration.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_configuration.py index 3d2496b86f22f..01b3387fe36f5 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_configuration.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -33,13 +31,12 @@ class AzureReservationAPIConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + **kwargs: Any + ) -> None: + super(AzureReservationAPIConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(AzureReservationAPIConfiguration, self).__init__(**kwargs) self.credential = credential self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) @@ -61,4 +58,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_metadata.json b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_metadata.json index 3892046615ea3..bce5c8ee40b7c 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_metadata.json +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_metadata.json @@ -1,17 +1,17 @@ { "chosen_version": "", - "total_api_version_list": ["2020-10-01-preview", "2020-10-25"], + "total_api_version_list": ["2020-10-25", "2021-07-01"], "client": { "name": "AzureReservationAPI", "filename": "_azure_reservation_api", "description": "This API describe Azure Reservation.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureReservationAPIConfiguration\"], \"._operations_mixin\": [\"AzureReservationAPIOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureReservationAPIConfiguration\"], \"._operations_mixin\": [\"AzureReservationAPIOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureReservationAPIConfiguration\"], \"._operations_mixin\": [\"AzureReservationAPIOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureReservationAPIConfiguration\"], \"._operations_mixin\": [\"AzureReservationAPIOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -62,7 +62,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -79,11 +79,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "reservation": "ReservationOperations", @@ -95,24 +94,24 @@ "quota_request_status": "QuotaRequestStatusOperations" }, "operation_mixins": { - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"List\", \"Optional\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"List\", \"Optional\"]}}}", "operations": { "get_catalog" : { "sync": { - "signature": "def get_catalog(\n self,\n subscription_id, # type: str\n reserved_resource_type, # type: str\n location=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Get the regions and skus that are available for RI purchase for the specified Azure subscription.\n\nGet the regions and skus that are available for RI purchase for the specified Azure\nsubscription.\n\n:param subscription_id: Id of the subscription.\n:type subscription_id: str\n:param reserved_resource_type: The type of the resource for which the skus should be provided.\n:type reserved_resource_type: str\n:param location: Filters the skus based on the location specified in this parameter. This can\n be an azure region or global.\n:type location: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: list of Catalog, or the result of cls(response)\n:rtype: list[~azure.mgmt.reservations.models.Catalog]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "def get_catalog(\n self,\n subscription_id, # type: str\n reserved_resource_type=None, # type: Optional[str]\n location=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e List[\"_models.Catalog\"]\n", + "doc": "\"\"\"Get the regions and skus that are available for RI purchase for the specified Azure\nsubscription.\n\nGet the regions and skus that are available for RI purchase for the specified Azure\nsubscription.\n\n:param subscription_id: Id of the subscription.\n:type subscription_id: str\n:param reserved_resource_type: The type of the resource for which the skus should be provided.\n:type reserved_resource_type: str\n:param location: Filters the skus based on the location specified in this parameter. This can\n be an azure region or global.\n:type location: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: list of Catalog, or the result of cls(response)\n:rtype: list[~azure.mgmt.reservations.models.Catalog]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def get_catalog(\n self,\n subscription_id: str,\n reserved_resource_type: str,\n location: Optional[str] = None,\n **kwargs: Any\n) -\u003e List[\"_models.Catalog\"]:\n", - "doc": "\"\"\"Get the regions and skus that are available for RI purchase for the specified Azure subscription.\n\nGet the regions and skus that are available for RI purchase for the specified Azure\nsubscription.\n\n:param subscription_id: Id of the subscription.\n:type subscription_id: str\n:param reserved_resource_type: The type of the resource for which the skus should be provided.\n:type reserved_resource_type: str\n:param location: Filters the skus based on the location specified in this parameter. This can\n be an azure region or global.\n:type location: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: list of Catalog, or the result of cls(response)\n:rtype: list[~azure.mgmt.reservations.models.Catalog]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "signature": "async def get_catalog(\n self,\n subscription_id: str,\n reserved_resource_type: Optional[str] = None,\n location: Optional[str] = None,\n **kwargs: Any\n) -\u003e List[\"_models.Catalog\"]:\n", + "doc": "\"\"\"Get the regions and skus that are available for RI purchase for the specified Azure\nsubscription.\n\nGet the regions and skus that are available for RI purchase for the specified Azure\nsubscription.\n\n:param subscription_id: Id of the subscription.\n:type subscription_id: str\n:param reserved_resource_type: The type of the resource for which the skus should be provided.\n:type reserved_resource_type: str\n:param location: Filters the skus based on the location specified in this parameter. This can\n be an azure region or global.\n:type location: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: list of Catalog, or the result of cls(response)\n:rtype: list[~azure.mgmt.reservations.models.Catalog]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "subscription_id, reserved_resource_type, location" }, "get_applied_reservation_list" : { "sync": { - "signature": "def get_applied_reservation_list(\n self,\n subscription_id, # type: str\n **kwargs # type: Any\n):\n", + "signature": "def get_applied_reservation_list(\n self,\n subscription_id, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.AppliedReservations\"\n", "doc": "\"\"\"Get list of applicable ``Reservation``\\ s.\n\nGet applicable ``Reservation``\\ s that are applied to this subscription or a resource group\nunder this subscription.\n\n:param subscription_id: Id of the subscription.\n:type subscription_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AppliedReservations, or the result of cls(response)\n:rtype: ~azure.mgmt.reservations.models.AppliedReservations\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_patch.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_vendor.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) 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 c47f66669f1bf..e5754a47ce68f 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 = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/__init__.py index 5c26f62f1e005..099f702e574c4 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_reservation_api import AzureReservationAPI __all__ = ['AzureReservationAPI'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() 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 10c59f7e0b711..22102cfcc7ebd 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 @@ -6,28 +6,21 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AzureReservationAPIConfiguration +from .operations import AzureReservationAPIOperationsMixin, CalculateExchangeOperations, ExchangeOperations, OperationOperations, QuotaOperations, QuotaRequestStatusOperations, ReservationOperations, ReservationOrderOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AzureReservationAPIConfiguration -from .operations import ReservationOperations -from .operations import AzureReservationAPIOperationsMixin -from .operations import ReservationOrderOperations -from .operations import OperationOperations -from .operations import CalculateExchangeOperations -from .operations import ExchangeOperations -from .operations import QuotaOperations -from .operations import QuotaRequestStatusOperations -from .. import models - - class AzureReservationAPI(AzureReservationAPIOperationsMixin): """This API describe Azure Reservation. @@ -44,57 +37,63 @@ class AzureReservationAPI(AzureReservationAPIOperationsMixin): :ivar quota: QuotaOperations operations :vartype quota: azure.mgmt.reservations.aio.operations.QuotaOperations :ivar quota_request_status: QuotaRequestStatusOperations operations - :vartype quota_request_status: azure.mgmt.reservations.aio.operations.QuotaRequestStatusOperations + :vartype quota_request_status: + azure.mgmt.reservations.aio.operations.QuotaRequestStatusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureReservationAPIConfiguration(credential, **kwargs) + self._config = AzureReservationAPIConfiguration(credential=credential, **kwargs) self._client = 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) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.reservation = ReservationOperations(self._client, self._config, self._serialize, self._deserialize) + self.reservation_order = ReservationOrderOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) + self.calculate_exchange = CalculateExchangeOperations(self._client, self._config, self._serialize, self._deserialize) + self.exchange = ExchangeOperations(self._client, self._config, self._serialize, self._deserialize) + self.quota = QuotaOperations(self._client, self._config, self._serialize, self._deserialize) + self.quota_request_status = QuotaRequestStatusOperations(self._client, self._config, self._serialize, self._deserialize) + - self.reservation = ReservationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.reservation_order = ReservationOrderOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.calculate_exchange = CalculateExchangeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.exchange = ExchangeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.quota = QuotaOperations( - self._client, self._config, self._serialize, self._deserialize) - self.quota_request_status = QuotaRequestStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - http_request.url = self._client.format_url(http_request.url) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_configuration.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_configuration.py index f42d222ecb6ae..e6b4d21786480 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_configuration.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -34,9 +34,9 @@ def __init__( credential: "AsyncTokenCredential", **kwargs: Any ) -> None: + super(AzureReservationAPIConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(AzureReservationAPIConfiguration, self).__init__(**kwargs) self.credential = credential self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) @@ -57,4 +57,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_patch.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file 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 bac01753a7cf3..3a62a048c15b9 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 @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._azure_reservation_api_operations import build_get_applied_reservation_list_request, build_get_catalog_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AzureReservationAPIOperationsMixin: + @distributed_trace_async async def get_catalog( self, subscription_id: str, - reserved_resource_type: str, + reserved_resource_type: Optional[str] = None, location: Optional[str] = None, **kwargs: Any ) -> List["_models.Catalog"]: - """Get the regions and skus that are available for RI purchase for the specified Azure subscription. + """Get the regions and skus that are available for RI purchase for the specified Azure + subscription. Get the regions and skus that are available for RI purchase for the specified Azure subscription. @@ -49,34 +55,23 @@ async def get_catalog( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_catalog.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['reservedResourceType'] = self._serialize.query("reserved_resource_type", reserved_resource_type, 'str') - if location is not None: - query_parameters['location'] = self._serialize.query("location", location, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_catalog_request( + subscription_id=subscription_id, + reserved_resource_type=reserved_resource_type, + location=location, + template_url=self.get_catalog.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[Catalog]', pipeline_response) @@ -85,8 +80,11 @@ async def get_catalog( return cls(pipeline_response, deserialized, {}) return deserialized + get_catalog.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs'} # type: ignore + + @distributed_trace_async async def get_applied_reservation_list( self, subscription_id: str, @@ -109,31 +107,21 @@ async def get_applied_reservation_list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_applied_reservation_list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_applied_reservation_list_request( + subscription_id=subscription_id, + template_url=self.get_applied_reservation_list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AppliedReservations', pipeline_response) @@ -142,4 +130,6 @@ async def get_applied_reservation_list( return cls(pipeline_response, deserialized, {}) return deserialized + get_applied_reservation_list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations'} # type: ignore + 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 9ac3210ee08d9..7f3e09b6183e6 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 @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._calculate_exchange_operations import build_post_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,36 +56,28 @@ async def _post_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._post_initial.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'CalculateExchangeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'CalculateExchangeRequest') + + request = build_post_request_initial( + content_type=content_type, + json=_json, + template_url=self._post_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('CalculateExchangeOperationResultResponse', pipeline_response) @@ -89,13 +85,17 @@ async def _post_initial( response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _post_initial.metadata = {'url': '/providers/Microsoft.Capacity/calculateExchange'} # type: ignore + + @distributed_trace_async async def begin_post( self, body: "_models.CalculateExchangeRequest", @@ -109,15 +109,20 @@ async def begin_post( :type body: ~azure.mgmt.reservations.models.CalculateExchangeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :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 CalculateExchangeOperationResultResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.CalculateExchangeOperationResultResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 + CalculateExchangeOperationResultResponse or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.CalculateExchangeOperationResultResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CalculateExchangeOperationResultResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -127,21 +132,21 @@ async def begin_post( if cont_token is None: raw_result = await self._post_initial( body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CalculateExchangeOperationResultResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -153,4 +158,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post.metadata = {'url': '/providers/Microsoft.Capacity/calculateExchange'} # type: ignore 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 801da6c872118..3704f98d21ea4 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 @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._exchange_operations import build_post_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,36 +56,28 @@ async def _post_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._post_initial.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'ExchangeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'ExchangeRequest') + + request = build_post_request_initial( + content_type=content_type, + json=_json, + template_url=self._post_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('ExchangeOperationResultResponse', pipeline_response) @@ -89,13 +85,17 @@ async def _post_initial( response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _post_initial.metadata = {'url': '/providers/Microsoft.Capacity/exchange'} # type: ignore + + @distributed_trace_async async def begin_post( self, body: "_models.ExchangeRequest", @@ -109,15 +109,20 @@ async def begin_post( :type body: ~azure.mgmt.reservations.models.ExchangeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :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 ExchangeOperationResultResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.ExchangeOperationResultResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 ExchangeOperationResultResponse or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.ExchangeOperationResultResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExchangeOperationResultResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -127,21 +132,21 @@ async def begin_post( if cont_token is None: raw_result = await self._post_initial( body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExchangeOperationResultResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -153,4 +158,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post.metadata = {'url': '/providers/Microsoft.Capacity/exchange'} # type: ignore 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 13da2f88e1af5..ac71282ee69d2 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operation_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -59,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,12 +98,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) 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) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 259c3700ea060..32bb39a145885 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._quota_operations import build_create_or_update_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, subscription_id: str, @@ -73,46 +79,39 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + resource_name=resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'} # type: ignore + async def _create_or_update_initial( self, subscription_id: str, @@ -127,40 +126,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + resource_name=resource_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('QuotaRequestOneResourceSubmitResponse', pipeline_response) @@ -172,8 +160,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, subscription_id: str, @@ -211,15 +202,22 @@ async def begin_create_or_update( :type create_quota_request: ~azure.mgmt.reservations.models.CurrentQuotaLimitBase :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :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 QuotaRequestOneResourceSubmitResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.QuotaRequestOneResourceSubmitResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 + QuotaRequestOneResourceSubmitResponse or QuotaRequestSubmitResponse201 or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.QuotaRequestOneResourceSubmitResponse + or ~azure.mgmt.reservations.models.QuotaRequestSubmitResponse201] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]] lro_delay = kwargs.pop( 'polling_interval', @@ -233,28 +231,21 @@ async def begin_create_or_update( location=location, resource_name=resource_name, create_quota_request=create_quota_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('QuotaRequestOneResourceSubmitResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -266,6 +257,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'} # type: ignore async def _update_initial( @@ -282,40 +274,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') + + request = build_update_request_initial( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + resource_name=resource_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('QuotaRequestOneResourceSubmitResponse', pipeline_response) @@ -327,8 +308,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, subscription_id: str, @@ -361,15 +345,22 @@ async def begin_update( :type create_quota_request: ~azure.mgmt.reservations.models.CurrentQuotaLimitBase :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :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 QuotaRequestOneResourceSubmitResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.QuotaRequestOneResourceSubmitResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 + QuotaRequestOneResourceSubmitResponse or QuotaRequestSubmitResponse201 or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.QuotaRequestOneResourceSubmitResponse + or ~azure.mgmt.reservations.models.QuotaRequestSubmitResponse201] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]] lro_delay = kwargs.pop( 'polling_interval', @@ -383,28 +374,21 @@ async def begin_update( location=location, resource_name=resource_name, create_quota_request=create_quota_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('QuotaRequestOneResourceSubmitResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -416,8 +400,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'} # type: ignore + @distributed_trace def list( self, subscription_id: str, @@ -444,36 +430,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('QuotaLimits', pipeline_response) + deserialized = self._deserialize("QuotaLimits", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -486,12 +469,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 0e3fcad3f7088..85d4b60c6e76d 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._quota_request_status_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, subscription_id: str, @@ -71,34 +77,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'id': self._serialize.url("id", id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + id=id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QuotaRequestDetails', pipeline_response) @@ -107,8 +103,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id}'} # type: ignore + + @distributed_trace def list( self, subscription_id: str, @@ -146,8 +145,10 @@ def list( skiptoken parameter that specifies a starting point to use for subsequent calls. :type skiptoken: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either QuotaRequestDetailsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.QuotaRequestDetailsList] + :return: An iterator like instance of either QuotaRequestDetailsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.QuotaRequestDetailsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.QuotaRequestDetailsList"] @@ -155,42 +156,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + filter=filter, + top=top, + skiptoken=skiptoken, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + filter=filter, + top=top, + skiptoken=skiptoken, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('QuotaRequestDetailsList', pipeline_response) + deserialized = self._deserialize("QuotaRequestDetailsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -203,12 +201,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 e0157382b70f6..4adc3ffd5d6d7 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._reservation_operations import build_available_scopes_request_initial, build_get_request, build_list_all_request, build_list_request, build_list_revisions_request, build_merge_request_initial, build_split_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,38 +60,27 @@ async def _available_scopes_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._available_scopes_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'AvailableScopeRequest') + + request = build_available_scopes_request_initial( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + content_type=content_type, + json=_json, + template_url=self._available_scopes_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'AvailableScopeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('AvailableScopeProperties', pipeline_response) @@ -94,8 +88,11 @@ async def _available_scopes_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _available_scopes_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes'} # type: ignore + + @distributed_trace_async async def begin_available_scopes( self, reservation_order_id: str, @@ -115,15 +112,20 @@ async def begin_available_scopes( :type body: ~azure.mgmt.reservations.models.AvailableScopeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :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 AvailableScopeProperties or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.AvailableScopeProperties] - :raises ~azure.core.exceptions.HttpResponseError: + :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 AvailableScopeProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.AvailableScopeProperties] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableScopeProperties"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,26 +137,21 @@ async def begin_available_scopes( reservation_order_id=reservation_order_id, reservation_id=reservation_id, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AvailableScopeProperties', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -166,6 +163,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_available_scopes.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes'} # type: ignore async def _split_initial( @@ -179,37 +177,26 @@ async def _split_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._split_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'SplitRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_split_request_initial( + reservation_order_id=reservation_order_id, + content_type=content_type, + json=_json, + template_url=self._split_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'SplitRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -219,8 +206,11 @@ async def _split_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _split_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split'} # type: ignore + + @distributed_trace_async async def begin_split( self, reservation_order_id: str, @@ -237,15 +227,20 @@ async def begin_split( :type body: ~azure.mgmt.reservations.models.SplitRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :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 list of ReservationResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.reservations.models.ReservationResponse]] - :raises ~azure.core.exceptions.HttpResponseError: + :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 list of ReservationResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.reservations.models.ReservationResponse]] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ReservationResponse"]] lro_delay = kwargs.pop( 'polling_interval', @@ -256,25 +251,21 @@ async def begin_split( raw_result = await self._split_initial( reservation_order_id=reservation_order_id, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('[ReservationResponse]', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -286,6 +277,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_split.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split'} # type: ignore async def _merge_initial( @@ -299,37 +291,26 @@ async def _merge_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._merge_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'MergeRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_merge_request_initial( + reservation_order_id=reservation_order_id, + content_type=content_type, + json=_json, + template_url=self._merge_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'MergeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -339,8 +320,11 @@ async def _merge_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _merge_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge'} # type: ignore + + @distributed_trace_async async def begin_merge( self, reservation_order_id: str, @@ -358,15 +342,20 @@ async def begin_merge( :type body: ~azure.mgmt.reservations.models.MergeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :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 list of ReservationResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.reservations.models.ReservationResponse]] - :raises ~azure.core.exceptions.HttpResponseError: + :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 list of ReservationResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.reservations.models.ReservationResponse]] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ReservationResponse"]] lro_delay = kwargs.pop( 'polling_interval', @@ -377,25 +366,21 @@ async def begin_merge( raw_result = await self._merge_initial( reservation_order_id=reservation_order_id, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('[ReservationResponse]', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -407,8 +392,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_merge.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge'} # type: ignore + @distributed_trace def list( self, reservation_order_id: str, @@ -422,7 +409,8 @@ def list( :type reservation_order_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReservationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.ReservationList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.ReservationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationList"] @@ -430,34 +418,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + reservation_order_id=reservation_order_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + reservation_order_id=reservation_order_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReservationList', pipeline_response) + deserialized = self._deserialize("ReservationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -470,17 +453,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) 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) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations'} # type: ignore + @distributed_trace_async async def get( self, reservation_id: str, @@ -508,34 +493,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + reservation_id=reservation_id, + reservation_order_id=reservation_order_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ReservationResponse', pipeline_response) @@ -544,8 +518,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'} # type: ignore + async def _update_initial( self, reservation_order_id: str, @@ -558,38 +534,27 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Patch') + + request = build_update_request_initial( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Patch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -599,8 +564,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, reservation_order_id: str, @@ -620,15 +588,19 @@ async def begin_update( :type parameters: ~azure.mgmt.reservations.models.Patch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :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 ReservationResponse or the result of cls(response) + :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 ReservationResponse or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.ReservationResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -640,26 +612,21 @@ async def begin_update( reservation_order_id=reservation_order_id, reservation_id=reservation_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ReservationResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -671,8 +638,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'} # type: ignore + @distributed_trace def list_revisions( self, reservation_id: str, @@ -689,7 +658,8 @@ def list_revisions( :type reservation_order_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReservationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.ReservationList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.ReservationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationList"] @@ -697,35 +667,31 @@ def list_revisions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_revisions.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_revisions_request( + reservation_id=reservation_id, + reservation_order_id=reservation_order_id, + template_url=self.list_revisions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_revisions_request( + reservation_id=reservation_id, + reservation_order_id=reservation_order_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReservationList', pipeline_response) + deserialized = self._deserialize("ReservationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -738,13 +704,114 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) 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) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_revisions.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions'} # type: ignore + + @distributed_trace + def list_all( + self, + filter: Optional[str] = None, + orderby: Optional[str] = None, + refresh_summary: Optional[str] = None, + skiptoken: Optional[float] = None, + selected_state: Optional[str] = None, + take: Optional[float] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ReservationsListResult"]: + """List the reservations and the roll up counts of reservations group by provisioning states that + the user has access to in the current tenant. + + :param filter: May be used to filter by reservation properties. The filter supports 'eq', 'or', + and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation + properties include sku/name, properties/{appliedScopeType, archived, displayName, + displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, + reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState}. + :type filter: str + :param orderby: May be used to sort order by reservation properties. + :type orderby: str + :param refresh_summary: To indicate whether to refresh the roll up counts of the reservations + group by provisioning states. + :type refresh_summary: str + :param skiptoken: The number of reservations to skip from the list before returning results. + :type skiptoken: float + :param selected_state: The selected provisioning state. + :type selected_state: str + :param take: To number of reservations to return. + :type take: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ReservationsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.ReservationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_all_request( + filter=filter, + orderby=orderby, + refresh_summary=refresh_summary, + skiptoken=skiptoken, + selected_state=selected_state, + take=take, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_all_request( + filter=filter, + orderby=orderby, + refresh_summary=refresh_summary, + skiptoken=skiptoken, + selected_state=selected_state, + take=take, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ReservationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/providers/Microsoft.Capacity/reservations'} # type: ignore 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 5aaf02a8544d6..6847043bb4a6f 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._reservation_order_operations import build_calculate_request, build_change_directory_request, build_get_request, build_list_request, build_purchase_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def calculate( self, body: "_models.PurchaseRequest", @@ -64,32 +70,25 @@ async def calculate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.calculate.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'PurchaseRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'PurchaseRequest') + + request = build_calculate_request( + content_type=content_type, + json=_json, + template_url=self.calculate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CalculatePriceResponse', pipeline_response) @@ -98,8 +97,11 @@ async def calculate( return cls(pipeline_response, deserialized, {}) return deserialized + calculate.metadata = {'url': '/providers/Microsoft.Capacity/calculatePrice'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -109,8 +111,10 @@ def list( List of all the ``ReservationOrder``\ s that the user has access to in the current tenant. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReservationOrderList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.ReservationOrderList] + :return: An iterator like instance of either ReservationOrderList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.ReservationOrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationOrderList"] @@ -118,30 +122,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReservationOrderList', pipeline_response) + deserialized = self._deserialize("ReservationOrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -154,12 +155,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) 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) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -176,37 +178,26 @@ async def _purchase_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._purchase_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'PurchaseRequest') + + request = build_purchase_request_initial( + reservation_order_id=reservation_order_id, + content_type=content_type, + json=_json, + template_url=self._purchase_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'PurchaseRequest') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ReservationOrderResponse', pipeline_response) @@ -218,8 +209,11 @@ async def _purchase_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _purchase_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'} # type: ignore + + @distributed_trace_async async def begin_purchase( self, reservation_order_id: str, @@ -236,15 +230,20 @@ async def begin_purchase( :type body: ~azure.mgmt.reservations.models.PurchaseRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :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 ReservationOrderResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.ReservationOrderResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 ReservationOrderResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.ReservationOrderResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationOrderResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -255,25 +254,21 @@ async def begin_purchase( raw_result = await self._purchase_initial( reservation_order_id=reservation_order_id, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ReservationOrderResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -285,8 +280,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purchase.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'} # type: ignore + @distributed_trace_async async def get( self, reservation_order_id: str, @@ -311,39 +308,88 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), + + request = build_get_request( + reservation_order_id=reservation_order_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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) + + deserialized = self._deserialize('ReservationOrderResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'} # type: ignore + + + @distributed_trace_async + async def change_directory( + self, + reservation_order_id: str, + body: "_models.ChangeDirectoryRequest", + **kwargs: Any + ) -> "_models.ChangeDirectoryResponse": + """Change directory of ``ReservationOrder``. + + Change directory (tenant) of ``ReservationOrder`` and all ``Reservation`` under it to specified + tenant id. + + :param reservation_order_id: Order Id of the reservation. + :type reservation_order_id: str + :param body: Information needed to change directory of reservation order. + :type body: ~azure.mgmt.reservations.models.ChangeDirectoryRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ChangeDirectoryResponse, or the result of cls(response) + :rtype: ~azure.mgmt.reservations.models.ChangeDirectoryResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ChangeDirectoryResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + _json = self._serialize.body(body, 'ChangeDirectoryRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_change_directory_request( + reservation_order_id=reservation_order_id, + content_type=content_type, + json=_json, + template_url=self.change_directory.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ReservationOrderResponse', pipeline_response) + deserialized = self._deserialize('ChangeDirectoryResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'} # type: ignore + + change_directory.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/changeDirectory'} # type: ignore + diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py index 80330d1c80476..2dc65ef71c67f 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py @@ -6,171 +6,114 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AppliedReservationList - from ._models_py3 import AppliedReservations - from ._models_py3 import AvailableScopeProperties - from ._models_py3 import AvailableScopeRequest - from ._models_py3 import AvailableScopeRequestProperties - from ._models_py3 import BillingInformation - from ._models_py3 import CalculateExchangeOperationResultResponse - from ._models_py3 import CalculateExchangeRequest - from ._models_py3 import CalculateExchangeRequestProperties - from ._models_py3 import CalculateExchangeResponseProperties - from ._models_py3 import CalculatePriceResponse - from ._models_py3 import CalculatePriceResponseProperties - from ._models_py3 import CalculatePriceResponsePropertiesBillingCurrencyTotal - from ._models_py3 import CalculatePriceResponsePropertiesPricingCurrencyTotal - from ._models_py3 import Catalog - from ._models_py3 import CreateGenericQuotaRequestParameters - from ._models_py3 import CurrentQuotaLimit - from ._models_py3 import CurrentQuotaLimitBase - from ._models_py3 import Error - from ._models_py3 import ExceptionResponse - from ._models_py3 import ExchangeOperationResultResponse - from ._models_py3 import ExchangePolicyError - from ._models_py3 import ExchangePolicyErrors - from ._models_py3 import ExchangeRequest - from ._models_py3 import ExchangeRequestProperties - from ._models_py3 import ExchangeResponseProperties - from ._models_py3 import ExtendedErrorInfo - from ._models_py3 import ExtendedStatusInfo - from ._models_py3 import MergeRequest - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationList - from ._models_py3 import OperationResponse - from ._models_py3 import OperationResultError - from ._models_py3 import Patch - from ._models_py3 import PatchPropertiesRenewProperties - from ._models_py3 import PaymentDetail - from ._models_py3 import Price - from ._models_py3 import PurchaseRequest - from ._models_py3 import PurchaseRequestPropertiesReservedResourceProperties - from ._models_py3 import QuotaLimits - from ._models_py3 import QuotaLimitsResponse - from ._models_py3 import QuotaProperties - from ._models_py3 import QuotaRequestDetails - from ._models_py3 import QuotaRequestDetailsList - from ._models_py3 import QuotaRequestOneResourceSubmitResponse - from ._models_py3 import QuotaRequestProperties - from ._models_py3 import QuotaRequestSubmitResponse - from ._models_py3 import QuotaRequestSubmitResponse201 - from ._models_py3 import RenewPropertiesResponse - from ._models_py3 import RenewPropertiesResponseBillingCurrencyTotal - from ._models_py3 import RenewPropertiesResponsePricingCurrencyTotal - from ._models_py3 import ReservationList - from ._models_py3 import ReservationMergeProperties - from ._models_py3 import ReservationOrderBillingPlanInformation - from ._models_py3 import ReservationOrderList - from ._models_py3 import ReservationOrderResponse - from ._models_py3 import ReservationProperties - from ._models_py3 import ReservationResponse - from ._models_py3 import ReservationSplitProperties - from ._models_py3 import ReservationToExchange - from ._models_py3 import ReservationToPurchaseCalculateExchange - from ._models_py3 import ReservationToPurchaseExchange - from ._models_py3 import ReservationToReturn - from ._models_py3 import ReservationToReturnForExchange - from ._models_py3 import ResourceName - from ._models_py3 import ScopeProperties - from ._models_py3 import ServiceError - from ._models_py3 import ServiceErrorDetail - from ._models_py3 import SkuName - from ._models_py3 import SkuProperty - from ._models_py3 import SkuRestriction - from ._models_py3 import SplitRequest - from ._models_py3 import SubRequest - from ._models_py3 import SubscriptionScopeProperties -except (SyntaxError, ImportError): - from ._models import AppliedReservationList # type: ignore - from ._models import AppliedReservations # type: ignore - from ._models import AvailableScopeProperties # type: ignore - from ._models import AvailableScopeRequest # type: ignore - from ._models import AvailableScopeRequestProperties # type: ignore - from ._models import BillingInformation # type: ignore - from ._models import CalculateExchangeOperationResultResponse # type: ignore - from ._models import CalculateExchangeRequest # type: ignore - from ._models import CalculateExchangeRequestProperties # type: ignore - from ._models import CalculateExchangeResponseProperties # type: ignore - from ._models import CalculatePriceResponse # type: ignore - from ._models import CalculatePriceResponseProperties # type: ignore - from ._models import CalculatePriceResponsePropertiesBillingCurrencyTotal # type: ignore - from ._models import CalculatePriceResponsePropertiesPricingCurrencyTotal # type: ignore - from ._models import Catalog # type: ignore - from ._models import CreateGenericQuotaRequestParameters # type: ignore - from ._models import CurrentQuotaLimit # type: ignore - from ._models import CurrentQuotaLimitBase # type: ignore - from ._models import Error # type: ignore - from ._models import ExceptionResponse # type: ignore - from ._models import ExchangeOperationResultResponse # type: ignore - from ._models import ExchangePolicyError # type: ignore - from ._models import ExchangePolicyErrors # type: ignore - from ._models import ExchangeRequest # type: ignore - from ._models import ExchangeRequestProperties # type: ignore - from ._models import ExchangeResponseProperties # type: ignore - from ._models import ExtendedErrorInfo # type: ignore - from ._models import ExtendedStatusInfo # type: ignore - from ._models import MergeRequest # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationList # type: ignore - from ._models import OperationResponse # type: ignore - from ._models import OperationResultError # type: ignore - from ._models import Patch # type: ignore - from ._models import PatchPropertiesRenewProperties # type: ignore - from ._models import PaymentDetail # type: ignore - from ._models import Price # type: ignore - from ._models import PurchaseRequest # type: ignore - from ._models import PurchaseRequestPropertiesReservedResourceProperties # type: ignore - from ._models import QuotaLimits # type: ignore - from ._models import QuotaLimitsResponse # type: ignore - from ._models import QuotaProperties # type: ignore - from ._models import QuotaRequestDetails # type: ignore - from ._models import QuotaRequestDetailsList # type: ignore - from ._models import QuotaRequestOneResourceSubmitResponse # type: ignore - from ._models import QuotaRequestProperties # type: ignore - from ._models import QuotaRequestSubmitResponse # type: ignore - from ._models import QuotaRequestSubmitResponse201 # type: ignore - from ._models import RenewPropertiesResponse # type: ignore - from ._models import RenewPropertiesResponseBillingCurrencyTotal # type: ignore - from ._models import RenewPropertiesResponsePricingCurrencyTotal # type: ignore - from ._models import ReservationList # type: ignore - from ._models import ReservationMergeProperties # type: ignore - from ._models import ReservationOrderBillingPlanInformation # type: ignore - from ._models import ReservationOrderList # type: ignore - from ._models import ReservationOrderResponse # type: ignore - from ._models import ReservationProperties # type: ignore - from ._models import ReservationResponse # type: ignore - from ._models import ReservationSplitProperties # type: ignore - from ._models import ReservationToExchange # type: ignore - from ._models import ReservationToPurchaseCalculateExchange # type: ignore - from ._models import ReservationToPurchaseExchange # type: ignore - from ._models import ReservationToReturn # type: ignore - from ._models import ReservationToReturnForExchange # type: ignore - from ._models import ResourceName # type: ignore - from ._models import ScopeProperties # type: ignore - from ._models import ServiceError # type: ignore - from ._models import ServiceErrorDetail # type: ignore - from ._models import SkuName # type: ignore - from ._models import SkuProperty # type: ignore - from ._models import SkuRestriction # type: ignore - from ._models import SplitRequest # type: ignore - from ._models import SubRequest # type: ignore - from ._models import SubscriptionScopeProperties # type: ignore +from ._models_py3 import AppliedReservationList +from ._models_py3 import AppliedReservations +from ._models_py3 import AvailableScopeProperties +from ._models_py3 import AvailableScopeRequest +from ._models_py3 import AvailableScopeRequestProperties +from ._models_py3 import BillingInformation +from ._models_py3 import CalculateExchangeOperationResultResponse +from ._models_py3 import CalculateExchangeRequest +from ._models_py3 import CalculateExchangeRequestProperties +from ._models_py3 import CalculateExchangeResponseProperties +from ._models_py3 import CalculatePriceResponse +from ._models_py3 import CalculatePriceResponseProperties +from ._models_py3 import CalculatePriceResponsePropertiesBillingCurrencyTotal +from ._models_py3 import CalculatePriceResponsePropertiesPricingCurrencyTotal +from ._models_py3 import Catalog +from ._models_py3 import CatalogMsrp +from ._models_py3 import ChangeDirectoryRequest +from ._models_py3 import ChangeDirectoryResponse +from ._models_py3 import ChangeDirectoryResult +from ._models_py3 import CreateGenericQuotaRequestParameters +from ._models_py3 import CurrentQuotaLimit +from ._models_py3 import CurrentQuotaLimitBase +from ._models_py3 import Error +from ._models_py3 import ErrorDetails +from ._models_py3 import ErrorResponse +from ._models_py3 import ExceptionResponse +from ._models_py3 import ExchangeOperationResultResponse +from ._models_py3 import ExchangePolicyError +from ._models_py3 import ExchangePolicyErrors +from ._models_py3 import ExchangeRequest +from ._models_py3 import ExchangeRequestProperties +from ._models_py3 import ExchangeResponseProperties +from ._models_py3 import ExtendedErrorInfo +from ._models_py3 import ExtendedStatusInfo +from ._models_py3 import MergeRequest +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationList +from ._models_py3 import OperationResponse +from ._models_py3 import OperationResultError +from ._models_py3 import Patch +from ._models_py3 import PatchPropertiesRenewProperties +from ._models_py3 import PaymentDetail +from ._models_py3 import Price +from ._models_py3 import PurchaseRequest +from ._models_py3 import PurchaseRequestPropertiesReservedResourceProperties +from ._models_py3 import QuotaLimits +from ._models_py3 import QuotaLimitsResponse +from ._models_py3 import QuotaProperties +from ._models_py3 import QuotaRequestDetails +from ._models_py3 import QuotaRequestDetailsList +from ._models_py3 import QuotaRequestOneResourceSubmitResponse +from ._models_py3 import QuotaRequestProperties +from ._models_py3 import QuotaRequestSubmitResponse +from ._models_py3 import QuotaRequestSubmitResponse201 +from ._models_py3 import RenewPropertiesResponse +from ._models_py3 import RenewPropertiesResponseBillingCurrencyTotal +from ._models_py3 import RenewPropertiesResponsePricingCurrencyTotal +from ._models_py3 import ReservationList +from ._models_py3 import ReservationMergeProperties +from ._models_py3 import ReservationOrderBillingPlanInformation +from ._models_py3 import ReservationOrderList +from ._models_py3 import ReservationOrderResponse +from ._models_py3 import ReservationResponse +from ._models_py3 import ReservationSplitProperties +from ._models_py3 import ReservationSummary +from ._models_py3 import ReservationToExchange +from ._models_py3 import ReservationToPurchaseCalculateExchange +from ._models_py3 import ReservationToPurchaseExchange +from ._models_py3 import ReservationToReturn +from ._models_py3 import ReservationToReturnForExchange +from ._models_py3 import ReservationUtilizationAggregates +from ._models_py3 import ReservationsListResult +from ._models_py3 import ReservationsProperties +from ._models_py3 import ReservationsPropertiesUtilization +from ._models_py3 import ResourceName +from ._models_py3 import ScopeProperties +from ._models_py3 import ServiceError +from ._models_py3 import ServiceErrorDetail +from ._models_py3 import SkuCapability +from ._models_py3 import SkuName +from ._models_py3 import SkuProperty +from ._models_py3 import SkuRestriction +from ._models_py3 import SplitRequest +from ._models_py3 import SubRequest +from ._models_py3 import SubscriptionScopeProperties +from ._models_py3 import SystemData + from ._azure_reservation_api_enums import ( AppliedScopeType, CalculateExchangeOperationResultStatus, + CreatedByType, + DisplayProvisioningState, ErrorResponseCode, ExchangeOperationResultStatus, InstanceFlexibility, + Location, OperationStatus, PaymentStatus, + ProvisioningState, QuotaRequestState, ReservationBillingPlan, ReservationStatusCode, ReservationTerm, ReservedResourceType, ResourceType, + UserFriendlyAppliedScopeType, + UserFriendlyRenewState, ) __all__ = [ @@ -189,10 +132,16 @@ 'CalculatePriceResponsePropertiesBillingCurrencyTotal', 'CalculatePriceResponsePropertiesPricingCurrencyTotal', 'Catalog', + 'CatalogMsrp', + 'ChangeDirectoryRequest', + 'ChangeDirectoryResponse', + 'ChangeDirectoryResult', 'CreateGenericQuotaRequestParameters', 'CurrentQuotaLimit', 'CurrentQuotaLimitBase', 'Error', + 'ErrorDetails', + 'ErrorResponse', 'ExceptionResponse', 'ExchangeOperationResultResponse', 'ExchangePolicyError', @@ -230,35 +179,47 @@ 'ReservationOrderBillingPlanInformation', 'ReservationOrderList', 'ReservationOrderResponse', - 'ReservationProperties', 'ReservationResponse', 'ReservationSplitProperties', + 'ReservationSummary', 'ReservationToExchange', 'ReservationToPurchaseCalculateExchange', 'ReservationToPurchaseExchange', 'ReservationToReturn', 'ReservationToReturnForExchange', + 'ReservationUtilizationAggregates', + 'ReservationsListResult', + 'ReservationsProperties', + 'ReservationsPropertiesUtilization', 'ResourceName', 'ScopeProperties', 'ServiceError', 'ServiceErrorDetail', + 'SkuCapability', 'SkuName', 'SkuProperty', 'SkuRestriction', 'SplitRequest', 'SubRequest', 'SubscriptionScopeProperties', + 'SystemData', 'AppliedScopeType', 'CalculateExchangeOperationResultStatus', + 'CreatedByType', + 'DisplayProvisioningState', 'ErrorResponseCode', 'ExchangeOperationResultStatus', 'InstanceFlexibility', + 'Location', 'OperationStatus', 'PaymentStatus', + 'ProvisioningState', 'QuotaRequestState', 'ReservationBillingPlan', 'ReservationStatusCode', 'ReservationTerm', 'ReservedResourceType', 'ResourceType', + 'UserFriendlyAppliedScopeType', + 'UserFriendlyRenewState', ] diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_azure_reservation_api_enums.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_azure_reservation_api_enums.py index 249f82334c6fd..e63b9f3a41dac 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_azure_reservation_api_enums.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_azure_reservation_api_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AppliedScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppliedScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the Applied Scope. """ SINGLE = "Single" SHARED = "Shared" -class CalculateExchangeOperationResultStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CalculateExchangeOperationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the operation. """ @@ -42,7 +27,27 @@ class CalculateExchangeOperationResultStatus(with_metaclass(_CaseInsensitiveEnum CANCELLED = "Cancelled" PENDING = "Pending" -class ErrorResponseCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DisplayProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Represent the current display state of the Reservation. + """ + + SUCCEEDED = "Succeeded" + EXPIRING = "Expiring" + EXPIRED = "Expired" + PENDING = "Pending" + CANCELLED = "Cancelled" + FAILED = "Failed" + +class ErrorResponseCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NOT_SPECIFIED = "NotSpecified" INTERNAL_SERVER_ERROR = "InternalServerError" @@ -99,8 +104,9 @@ class ErrorResponseCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FULFILLMENT_TRANSIENT_ERROR = "FulfillmentTransientError" FULFILLMENT_ERROR = "FulfillmentError" CALCULATE_PRICE_FAILED = "CalculatePriceFailed" + APPLIED_SCOPES_SAME_AS_EXISTING = "AppliedScopesSameAsExisting" -class ExchangeOperationResultStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExchangeOperationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the operation. """ @@ -110,7 +116,7 @@ class ExchangeOperationResultStatus(with_metaclass(_CaseInsensitiveEnumMeta, str PENDING_REFUNDS = "PendingRefunds" PENDING_PURCHASES = "PendingPurchases" -class InstanceFlexibility(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstanceFlexibility(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for VirtualMachines reserved resource type. """ @@ -118,7 +124,37 @@ class InstanceFlexibility(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ON = "On" OFF = "Off" -class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Location(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Location in which the Resources needs to be reserved. It cannot be changed after the resource + has been created. + """ + + WESTUS = "westus" + EASTUS = "eastus" + EASTUS2 = "eastus2" + NORTHCENTRALUS = "northcentralus" + WESTUS2 = "westus2" + SOUTHCENTRALUS = "southcentralus" + CENTRALUS = "centralus" + WESTEUROPE = "westeurope" + NORTHEUROPE = "northeurope" + EASTASIA = "eastasia" + SOUTHEASTASIA = "southeastasia" + JAPANEAST = "japaneast" + JAPANWEST = "japanwest" + BRAZILSOUTH = "brazilsouth" + AUSTRALIAEAST = "australiaeast" + AUSTRALIASOUTHEAST = "australiasoutheast" + SOUTHINDIA = "southindia" + WESTINDIA = "westindia" + CENTRALINDIA = "centralindia" + CANADACENTRAL = "canadacentral" + CANADAEAST = "canadaeast" + UKSOUTH = "uksouth" + WESTCENTRALUS = "westcentralus" + UKWEST = "ukwest" + +class OperationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the individual operation. """ @@ -127,7 +163,7 @@ class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CANCELLED = "Cancelled" PENDING = "Pending" -class PaymentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PaymentStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes whether the payment is completed, failed, cancelled or scheduled in the future. """ @@ -136,7 +172,25 @@ class PaymentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SCHEDULED = "Scheduled" CANCELLED = "Cancelled" -class QuotaRequestState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Represent the current state of the Reservation. + """ + + CREATING = "Creating" + PENDING_RESOURCE_HOLD = "PendingResourceHold" + CONFIRMED_RESOURCE_HOLD = "ConfirmedResourceHold" + PENDING_BILLING = "PendingBilling" + CONFIRMED_BILLING = "ConfirmedBilling" + CREATED = "Created" + SUCCEEDED = "Succeeded" + CANCELLED = "Cancelled" + EXPIRED = "Expired" + BILLING_FAILED = "BillingFailed" + FAILED = "Failed" + SPLIT = "Split" + MERGED = "Merged" + +class QuotaRequestState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The quota request status. """ @@ -146,14 +200,14 @@ class QuotaRequestState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" IN_PROGRESS = "InProgress" -class ReservationBillingPlan(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReservationBillingPlan(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Represent the billing plans. """ UPFRONT = "Upfront" MONTHLY = "Monthly" -class ReservationStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReservationStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" PENDING = "Pending" @@ -165,14 +219,15 @@ class ReservationStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) EXPIRED = "Expired" SUCCEEDED = "Succeeded" -class ReservationTerm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReservationTerm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Represent the term of Reservation. """ P1_Y = "P1Y" P3_Y = "P3Y" + P5_Y = "P5Y" -class ReservedResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReservedResourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the resource that is being reserved. """ @@ -196,8 +251,13 @@ class ReservedResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEDICATED_HOST = "DedicatedHost" SAP_HANA = "SapHana" SQL_AZURE_HYBRID_BENEFIT = "SqlAzureHybridBenefit" + AVS = "AVS" + DATA_FACTORY = "DataFactory" + NET_APP_STORAGE = "NetAppStorage" + AZURE_FILES = "AzureFiles" + SQL_EDGE = "SqlEdge" -class ResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The resource types. """ @@ -206,3 +266,23 @@ class ResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LOW_PRIORITY = "lowPriority" SHARED = "shared" SERVICE_SPECIFIC = "serviceSpecific" + +class UserFriendlyAppliedScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The applied scope type + """ + + NONE = "None" + SHARED = "Shared" + SINGLE = "Single" + RESOURCE_GROUP = "ResourceGroup" + MANAGEMENT_GROUP = "ManagementGroup" + +class UserFriendlyRenewState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The renew state of the reservation + """ + + ON = "On" + OFF = "Off" + RENEWED = "Renewed" + NOT_RENEWED = "NotRenewed" + NOT_APPLICABLE = "NotApplicable" diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models.py deleted file mode 100644 index 8d715ddb1448d..0000000000000 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models.py +++ /dev/null @@ -1,2401 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AppliedReservationList(msrest.serialization.Model): - """AppliedReservationList. - - :param value: - :type value: list[str] - :param next_link: Url to get the next page of reservations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[str]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AppliedReservationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AppliedReservations(msrest.serialization.Model): - """AppliedReservations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Identifier of the applied reservations. - :vartype id: str - :ivar name: Name of resource. - :vartype name: str - :ivar type: Type of resource. "Microsoft.Capacity/AppliedReservations". - :vartype type: str - :param reservation_order_ids: - :type reservation_order_ids: ~azure.mgmt.reservations.models.AppliedReservationList - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'reservation_order_ids': {'key': 'properties.reservationOrderIds', 'type': 'AppliedReservationList'}, - } - - def __init__( - self, - **kwargs - ): - super(AppliedReservations, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.reservation_order_ids = kwargs.get('reservation_order_ids', None) - - -class AvailableScopeProperties(msrest.serialization.Model): - """AvailableScopeProperties. - - :param properties: - :type properties: ~azure.mgmt.reservations.models.SubscriptionScopeProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'SubscriptionScopeProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableScopeProperties, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class AvailableScopeRequest(msrest.serialization.Model): - """Available scope. - - :param properties: Available scope request properties. - :type properties: ~azure.mgmt.reservations.models.AvailableScopeRequestProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'AvailableScopeRequestProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableScopeRequest, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class AvailableScopeRequestProperties(msrest.serialization.Model): - """Available scope request properties. - - :param scopes: - :type scopes: list[str] - """ - - _attribute_map = { - 'scopes': {'key': 'scopes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableScopeRequestProperties, self).__init__(**kwargs) - self.scopes = kwargs.get('scopes', None) - - -class BillingInformation(msrest.serialization.Model): - """billing information. - - :param billing_currency_total_paid_amount: - :type billing_currency_total_paid_amount: ~azure.mgmt.reservations.models.Price - :param billing_currency_prorated_amount: - :type billing_currency_prorated_amount: ~azure.mgmt.reservations.models.Price - :param billing_currency_remaining_commitment_amount: - :type billing_currency_remaining_commitment_amount: ~azure.mgmt.reservations.models.Price - """ - - _attribute_map = { - 'billing_currency_total_paid_amount': {'key': 'billingCurrencyTotalPaidAmount', 'type': 'Price'}, - 'billing_currency_prorated_amount': {'key': 'billingCurrencyProratedAmount', 'type': 'Price'}, - 'billing_currency_remaining_commitment_amount': {'key': 'billingCurrencyRemainingCommitmentAmount', 'type': 'Price'}, - } - - def __init__( - self, - **kwargs - ): - super(BillingInformation, self).__init__(**kwargs) - self.billing_currency_total_paid_amount = kwargs.get('billing_currency_total_paid_amount', None) - self.billing_currency_prorated_amount = kwargs.get('billing_currency_prorated_amount', None) - self.billing_currency_remaining_commitment_amount = kwargs.get('billing_currency_remaining_commitment_amount', None) - - -class CalculateExchangeOperationResultResponse(msrest.serialization.Model): - """CalculateExchange operation result. - - :param id: It should match what is used to GET the operation result. - :type id: str - :param name: It must match the last segment of the id field, and will typically be a GUID / - system generated value. - :type name: str - :param status: Status of the operation. Possible values include: "Succeeded", "Failed", - "Cancelled", "Pending". - :type status: str or ~azure.mgmt.reservations.models.CalculateExchangeOperationResultStatus - :param properties: CalculateExchange response properties. - :type properties: ~azure.mgmt.reservations.models.CalculateExchangeResponseProperties - :param error: Required if status == failed or status == canceled. - :type error: ~azure.mgmt.reservations.models.OperationResultError - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'CalculateExchangeResponseProperties'}, - 'error': {'key': 'error', 'type': 'OperationResultError'}, - } - - def __init__( - self, - **kwargs - ): - super(CalculateExchangeOperationResultResponse, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs.get('status', None) - self.properties = kwargs.get('properties', None) - self.error = kwargs.get('error', None) - - -class CalculateExchangeRequest(msrest.serialization.Model): - """Calculate exchange request. - - :param properties: Calculate exchange request properties. - :type properties: ~azure.mgmt.reservations.models.CalculateExchangeRequestProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CalculateExchangeRequestProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CalculateExchangeRequest, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class CalculateExchangeRequestProperties(msrest.serialization.Model): - """Calculate exchange request properties. - - :param reservations_to_purchase: List of reservations that are being purchased in this - exchange. - :type reservations_to_purchase: list[~azure.mgmt.reservations.models.PurchaseRequest] - :param reservations_to_exchange: List of reservations that are being returned in this exchange. - :type reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToReturn] - """ - - _attribute_map = { - 'reservations_to_purchase': {'key': 'reservationsToPurchase', 'type': '[PurchaseRequest]'}, - 'reservations_to_exchange': {'key': 'reservationsToExchange', 'type': '[ReservationToReturn]'}, - } - - def __init__( - self, - **kwargs - ): - super(CalculateExchangeRequestProperties, self).__init__(**kwargs) - self.reservations_to_purchase = kwargs.get('reservations_to_purchase', None) - self.reservations_to_exchange = kwargs.get('reservations_to_exchange', None) - - -class CalculateExchangeResponseProperties(msrest.serialization.Model): - """CalculateExchange response properties. - - :param session_id: Exchange session identifier. - :type session_id: str - :param net_payable: - :type net_payable: ~azure.mgmt.reservations.models.Price - :param refunds_total: - :type refunds_total: ~azure.mgmt.reservations.models.Price - :param purchases_total: - :type purchases_total: ~azure.mgmt.reservations.models.Price - :param reservations_to_purchase: Details of the reservations being purchased. - :type reservations_to_purchase: - list[~azure.mgmt.reservations.models.ReservationToPurchaseCalculateExchange] - :param reservations_to_exchange: Details of the reservations being returned. - :type reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToExchange] - :param policy_result: Exchange policy errors. - :type policy_result: ~azure.mgmt.reservations.models.ExchangePolicyErrors - """ - - _attribute_map = { - 'session_id': {'key': 'sessionId', 'type': 'str'}, - 'net_payable': {'key': 'netPayable', 'type': 'Price'}, - 'refunds_total': {'key': 'refundsTotal', 'type': 'Price'}, - 'purchases_total': {'key': 'purchasesTotal', 'type': 'Price'}, - 'reservations_to_purchase': {'key': 'reservationsToPurchase', 'type': '[ReservationToPurchaseCalculateExchange]'}, - 'reservations_to_exchange': {'key': 'reservationsToExchange', 'type': '[ReservationToExchange]'}, - 'policy_result': {'key': 'policyResult', 'type': 'ExchangePolicyErrors'}, - } - - def __init__( - self, - **kwargs - ): - super(CalculateExchangeResponseProperties, self).__init__(**kwargs) - self.session_id = kwargs.get('session_id', None) - self.net_payable = kwargs.get('net_payable', None) - self.refunds_total = kwargs.get('refunds_total', None) - self.purchases_total = kwargs.get('purchases_total', None) - self.reservations_to_purchase = kwargs.get('reservations_to_purchase', None) - self.reservations_to_exchange = kwargs.get('reservations_to_exchange', None) - self.policy_result = kwargs.get('policy_result', None) - - -class CalculatePriceResponse(msrest.serialization.Model): - """CalculatePriceResponse. - - :param properties: - :type properties: ~azure.mgmt.reservations.models.CalculatePriceResponseProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CalculatePriceResponseProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CalculatePriceResponse, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class CalculatePriceResponseProperties(msrest.serialization.Model): - """CalculatePriceResponseProperties. - - :param billing_currency_total: Currency and amount that customer will be charged in customer's - local currency. Tax is not included. - :type billing_currency_total: - ~azure.mgmt.reservations.models.CalculatePriceResponsePropertiesBillingCurrencyTotal - :param is_billing_partner_managed: True if billing is managed by Microsoft Partner. Used only - for CSP accounts. - :type is_billing_partner_managed: bool - :param reservation_order_id: GUID that represents reservation order that can be placed after - calculating price. - :type reservation_order_id: str - :param sku_title: Title of SKU that is being purchased. - :type sku_title: str - :param sku_description: Description of SKU that is being purchased. - :type sku_description: str - :param pricing_currency_total: Amount that Microsoft uses for record. Used during refund for - calculating refund limit. Tax is not included. - :type pricing_currency_total: - ~azure.mgmt.reservations.models.CalculatePriceResponsePropertiesPricingCurrencyTotal - :param payment_schedule: - :type payment_schedule: list[~azure.mgmt.reservations.models.PaymentDetail] - """ - - _attribute_map = { - 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'CalculatePriceResponsePropertiesBillingCurrencyTotal'}, - 'is_billing_partner_managed': {'key': 'isBillingPartnerManaged', 'type': 'bool'}, - 'reservation_order_id': {'key': 'reservationOrderId', 'type': 'str'}, - 'sku_title': {'key': 'skuTitle', 'type': 'str'}, - 'sku_description': {'key': 'skuDescription', 'type': 'str'}, - 'pricing_currency_total': {'key': 'pricingCurrencyTotal', 'type': 'CalculatePriceResponsePropertiesPricingCurrencyTotal'}, - 'payment_schedule': {'key': 'paymentSchedule', 'type': '[PaymentDetail]'}, - } - - def __init__( - self, - **kwargs - ): - super(CalculatePriceResponseProperties, self).__init__(**kwargs) - self.billing_currency_total = kwargs.get('billing_currency_total', None) - self.is_billing_partner_managed = kwargs.get('is_billing_partner_managed', None) - self.reservation_order_id = kwargs.get('reservation_order_id', None) - self.sku_title = kwargs.get('sku_title', None) - self.sku_description = kwargs.get('sku_description', None) - self.pricing_currency_total = kwargs.get('pricing_currency_total', None) - self.payment_schedule = kwargs.get('payment_schedule', None) - - -class CalculatePriceResponsePropertiesBillingCurrencyTotal(msrest.serialization.Model): - """Currency and amount that customer will be charged in customer's local currency. Tax is not included. - - :param currency_code: - :type currency_code: str - :param amount: - :type amount: float - """ - - _attribute_map = { - 'currency_code': {'key': 'currencyCode', 'type': 'str'}, - 'amount': {'key': 'amount', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(CalculatePriceResponsePropertiesBillingCurrencyTotal, self).__init__(**kwargs) - self.currency_code = kwargs.get('currency_code', None) - self.amount = kwargs.get('amount', None) - - -class CalculatePriceResponsePropertiesPricingCurrencyTotal(msrest.serialization.Model): - """Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. - - :param currency_code: - :type currency_code: str - :param amount: - :type amount: float - """ - - _attribute_map = { - 'currency_code': {'key': 'currencyCode', 'type': 'str'}, - 'amount': {'key': 'amount', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(CalculatePriceResponsePropertiesPricingCurrencyTotal, self).__init__(**kwargs) - self.currency_code = kwargs.get('currency_code', None) - self.amount = kwargs.get('amount', None) - - -class Catalog(msrest.serialization.Model): - """Catalog. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: The name of SKU. - :vartype name: str - :param billing_plans: The billing plan options available for this SKU. - :type billing_plans: dict[str, list[str or - ~azure.mgmt.reservations.models.ReservationBillingPlan]] - :ivar terms: Available reservation terms for this resource. - :vartype terms: list[str or ~azure.mgmt.reservations.models.ReservationTerm] - :ivar locations: - :vartype locations: list[str] - :ivar sku_properties: - :vartype sku_properties: list[~azure.mgmt.reservations.models.SkuProperty] - :ivar restrictions: - :vartype restrictions: list[~azure.mgmt.reservations.models.SkuRestriction] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'terms': {'readonly': True}, - 'locations': {'readonly': True}, - 'sku_properties': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'billing_plans': {'key': 'billingPlans', 'type': '{[str]}'}, - 'terms': {'key': 'terms', 'type': '[str]'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'sku_properties': {'key': 'skuProperties', 'type': '[SkuProperty]'}, - 'restrictions': {'key': 'restrictions', 'type': '[SkuRestriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(Catalog, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.billing_plans = kwargs.get('billing_plans', None) - self.terms = None - self.locations = None - self.sku_properties = None - self.restrictions = None - - -class CreateGenericQuotaRequestParameters(msrest.serialization.Model): - """Quota change requests information. - - :param value: Quota change requests. - :type value: list[~azure.mgmt.reservations.models.CurrentQuotaLimitBase] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CurrentQuotaLimitBase]'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateGenericQuotaRequestParameters, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class CurrentQuotaLimit(msrest.serialization.Model): - """Current quota limits. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: The details of the quota request status. Possible values include: - "Accepted", "Invalid", "Succeeded", "Failed", "InProgress". - :vartype provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState - :ivar message: A user friendly message. - :vartype message: str - :param properties: Quota properties for the resource. - :type properties: ~azure.mgmt.reservations.models.QuotaProperties - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'message': {'key': 'properties.message', 'type': 'str'}, - 'properties': {'key': 'quotaInformation.properties', 'type': 'QuotaProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CurrentQuotaLimit, self).__init__(**kwargs) - self.provisioning_state = None - self.message = None - self.properties = kwargs.get('properties', None) - - -class CurrentQuotaLimitBase(msrest.serialization.Model): - """Quota properties. - - :param properties: Quota properties for the resource. - :type properties: ~azure.mgmt.reservations.models.QuotaProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'QuotaProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CurrentQuotaLimitBase, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class Error(msrest.serialization.Model): - """Error. - - :param error: - :type error: ~azure.mgmt.reservations.models.ExtendedErrorInfo - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ExtendedErrorInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(Error, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ExceptionResponse(msrest.serialization.Model): - """The API error. - - :param error: The API error details. - :type error: ~azure.mgmt.reservations.models.ServiceError - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ServiceError'}, - } - - def __init__( - self, - **kwargs - ): - super(ExceptionResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ExchangeOperationResultResponse(msrest.serialization.Model): - """Exchange operation result. - - :param id: It should match what is used to GET the operation result. - :type id: str - :param name: It must match the last segment of the id field, and will typically be a GUID / - system generated value. - :type name: str - :param status: Status of the operation. Possible values include: "Succeeded", "Failed", - "Cancelled", "PendingRefunds", "PendingPurchases". - :type status: str or ~azure.mgmt.reservations.models.ExchangeOperationResultStatus - :param properties: Exchange response properties. - :type properties: ~azure.mgmt.reservations.models.ExchangeResponseProperties - :param error: Required if status == failed or status == canceled. - :type error: ~azure.mgmt.reservations.models.OperationResultError - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ExchangeResponseProperties'}, - 'error': {'key': 'error', 'type': 'OperationResultError'}, - } - - def __init__( - self, - **kwargs - ): - super(ExchangeOperationResultResponse, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs.get('status', None) - self.properties = kwargs.get('properties', None) - self.error = kwargs.get('error', None) - - -class ExchangePolicyError(msrest.serialization.Model): - """error details. - - :param code: - :type code: str - :param message: - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExchangePolicyError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class ExchangePolicyErrors(msrest.serialization.Model): - """Exchange policy errors. - - :param policy_errors: Exchange Policy errors. - :type policy_errors: list[~azure.mgmt.reservations.models.ExchangePolicyError] - """ - - _attribute_map = { - 'policy_errors': {'key': 'policyErrors', 'type': '[ExchangePolicyError]'}, - } - - def __init__( - self, - **kwargs - ): - super(ExchangePolicyErrors, self).__init__(**kwargs) - self.policy_errors = kwargs.get('policy_errors', None) - - -class ExchangeRequest(msrest.serialization.Model): - """Exchange request. - - :param properties: Exchange request properties. - :type properties: ~azure.mgmt.reservations.models.ExchangeRequestProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ExchangeRequestProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ExchangeRequest, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ExchangeRequestProperties(msrest.serialization.Model): - """Exchange request properties. - - :param session_id: SessionId that was returned by CalculateExchange API. - :type session_id: str - """ - - _attribute_map = { - 'session_id': {'key': 'sessionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExchangeRequestProperties, self).__init__(**kwargs) - self.session_id = kwargs.get('session_id', None) - - -class ExchangeResponseProperties(msrest.serialization.Model): - """Exchange response properties. - - :param session_id: Exchange session identifier. - :type session_id: str - :param net_payable: - :type net_payable: ~azure.mgmt.reservations.models.Price - :param refunds_total: - :type refunds_total: ~azure.mgmt.reservations.models.Price - :param purchases_total: - :type purchases_total: ~azure.mgmt.reservations.models.Price - :param reservations_to_purchase: Details of the reservations being purchased. - :type reservations_to_purchase: - list[~azure.mgmt.reservations.models.ReservationToPurchaseExchange] - :param reservations_to_exchange: Details of the reservations being returned. - :type reservations_to_exchange: - list[~azure.mgmt.reservations.models.ReservationToReturnForExchange] - :param policy_result: Exchange policy errors. - :type policy_result: ~azure.mgmt.reservations.models.ExchangePolicyErrors - """ - - _attribute_map = { - 'session_id': {'key': 'sessionId', 'type': 'str'}, - 'net_payable': {'key': 'netPayable', 'type': 'Price'}, - 'refunds_total': {'key': 'refundsTotal', 'type': 'Price'}, - 'purchases_total': {'key': 'purchasesTotal', 'type': 'Price'}, - 'reservations_to_purchase': {'key': 'reservationsToPurchase', 'type': '[ReservationToPurchaseExchange]'}, - 'reservations_to_exchange': {'key': 'reservationsToExchange', 'type': '[ReservationToReturnForExchange]'}, - 'policy_result': {'key': 'policyResult', 'type': 'ExchangePolicyErrors'}, - } - - def __init__( - self, - **kwargs - ): - super(ExchangeResponseProperties, self).__init__(**kwargs) - self.session_id = kwargs.get('session_id', None) - self.net_payable = kwargs.get('net_payable', None) - self.refunds_total = kwargs.get('refunds_total', None) - self.purchases_total = kwargs.get('purchases_total', None) - self.reservations_to_purchase = kwargs.get('reservations_to_purchase', None) - self.reservations_to_exchange = kwargs.get('reservations_to_exchange', None) - self.policy_result = kwargs.get('policy_result', None) - - -class ExtendedErrorInfo(msrest.serialization.Model): - """ExtendedErrorInfo. - - :param code: Possible values include: "NotSpecified", "InternalServerError", "ServerTimeout", - "AuthorizationFailed", "BadRequest", "ClientCertificateThumbprintNotSet", - "InvalidRequestContent", "OperationFailed", "HttpMethodNotSupported", "InvalidRequestUri", - "MissingTenantId", "InvalidTenantId", "InvalidReservationOrderId", "InvalidReservationId", - "ReservationIdNotInReservationOrder", "ReservationOrderNotFound", "InvalidSubscriptionId", - "InvalidAccessToken", "InvalidLocationId", "UnauthenticatedRequestsThrottled", - "InvalidHealthCheckType", "Forbidden", "BillingScopeIdCannotBeChanged", - "AppliedScopesNotAssociatedWithCommerceAccount", "PatchValuesSameAsExisting", - "RoleAssignmentCreationFailed", "ReservationOrderCreationFailed", "ReservationOrderNotEnabled", - "CapacityUpdateScopesFailed", "UnsupportedReservationTerm", "ReservationOrderIdAlreadyExists", - "RiskCheckFailed", "CreateQuoteFailed", "ActivateQuoteFailed", "NonsupportedAccountId", - "PaymentInstrumentNotFound", "MissingAppliedScopesForSingle", "NoValidReservationsToReRate", - "ReRateOnlyAllowedForEA", "OperationCannotBePerformedInCurrentState", - "InvalidSingleAppliedScopesCount", "InvalidFulfillmentRequestParameters", - "NotSupportedCountry", "InvalidRefundQuantity", "PurchaseError", "BillingCustomerInputError", - "BillingPaymentInstrumentSoftError", "BillingPaymentInstrumentHardError", - "BillingTransientError", "BillingError", "FulfillmentConfigurationError", - "FulfillmentOutOfStockError", "FulfillmentTransientError", "FulfillmentError", - "CalculatePriceFailed". - :type code: str or ~azure.mgmt.reservations.models.ErrorResponseCode - :param message: - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedErrorInfo, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class ExtendedStatusInfo(msrest.serialization.Model): - """ExtendedStatusInfo. - - :param status_code: Possible values include: "None", "Pending", "Active", "PurchaseError", - "PaymentInstrumentError", "Split", "Merged", "Expired", "Succeeded". - :type status_code: str or ~azure.mgmt.reservations.models.ReservationStatusCode - :param message: The message giving detailed information about the status code. - :type message: str - """ - - _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedStatusInfo, self).__init__(**kwargs) - self.status_code = kwargs.get('status_code', None) - self.message = kwargs.get('message', None) - - -class MergeRequest(msrest.serialization.Model): - """MergeRequest. - - :param sources: Format of the resource id should be - /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type sources: list[str] - """ - - _attribute_map = { - 'sources': {'key': 'properties.sources', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MergeRequest, self).__init__(**kwargs) - self.sources = kwargs.get('sources', None) - - -class OperationDisplay(msrest.serialization.Model): - """OperationDisplay. - - :param provider: - :type provider: str - :param resource: - :type resource: str - :param operation: - :type operation: str - :param description: - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationList(msrest.serialization.Model): - """OperationList. - - :param value: - :type value: list[~azure.mgmt.reservations.models.OperationResponse] - :param next_link: Url to get the next page of items. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationResponse]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationResponse(msrest.serialization.Model): - """OperationResponse. - - :param name: - :type name: str - :param display: - :type display: ~azure.mgmt.reservations.models.OperationDisplay - :param origin: - :type origin: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResponse, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - - -class OperationResultError(msrest.serialization.Model): - """Required if status == failed or status == canceled. - - :param code: Required if status == failed or status == cancelled. If status == failed, provide - an invariant error code used for error troubleshooting, aggregation, and analysis. - :type code: str - :param message: Required if status == failed. Localized. If status == failed, provide an - actionable error message indicating what error occurred, and what the user can do to address - the issue. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResultError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class Patch(msrest.serialization.Model): - """Patch. - - :param applied_scope_type: Type of the Applied Scope. Possible values include: "Single", - "Shared". - :type applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType - :param applied_scopes: List of the subscriptions that the benefit will be applied. Do not - specify if AppliedScopeType is Shared. - :type applied_scopes: list[str] - :param instance_flexibility: Turning this on will apply the reservation discount to other VMs - in the same VM size group. Only specify for VirtualMachines reserved resource type. Possible - values include: "On", "Off". - :type instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility - :param name: Name of the Reservation. - :type name: str - :param renew: Setting this to true will automatically purchase a new reservation on the - expiration date time. - :type renew: bool - :param renew_properties: - :type renew_properties: ~azure.mgmt.reservations.models.PatchPropertiesRenewProperties - """ - - _attribute_map = { - 'applied_scope_type': {'key': 'properties.appliedScopeType', 'type': 'str'}, - 'applied_scopes': {'key': 'properties.appliedScopes', 'type': '[str]'}, - 'instance_flexibility': {'key': 'properties.instanceFlexibility', 'type': 'str'}, - 'name': {'key': 'properties.name', 'type': 'str'}, - 'renew': {'key': 'properties.renew', 'type': 'bool'}, - 'renew_properties': {'key': 'properties.renewProperties', 'type': 'PatchPropertiesRenewProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Patch, self).__init__(**kwargs) - self.applied_scope_type = kwargs.get('applied_scope_type', None) - self.applied_scopes = kwargs.get('applied_scopes', None) - self.instance_flexibility = kwargs.get('instance_flexibility', None) - self.name = kwargs.get('name', None) - self.renew = kwargs.get('renew', False) - self.renew_properties = kwargs.get('renew_properties', None) - - -class PatchPropertiesRenewProperties(msrest.serialization.Model): - """PatchPropertiesRenewProperties. - - :param purchase_properties: - :type purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest - """ - - _attribute_map = { - 'purchase_properties': {'key': 'purchaseProperties', 'type': 'PurchaseRequest'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchPropertiesRenewProperties, self).__init__(**kwargs) - self.purchase_properties = kwargs.get('purchase_properties', None) - - -class PaymentDetail(msrest.serialization.Model): - """Information about payment related to a reservation order. - - :param due_date: Date when the payment needs to be done. - :type due_date: ~datetime.date - :param payment_date: Date when the transaction is completed. Is null when it is scheduled. - :type payment_date: ~datetime.date - :param pricing_currency_total: Amount in pricing currency. Tax not included. - :type pricing_currency_total: ~azure.mgmt.reservations.models.Price - :param billing_currency_total: Amount charged in Billing currency. Tax not included. Is null - for future payments. - :type billing_currency_total: ~azure.mgmt.reservations.models.Price - :param billing_account: Shows the Account that is charged for this payment. - :type billing_account: str - :param status: Describes whether the payment is completed, failed, cancelled or scheduled in - the future. Possible values include: "Succeeded", "Failed", "Scheduled", "Cancelled". - :type status: str or ~azure.mgmt.reservations.models.PaymentStatus - :param extended_status_info: - :type extended_status_info: ~azure.mgmt.reservations.models.ExtendedStatusInfo - """ - - _attribute_map = { - 'due_date': {'key': 'dueDate', 'type': 'date'}, - 'payment_date': {'key': 'paymentDate', 'type': 'date'}, - 'pricing_currency_total': {'key': 'pricingCurrencyTotal', 'type': 'Price'}, - 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'Price'}, - 'billing_account': {'key': 'billingAccount', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'extended_status_info': {'key': 'extendedStatusInfo', 'type': 'ExtendedStatusInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(PaymentDetail, self).__init__(**kwargs) - self.due_date = kwargs.get('due_date', None) - self.payment_date = kwargs.get('payment_date', None) - self.pricing_currency_total = kwargs.get('pricing_currency_total', None) - self.billing_currency_total = kwargs.get('billing_currency_total', None) - self.billing_account = kwargs.get('billing_account', None) - self.status = kwargs.get('status', None) - self.extended_status_info = kwargs.get('extended_status_info', None) - - -class Price(msrest.serialization.Model): - """Price. - - :param currency_code: The ISO 4217 3-letter currency code for the currency used by this - purchase record. - :type currency_code: str - :param amount: - :type amount: float - """ - - _attribute_map = { - 'currency_code': {'key': 'currencyCode', 'type': 'str'}, - 'amount': {'key': 'amount', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(Price, self).__init__(**kwargs) - self.currency_code = kwargs.get('currency_code', None) - self.amount = kwargs.get('amount', None) - - -class PurchaseRequest(msrest.serialization.Model): - """PurchaseRequest. - - :param sku: - :type sku: ~azure.mgmt.reservations.models.SkuName - :param location: The Azure Region where the reserved resource lives. - :type location: str - :param reserved_resource_type: The type of the resource that is being reserved. Possible values - include: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", - "SqlDataWarehouse", "VMwareCloudSimple", "RedHatOsa", "Databricks", "AppService", - "ManagedDisk", "BlockBlob", "RedisCache", "AzureDataExplorer", "MySql", "MariaDb", - "PostgreSql", "DedicatedHost", "SapHana", "SqlAzureHybridBenefit". - :type reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType - :param billing_scope_id: Subscription that will be charged for purchasing Reservation. - :type billing_scope_id: str - :param term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y". - :type term: str or ~azure.mgmt.reservations.models.ReservationTerm - :param billing_plan: Represent the billing plans. Possible values include: "Upfront", - "Monthly". - :type billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan - :param quantity: Quantity of the SKUs that are part of the Reservation. Must be greater than - zero. - :type quantity: int - :param display_name: Friendly name of the Reservation. - :type display_name: str - :param applied_scope_type: Type of the Applied Scope. Possible values include: "Single", - "Shared". - :type applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType - :param applied_scopes: List of the subscriptions that the benefit will be applied. Do not - specify if AppliedScopeType is Shared. - :type applied_scopes: list[str] - :param renew: Setting this to true will automatically purchase a new reservation on the - expiration date time. - :type renew: bool - :param reserved_resource_properties: Properties specific to each reserved resource type. Not - required if not applicable. - :type reserved_resource_properties: - ~azure.mgmt.reservations.models.PurchaseRequestPropertiesReservedResourceProperties - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'SkuName'}, - 'location': {'key': 'location', 'type': 'str'}, - 'reserved_resource_type': {'key': 'properties.reservedResourceType', 'type': 'str'}, - 'billing_scope_id': {'key': 'properties.billingScopeId', 'type': 'str'}, - 'term': {'key': 'properties.term', 'type': 'str'}, - 'billing_plan': {'key': 'properties.billingPlan', 'type': 'str'}, - 'quantity': {'key': 'properties.quantity', 'type': 'int'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'applied_scope_type': {'key': 'properties.appliedScopeType', 'type': 'str'}, - 'applied_scopes': {'key': 'properties.appliedScopes', 'type': '[str]'}, - 'renew': {'key': 'properties.renew', 'type': 'bool'}, - 'reserved_resource_properties': {'key': 'properties.reservedResourceProperties', 'type': 'PurchaseRequestPropertiesReservedResourceProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PurchaseRequest, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.location = kwargs.get('location', None) - self.reserved_resource_type = kwargs.get('reserved_resource_type', None) - self.billing_scope_id = kwargs.get('billing_scope_id', None) - self.term = kwargs.get('term', None) - self.billing_plan = kwargs.get('billing_plan', None) - self.quantity = kwargs.get('quantity', None) - self.display_name = kwargs.get('display_name', None) - self.applied_scope_type = kwargs.get('applied_scope_type', None) - self.applied_scopes = kwargs.get('applied_scopes', None) - self.renew = kwargs.get('renew', False) - self.reserved_resource_properties = kwargs.get('reserved_resource_properties', None) - - -class PurchaseRequestPropertiesReservedResourceProperties(msrest.serialization.Model): - """Properties specific to each reserved resource type. Not required if not applicable. - - :param instance_flexibility: Turning this on will apply the reservation discount to other VMs - in the same VM size group. Only specify for VirtualMachines reserved resource type. Possible - values include: "On", "Off". - :type instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility - """ - - _attribute_map = { - 'instance_flexibility': {'key': 'instanceFlexibility', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PurchaseRequestPropertiesReservedResourceProperties, self).__init__(**kwargs) - self.instance_flexibility = kwargs.get('instance_flexibility', None) - - -class QuotaLimits(msrest.serialization.Model): - """Quota limits. - - :param value: List of quotas (service limits). - :type value: list[~azure.mgmt.reservations.models.CurrentQuotaLimitBase] - :param next_link: The URI for fetching the next page of quotas (service limits). When no more - pages exist, the value is null. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CurrentQuotaLimitBase]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaLimits, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class QuotaLimitsResponse(msrest.serialization.Model): - """Quotas (service limits) in the request response. - - :param value: List of quotas with the quota request status. - :type value: list[~azure.mgmt.reservations.models.CurrentQuotaLimit] - :param next_link: The URI for fetching the next page of quota limits. When no more pages exist, - the value is null. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CurrentQuotaLimit]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaLimitsResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class QuotaProperties(msrest.serialization.Model): - """Quota properties for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param limit: Quota properties. - :type limit: int - :ivar current_value: Current usage value for the resource. - :vartype current_value: int - :param unit: The limit units, such as **count** and **bytes**. Use the unit field provided in - the response of the GET quota operation. - :type unit: str - :param name: Name of the resource provide by the resource provider. Use this property for - quotaRequests resource operations. - :type name: ~azure.mgmt.reservations.models.ResourceName - :param resource_type: The name of the resource type. Possible values include: "standard", - "dedicated", "lowPriority", "shared", "serviceSpecific". - :type resource_type: str or ~azure.mgmt.reservations.models.ResourceType - :ivar quota_period: The time period over which the quota usage values are summarized. For - example, P1D (per one day), PT1M (per one minute), and PT1S (per one second). This parameter is - optional because, for some resources such as compute, the time period is irrelevant. - :vartype quota_period: str - :param properties: Additional properties for the specified resource provider. - :type properties: any - """ - - _validation = { - 'current_value': {'readonly': True}, - 'quota_period': {'readonly': True}, - } - - _attribute_map = { - 'limit': {'key': 'limit', 'type': 'int'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'ResourceName'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaProperties, self).__init__(**kwargs) - self.limit = kwargs.get('limit', None) - self.current_value = None - self.unit = kwargs.get('unit', None) - self.name = kwargs.get('name', None) - self.resource_type = kwargs.get('resource_type', None) - self.quota_period = None - self.properties = kwargs.get('properties', None) - - -class QuotaRequestDetails(msrest.serialization.Model): - """Quota request details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Quota request ID. - :vartype id: str - :ivar name: Quota request name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param provisioning_state: The quota request status. Possible values include: "Accepted", - "Invalid", "Succeeded", "Failed", "InProgress". - :type provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState - :ivar message: User friendly status message. - :vartype message: str - :ivar request_submit_time: The time when the quota request was submitted using format: - yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - :vartype request_submit_time: ~datetime.datetime - :param value: The quotaRequests. - :type value: list[~azure.mgmt.reservations.models.SubRequest] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'message': {'readonly': True}, - 'request_submit_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'message': {'key': 'properties.message', 'type': 'str'}, - 'request_submit_time': {'key': 'properties.requestSubmitTime', 'type': 'iso-8601'}, - 'value': {'key': 'properties.value', 'type': '[SubRequest]'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaRequestDetails, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.message = None - self.request_submit_time = None - self.value = kwargs.get('value', None) - - -class QuotaRequestDetailsList(msrest.serialization.Model): - """Quota request details. - - :param value: The quota requests. - :type value: list[~azure.mgmt.reservations.models.QuotaRequestDetails] - :param next_link: The URI to fetch the next page of quota limits. When there are no more pages, - this is null. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[QuotaRequestDetails]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaRequestDetailsList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class QuotaRequestOneResourceSubmitResponse(msrest.serialization.Model): - """Response for the quota submission request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The quota request ID. - :vartype id: str - :ivar name: The name of the quota request. - :vartype name: str - :ivar type: Type of resource. "Microsoft.Capacity/ServiceLimits". - :vartype type: str - :ivar provisioning_state: The quota request status. Possible values include: "Accepted", - "Invalid", "Succeeded", "Failed", "InProgress". - :vartype provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState - :ivar message: User friendly status message. - :vartype message: str - :ivar request_submit_time: The time when the quota request was submitted using format: - yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - :vartype request_submit_time: ~datetime.datetime - :param properties: Quota properties for the resource. - :type properties: ~azure.mgmt.reservations.models.QuotaProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'message': {'readonly': True}, - 'request_submit_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'message': {'key': 'properties.message', 'type': 'str'}, - 'request_submit_time': {'key': 'properties.requestSubmitTime', 'type': 'iso-8601'}, - 'properties': {'key': 'properties.properties.properties', 'type': 'QuotaProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaRequestOneResourceSubmitResponse, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.provisioning_state = None - self.message = None - self.request_submit_time = None - self.properties = kwargs.get('properties', None) - - -class QuotaRequestProperties(msrest.serialization.Model): - """The details of quota request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param provisioning_state: The quota request status. Possible values include: "Accepted", - "Invalid", "Succeeded", "Failed", "InProgress". - :type provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState - :ivar message: User friendly status message. - :vartype message: str - :ivar request_submit_time: The time when the quota request was submitted using format: - yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - :vartype request_submit_time: ~datetime.datetime - :param value: The quotaRequests. - :type value: list[~azure.mgmt.reservations.models.SubRequest] - """ - - _validation = { - 'message': {'readonly': True}, - 'request_submit_time': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'request_submit_time': {'key': 'requestSubmitTime', 'type': 'iso-8601'}, - 'value': {'key': 'value', 'type': '[SubRequest]'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaRequestProperties, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.message = None - self.request_submit_time = None - self.value = kwargs.get('value', None) - - -class QuotaRequestSubmitResponse(msrest.serialization.Model): - """Response for the quota submission request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The quota request ID. - :vartype id: str - :ivar name: The name of the quota request. - :vartype name: str - :param properties: The quota request details. - :type properties: ~azure.mgmt.reservations.models.QuotaRequestProperties - :ivar type: Type of resource. "Microsoft.Capacity/serviceLimits". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'QuotaRequestProperties'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaRequestSubmitResponse, self).__init__(**kwargs) - self.id = None - self.name = None - self.properties = kwargs.get('properties', None) - self.type = None - - -class QuotaRequestSubmitResponse201(msrest.serialization.Model): - """Response with request ID that the quota request was accepted. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The quota request ID. Use the requestId parameter to check the request status. - :vartype id: str - :ivar name: Operation ID. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar provisioning_state: The details of the quota request status. Possible values include: - "Accepted", "Invalid", "Succeeded", "Failed", "InProgress". - :vartype provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState - :ivar message: A user friendly message. - :vartype message: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'message': {'key': 'properties.message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaRequestSubmitResponse201, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.provisioning_state = None - self.message = None - - -class RenewPropertiesResponse(msrest.serialization.Model): - """RenewPropertiesResponse. - - :param purchase_properties: - :type purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest - :param pricing_currency_total: Amount that Microsoft uses for record. Used during refund for - calculating refund limit. Tax is not included. This is locked price 30 days before expiry. - :type pricing_currency_total: - ~azure.mgmt.reservations.models.RenewPropertiesResponsePricingCurrencyTotal - :param billing_currency_total: Currency and amount that customer will be charged in customer's - local currency for renewal purchase. Tax is not included. - :type billing_currency_total: - ~azure.mgmt.reservations.models.RenewPropertiesResponseBillingCurrencyTotal - """ - - _attribute_map = { - 'purchase_properties': {'key': 'purchaseProperties', 'type': 'PurchaseRequest'}, - 'pricing_currency_total': {'key': 'pricingCurrencyTotal', 'type': 'RenewPropertiesResponsePricingCurrencyTotal'}, - 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'RenewPropertiesResponseBillingCurrencyTotal'}, - } - - def __init__( - self, - **kwargs - ): - super(RenewPropertiesResponse, self).__init__(**kwargs) - self.purchase_properties = kwargs.get('purchase_properties', None) - self.pricing_currency_total = kwargs.get('pricing_currency_total', None) - self.billing_currency_total = kwargs.get('billing_currency_total', None) - - -class RenewPropertiesResponseBillingCurrencyTotal(msrest.serialization.Model): - """Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not included. - - :param currency_code: - :type currency_code: str - :param amount: - :type amount: float - """ - - _attribute_map = { - 'currency_code': {'key': 'currencyCode', 'type': 'str'}, - 'amount': {'key': 'amount', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(RenewPropertiesResponseBillingCurrencyTotal, self).__init__(**kwargs) - self.currency_code = kwargs.get('currency_code', None) - self.amount = kwargs.get('amount', None) - - -class RenewPropertiesResponsePricingCurrencyTotal(msrest.serialization.Model): - """Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. - - :param currency_code: - :type currency_code: str - :param amount: - :type amount: float - """ - - _attribute_map = { - 'currency_code': {'key': 'currencyCode', 'type': 'str'}, - 'amount': {'key': 'amount', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(RenewPropertiesResponsePricingCurrencyTotal, self).__init__(**kwargs) - self.currency_code = kwargs.get('currency_code', None) - self.amount = kwargs.get('amount', None) - - -class ReservationList(msrest.serialization.Model): - """ReservationList. - - :param value: - :type value: list[~azure.mgmt.reservations.models.ReservationResponse] - :param next_link: Url to get the next page of reservations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ReservationResponse]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ReservationMergeProperties(msrest.serialization.Model): - """ReservationMergeProperties. - - :param merge_destination: Reservation Resource Id Created due to the merge. Format of the - resource Id is - /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type merge_destination: str - :param merge_sources: Resource Ids of the Source Reservation's merged to form this Reservation. - Format of the resource Id is - /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type merge_sources: list[str] - """ - - _attribute_map = { - 'merge_destination': {'key': 'mergeDestination', 'type': 'str'}, - 'merge_sources': {'key': 'mergeSources', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationMergeProperties, self).__init__(**kwargs) - self.merge_destination = kwargs.get('merge_destination', None) - self.merge_sources = kwargs.get('merge_sources', None) - - -class ReservationOrderBillingPlanInformation(msrest.serialization.Model): - """Information describing the type of billing plan for this reservation. - - :param pricing_currency_total: Amount of money to be paid for the Order. Tax is not included. - :type pricing_currency_total: ~azure.mgmt.reservations.models.Price - :param start_date: Date when the billing plan has started. - :type start_date: ~datetime.date - :param next_payment_due_date: For recurring billing plans, indicates the date when next payment - will be processed. Null when total is paid off. - :type next_payment_due_date: ~datetime.date - :param transactions: - :type transactions: list[~azure.mgmt.reservations.models.PaymentDetail] - """ - - _attribute_map = { - 'pricing_currency_total': {'key': 'pricingCurrencyTotal', 'type': 'Price'}, - 'start_date': {'key': 'startDate', 'type': 'date'}, - 'next_payment_due_date': {'key': 'nextPaymentDueDate', 'type': 'date'}, - 'transactions': {'key': 'transactions', 'type': '[PaymentDetail]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationOrderBillingPlanInformation, self).__init__(**kwargs) - self.pricing_currency_total = kwargs.get('pricing_currency_total', None) - self.start_date = kwargs.get('start_date', None) - self.next_payment_due_date = kwargs.get('next_payment_due_date', None) - self.transactions = kwargs.get('transactions', None) - - -class ReservationOrderList(msrest.serialization.Model): - """ReservationOrderList. - - :param value: - :type value: list[~azure.mgmt.reservations.models.ReservationOrderResponse] - :param next_link: Url to get the next page of reservationOrders. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ReservationOrderResponse]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationOrderList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ReservationOrderResponse(msrest.serialization.Model): - """ReservationOrderResponse. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param etag: - :type etag: int - :ivar id: Identifier of the reservation. - :vartype id: str - :ivar name: Name of the reservation. - :vartype name: str - :ivar type: Type of resource. "Microsoft.Capacity/reservations". - :vartype type: str - :param display_name: Friendly name for user to easily identified the reservation. - :type display_name: str - :param request_date_time: This is the DateTime when the reservation was initially requested for - purchase. - :type request_date_time: ~datetime.datetime - :param created_date_time: This is the DateTime when the reservation was created. - :type created_date_time: ~datetime.datetime - :param expiry_date: This is the date when the Reservation will expire. - :type expiry_date: ~datetime.date - :param original_quantity: Quantity of the SKUs that are part of the Reservation. Must be - greater than zero. - :type original_quantity: int - :param term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y". - :type term: str or ~azure.mgmt.reservations.models.ReservationTerm - :param provisioning_state: Current state of the reservation. - :type provisioning_state: str - :param billing_plan: Represent the billing plans. Possible values include: "Upfront", - "Monthly". - :type billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan - :param plan_information: Information describing the type of billing plan for this reservation. - :type plan_information: ~azure.mgmt.reservations.models.ReservationOrderBillingPlanInformation - :param reservations: - :type reservations: list[~azure.mgmt.reservations.models.ReservationResponse] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'int'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'request_date_time': {'key': 'properties.requestDateTime', 'type': 'iso-8601'}, - 'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'}, - 'expiry_date': {'key': 'properties.expiryDate', 'type': 'date'}, - 'original_quantity': {'key': 'properties.originalQuantity', 'type': 'int'}, - 'term': {'key': 'properties.term', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'billing_plan': {'key': 'properties.billingPlan', 'type': 'str'}, - 'plan_information': {'key': 'properties.planInformation', 'type': 'ReservationOrderBillingPlanInformation'}, - 'reservations': {'key': 'properties.reservations', 'type': '[ReservationResponse]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationOrderResponse, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.id = None - self.name = None - self.type = None - self.display_name = kwargs.get('display_name', None) - self.request_date_time = kwargs.get('request_date_time', None) - self.created_date_time = kwargs.get('created_date_time', None) - self.expiry_date = kwargs.get('expiry_date', None) - self.original_quantity = kwargs.get('original_quantity', None) - self.term = kwargs.get('term', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.billing_plan = kwargs.get('billing_plan', None) - self.plan_information = kwargs.get('plan_information', None) - self.reservations = kwargs.get('reservations', None) - - -class ReservationProperties(msrest.serialization.Model): - """ReservationProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param reserved_resource_type: The type of the resource that is being reserved. Possible values - include: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", - "SqlDataWarehouse", "VMwareCloudSimple", "RedHatOsa", "Databricks", "AppService", - "ManagedDisk", "BlockBlob", "RedisCache", "AzureDataExplorer", "MySql", "MariaDb", - "PostgreSql", "DedicatedHost", "SapHana", "SqlAzureHybridBenefit". - :type reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType - :param instance_flexibility: Turning this on will apply the reservation discount to other VMs - in the same VM size group. Only specify for VirtualMachines reserved resource type. Possible - values include: "On", "Off". - :type instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility - :param display_name: Friendly name for user to easily identify the reservation. - :type display_name: str - :param applied_scopes: List of the subscriptions that the benefit will be applied. Do not - specify if AppliedScopeType is Shared. - :type applied_scopes: list[str] - :param applied_scope_type: Type of the Applied Scope. Possible values include: "Single", - "Shared". - :type applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType - :param quantity: Quantity of the SKUs that are part of the Reservation. Must be greater than - zero. - :type quantity: int - :param provisioning_state: Current state of the reservation. - :type provisioning_state: str - :param effective_date_time: DateTime of the Reservation starting when this version is effective - from. - :type effective_date_time: ~datetime.datetime - :ivar last_updated_date_time: DateTime of the last time the Reservation was updated. - :vartype last_updated_date_time: ~datetime.datetime - :param expiry_date: This is the date when the Reservation will expire. - :type expiry_date: ~datetime.date - :param sku_description: Description of the SKU in english. - :type sku_description: str - :param extended_status_info: - :type extended_status_info: ~azure.mgmt.reservations.models.ExtendedStatusInfo - :param billing_plan: Represent the billing plans. Possible values include: "Upfront", - "Monthly". - :type billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan - :param split_properties: - :type split_properties: ~azure.mgmt.reservations.models.ReservationSplitProperties - :param merge_properties: - :type merge_properties: ~azure.mgmt.reservations.models.ReservationMergeProperties - :param billing_scope_id: Subscription that will be charged for purchasing Reservation. - :type billing_scope_id: str - :param renew: Setting this to true will automatically purchase a new reservation on the - expiration date time. - :type renew: bool - :param renew_source: Reservation Id of the reservation from which this reservation is renewed. - Format of the resource Id is - /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type renew_source: str - :param renew_destination: Reservation Id of the reservation which is purchased because of - renew. Format of the resource Id is - /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type renew_destination: str - :param renew_properties: - :type renew_properties: ~azure.mgmt.reservations.models.RenewPropertiesResponse - :param term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y". - :type term: str or ~azure.mgmt.reservations.models.ReservationTerm - """ - - _validation = { - 'last_updated_date_time': {'readonly': True}, - } - - _attribute_map = { - 'reserved_resource_type': {'key': 'reservedResourceType', 'type': 'str'}, - 'instance_flexibility': {'key': 'instanceFlexibility', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'applied_scopes': {'key': 'appliedScopes', 'type': '[str]'}, - 'applied_scope_type': {'key': 'appliedScopeType', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'int'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'effective_date_time': {'key': 'effectiveDateTime', 'type': 'iso-8601'}, - 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'iso-8601'}, - 'expiry_date': {'key': 'expiryDate', 'type': 'date'}, - 'sku_description': {'key': 'skuDescription', 'type': 'str'}, - 'extended_status_info': {'key': 'extendedStatusInfo', 'type': 'ExtendedStatusInfo'}, - 'billing_plan': {'key': 'billingPlan', 'type': 'str'}, - 'split_properties': {'key': 'splitProperties', 'type': 'ReservationSplitProperties'}, - 'merge_properties': {'key': 'mergeProperties', 'type': 'ReservationMergeProperties'}, - 'billing_scope_id': {'key': 'billingScopeId', 'type': 'str'}, - 'renew': {'key': 'renew', 'type': 'bool'}, - 'renew_source': {'key': 'renewSource', 'type': 'str'}, - 'renew_destination': {'key': 'renewDestination', 'type': 'str'}, - 'renew_properties': {'key': 'renewProperties', 'type': 'RenewPropertiesResponse'}, - 'term': {'key': 'term', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationProperties, self).__init__(**kwargs) - self.reserved_resource_type = kwargs.get('reserved_resource_type', None) - self.instance_flexibility = kwargs.get('instance_flexibility', None) - self.display_name = kwargs.get('display_name', None) - self.applied_scopes = kwargs.get('applied_scopes', None) - self.applied_scope_type = kwargs.get('applied_scope_type', None) - self.quantity = kwargs.get('quantity', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.effective_date_time = kwargs.get('effective_date_time', None) - self.last_updated_date_time = None - self.expiry_date = kwargs.get('expiry_date', None) - self.sku_description = kwargs.get('sku_description', None) - self.extended_status_info = kwargs.get('extended_status_info', None) - self.billing_plan = kwargs.get('billing_plan', None) - self.split_properties = kwargs.get('split_properties', None) - self.merge_properties = kwargs.get('merge_properties', None) - self.billing_scope_id = kwargs.get('billing_scope_id', None) - self.renew = kwargs.get('renew', False) - self.renew_source = kwargs.get('renew_source', None) - self.renew_destination = kwargs.get('renew_destination', None) - self.renew_properties = kwargs.get('renew_properties', None) - self.term = kwargs.get('term', None) - - -class ReservationResponse(msrest.serialization.Model): - """ReservationResponse. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: The Azure Region where the reserved resource lives. - :vartype location: str - :param etag: - :type etag: int - :ivar id: Identifier of the reservation. - :vartype id: str - :ivar name: Name of the reservation. - :vartype name: str - :param sku: - :type sku: ~azure.mgmt.reservations.models.SkuName - :param properties: - :type properties: ~azure.mgmt.reservations.models.ReservationProperties - :ivar type: Type of resource. "Microsoft.Capacity/reservationOrders/reservations". - :vartype type: str - """ - - _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'int'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SkuName'}, - 'properties': {'key': 'properties', 'type': 'ReservationProperties'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationResponse, self).__init__(**kwargs) - self.location = None - self.etag = kwargs.get('etag', None) - self.id = None - self.name = None - self.sku = kwargs.get('sku', None) - self.properties = kwargs.get('properties', None) - self.type = None - - -class ReservationSplitProperties(msrest.serialization.Model): - """ReservationSplitProperties. - - :param split_destinations: List of destination Resource Id that are created due to split. - Format of the resource Id is - /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type split_destinations: list[str] - :param split_source: Resource Id of the Reservation from which this is split. Format of the - resource Id is - /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type split_source: str - """ - - _attribute_map = { - 'split_destinations': {'key': 'splitDestinations', 'type': '[str]'}, - 'split_source': {'key': 'splitSource', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationSplitProperties, self).__init__(**kwargs) - self.split_destinations = kwargs.get('split_destinations', None) - self.split_source = kwargs.get('split_source', None) - - -class ReservationToExchange(msrest.serialization.Model): - """Reservation refund details. - - :param reservation_id: Fully qualified id of the Reservation being returned. - :type reservation_id: str - :param quantity: Quantity to be returned. - :type quantity: int - :param billing_refund_amount: - :type billing_refund_amount: ~azure.mgmt.reservations.models.Price - :param billing_information: billing information. - :type billing_information: ~azure.mgmt.reservations.models.BillingInformation - """ - - _attribute_map = { - 'reservation_id': {'key': 'reservationId', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'int'}, - 'billing_refund_amount': {'key': 'billingRefundAmount', 'type': 'Price'}, - 'billing_information': {'key': 'billingInformation', 'type': 'BillingInformation'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationToExchange, self).__init__(**kwargs) - self.reservation_id = kwargs.get('reservation_id', None) - self.quantity = kwargs.get('quantity', None) - self.billing_refund_amount = kwargs.get('billing_refund_amount', None) - self.billing_information = kwargs.get('billing_information', None) - - -class ReservationToPurchaseCalculateExchange(msrest.serialization.Model): - """Reservation purchase details. - - :param properties: - :type properties: ~azure.mgmt.reservations.models.PurchaseRequest - :param billing_currency_total: - :type billing_currency_total: ~azure.mgmt.reservations.models.Price - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'PurchaseRequest'}, - 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'Price'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationToPurchaseCalculateExchange, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.billing_currency_total = kwargs.get('billing_currency_total', None) - - -class ReservationToPurchaseExchange(msrest.serialization.Model): - """Reservation purchase details. - - :param reservation_order_id: Fully qualified id of the ReservationOrder being purchased. - :type reservation_order_id: str - :param reservation_id: Fully qualified id of the Reservation being purchased. This value is - only guaranteed to be non-null if the purchase is successful. - :type reservation_id: str - :param properties: - :type properties: ~azure.mgmt.reservations.models.PurchaseRequest - :param billing_currency_total: - :type billing_currency_total: ~azure.mgmt.reservations.models.Price - :param status: Status of the individual operation. Possible values include: "Succeeded", - "Failed", "Cancelled", "Pending". - :type status: str or ~azure.mgmt.reservations.models.OperationStatus - """ - - _attribute_map = { - 'reservation_order_id': {'key': 'reservationOrderId', 'type': 'str'}, - 'reservation_id': {'key': 'reservationId', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PurchaseRequest'}, - 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'Price'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationToPurchaseExchange, self).__init__(**kwargs) - self.reservation_order_id = kwargs.get('reservation_order_id', None) - self.reservation_id = kwargs.get('reservation_id', None) - self.properties = kwargs.get('properties', None) - self.billing_currency_total = kwargs.get('billing_currency_total', None) - self.status = kwargs.get('status', None) - - -class ReservationToReturn(msrest.serialization.Model): - """Reservation to return. - - :param reservation_id: Fully qualified identifier of the Reservation being returned. - :type reservation_id: str - :param quantity: Quantity to be returned. Must be greater than zero. - :type quantity: int - """ - - _attribute_map = { - 'reservation_id': {'key': 'reservationId', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationToReturn, self).__init__(**kwargs) - self.reservation_id = kwargs.get('reservation_id', None) - self.quantity = kwargs.get('quantity', None) - - -class ReservationToReturnForExchange(msrest.serialization.Model): - """Reservation refund details. - - :param reservation_id: Fully qualified id of the Reservation being returned. - :type reservation_id: str - :param quantity: Quantity to be returned. - :type quantity: int - :param billing_refund_amount: - :type billing_refund_amount: ~azure.mgmt.reservations.models.Price - :param billing_information: billing information. - :type billing_information: ~azure.mgmt.reservations.models.BillingInformation - :param status: Status of the individual operation. Possible values include: "Succeeded", - "Failed", "Cancelled", "Pending". - :type status: str or ~azure.mgmt.reservations.models.OperationStatus - """ - - _attribute_map = { - 'reservation_id': {'key': 'reservationId', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'int'}, - 'billing_refund_amount': {'key': 'billingRefundAmount', 'type': 'Price'}, - 'billing_information': {'key': 'billingInformation', 'type': 'BillingInformation'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReservationToReturnForExchange, self).__init__(**kwargs) - self.reservation_id = kwargs.get('reservation_id', None) - self.quantity = kwargs.get('quantity', None) - self.billing_refund_amount = kwargs.get('billing_refund_amount', None) - self.billing_information = kwargs.get('billing_information', None) - self.status = kwargs.get('status', None) - - -class ResourceName(msrest.serialization.Model): - """Resource name provided by the resource provider. Use this property for quotaRequest parameter. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: Resource name. - :type value: str - :ivar localized_value: Resource display localized name. - :vartype localized_value: str - """ - - _validation = { - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceName, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.localized_value = None - - -class ScopeProperties(msrest.serialization.Model): - """ScopeProperties. - - :param scope: - :type scope: str - :param valid: - :type valid: bool - """ - - _attribute_map = { - 'scope': {'key': 'scope', 'type': 'str'}, - 'valid': {'key': 'valid', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeProperties, self).__init__(**kwargs) - self.scope = kwargs.get('scope', None) - self.valid = kwargs.get('valid', None) - - -class ServiceError(msrest.serialization.Model): - """The API error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param code: The error code. - :type code: str - :param message: The error message text. - :type message: str - :ivar details: The list of error details. - :vartype details: list[~azure.mgmt.reservations.models.ServiceErrorDetail] - """ - - _validation = { - 'details': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ServiceErrorDetail]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = None - - -class ServiceErrorDetail(msrest.serialization.Model): - """The error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - - -class SkuName(msrest.serialization.Model): - """SkuName. - - :param name: - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuName, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class SkuProperty(msrest.serialization.Model): - """SkuProperty. - - :param name: An invariant to describe the feature. - :type name: str - :param value: An invariant if the feature is measured by quantity. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuProperty, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class SkuRestriction(msrest.serialization.Model): - """SkuRestriction. - - :param type: The type of restrictions. - :type type: str - :param values: The value of restrictions. If the restriction type is set to location. This - would be different locations where the SKU is restricted. - :type values: list[str] - :param reason_code: The reason for restriction. - :type reason_code: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuRestriction, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.values = kwargs.get('values', None) - self.reason_code = kwargs.get('reason_code', None) - - -class SplitRequest(msrest.serialization.Model): - """SplitRequest. - - :param quantities: List of the quantities in the new reservations to create. - :type quantities: list[int] - :param reservation_id: Resource id of the reservation to be split. Format of the resource id - should be - /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type reservation_id: str - """ - - _attribute_map = { - 'quantities': {'key': 'properties.quantities', 'type': '[int]'}, - 'reservation_id': {'key': 'properties.reservationId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SplitRequest, self).__init__(**kwargs) - self.quantities = kwargs.get('quantities', None) - self.reservation_id = kwargs.get('reservation_id', None) - - -class SubRequest(msrest.serialization.Model): - """The sub-request submitted with the quota request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar limit: Quota (resource limit). - :vartype limit: int - :param name: The resource name. - :type name: ~azure.mgmt.reservations.models.ResourceName - :ivar resource_type: Resource type for which the quota check was made. - :vartype resource_type: str - :param unit: The limit units, such as **count** and **bytes**. Use the unit field provided in - the response of the GET quota operation. - :type unit: str - :param provisioning_state: The quota request status. Possible values include: "Accepted", - "Invalid", "Succeeded", "Failed", "InProgress". - :type provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState - :ivar message: User-friendly status message. - :vartype message: str - :ivar sub_request_id: Sub request ID for individual request. - :vartype sub_request_id: str - """ - - _validation = { - 'limit': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'message': {'readonly': True}, - 'sub_request_id': {'readonly': True}, - } - - _attribute_map = { - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'ResourceName'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'sub_request_id': {'key': 'subRequestId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubRequest, self).__init__(**kwargs) - self.limit = None - self.name = kwargs.get('name', None) - self.resource_type = None - self.unit = kwargs.get('unit', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.message = None - self.sub_request_id = None - - -class SubscriptionScopeProperties(msrest.serialization.Model): - """SubscriptionScopeProperties. - - :param scopes: - :type scopes: list[~azure.mgmt.reservations.models.ScopeProperties] - """ - - _attribute_map = { - 'scopes': {'key': 'scopes', 'type': '[ScopeProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionScopeProperties, self).__init__(**kwargs) - self.scopes = kwargs.get('scopes', None) 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 adb04f2714e06..7fe20207d1087 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 @@ -18,10 +18,10 @@ class AppliedReservationList(msrest.serialization.Model): """AppliedReservationList. - :param value: - :type value: list[str] - :param next_link: Url to get the next page of reservations. - :type next_link: str + :ivar value: + :vartype value: list[str] + :ivar next_link: Url to get the next page of reservations. + :vartype next_link: str """ _attribute_map = { @@ -36,6 +36,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[str] + :keyword next_link: Url to get the next page of reservations. + :paramtype next_link: str + """ super(AppliedReservationList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -52,8 +58,8 @@ class AppliedReservations(msrest.serialization.Model): :vartype name: str :ivar type: Type of resource. "Microsoft.Capacity/AppliedReservations". :vartype type: str - :param reservation_order_ids: - :type reservation_order_ids: ~azure.mgmt.reservations.models.AppliedReservationList + :ivar reservation_order_ids: + :vartype reservation_order_ids: ~azure.mgmt.reservations.models.AppliedReservationList """ _validation = { @@ -75,6 +81,10 @@ def __init__( reservation_order_ids: Optional["AppliedReservationList"] = None, **kwargs ): + """ + :keyword reservation_order_ids: + :paramtype reservation_order_ids: ~azure.mgmt.reservations.models.AppliedReservationList + """ super(AppliedReservations, self).__init__(**kwargs) self.id = None self.name = None @@ -85,8 +95,8 @@ def __init__( class AvailableScopeProperties(msrest.serialization.Model): """AvailableScopeProperties. - :param properties: - :type properties: ~azure.mgmt.reservations.models.SubscriptionScopeProperties + :ivar properties: + :vartype properties: ~azure.mgmt.reservations.models.SubscriptionScopeProperties """ _attribute_map = { @@ -99,6 +109,10 @@ def __init__( properties: Optional["SubscriptionScopeProperties"] = None, **kwargs ): + """ + :keyword properties: + :paramtype properties: ~azure.mgmt.reservations.models.SubscriptionScopeProperties + """ super(AvailableScopeProperties, self).__init__(**kwargs) self.properties = properties @@ -106,8 +120,8 @@ def __init__( class AvailableScopeRequest(msrest.serialization.Model): """Available scope. - :param properties: Available scope request properties. - :type properties: ~azure.mgmt.reservations.models.AvailableScopeRequestProperties + :ivar properties: Available scope request properties. + :vartype properties: ~azure.mgmt.reservations.models.AvailableScopeRequestProperties """ _attribute_map = { @@ -120,6 +134,10 @@ def __init__( properties: Optional["AvailableScopeRequestProperties"] = None, **kwargs ): + """ + :keyword properties: Available scope request properties. + :paramtype properties: ~azure.mgmt.reservations.models.AvailableScopeRequestProperties + """ super(AvailableScopeRequest, self).__init__(**kwargs) self.properties = properties @@ -127,8 +145,8 @@ def __init__( class AvailableScopeRequestProperties(msrest.serialization.Model): """Available scope request properties. - :param scopes: - :type scopes: list[str] + :ivar scopes: + :vartype scopes: list[str] """ _attribute_map = { @@ -141,6 +159,10 @@ def __init__( scopes: Optional[List[str]] = None, **kwargs ): + """ + :keyword scopes: + :paramtype scopes: list[str] + """ super(AvailableScopeRequestProperties, self).__init__(**kwargs) self.scopes = scopes @@ -148,12 +170,12 @@ def __init__( class BillingInformation(msrest.serialization.Model): """billing information. - :param billing_currency_total_paid_amount: - :type billing_currency_total_paid_amount: ~azure.mgmt.reservations.models.Price - :param billing_currency_prorated_amount: - :type billing_currency_prorated_amount: ~azure.mgmt.reservations.models.Price - :param billing_currency_remaining_commitment_amount: - :type billing_currency_remaining_commitment_amount: ~azure.mgmt.reservations.models.Price + :ivar billing_currency_total_paid_amount: + :vartype billing_currency_total_paid_amount: ~azure.mgmt.reservations.models.Price + :ivar billing_currency_prorated_amount: + :vartype billing_currency_prorated_amount: ~azure.mgmt.reservations.models.Price + :ivar billing_currency_remaining_commitment_amount: + :vartype billing_currency_remaining_commitment_amount: ~azure.mgmt.reservations.models.Price """ _attribute_map = { @@ -170,6 +192,14 @@ def __init__( billing_currency_remaining_commitment_amount: Optional["Price"] = None, **kwargs ): + """ + :keyword billing_currency_total_paid_amount: + :paramtype billing_currency_total_paid_amount: ~azure.mgmt.reservations.models.Price + :keyword billing_currency_prorated_amount: + :paramtype billing_currency_prorated_amount: ~azure.mgmt.reservations.models.Price + :keyword billing_currency_remaining_commitment_amount: + :paramtype billing_currency_remaining_commitment_amount: ~azure.mgmt.reservations.models.Price + """ super(BillingInformation, self).__init__(**kwargs) self.billing_currency_total_paid_amount = billing_currency_total_paid_amount self.billing_currency_prorated_amount = billing_currency_prorated_amount @@ -179,18 +209,18 @@ def __init__( class CalculateExchangeOperationResultResponse(msrest.serialization.Model): """CalculateExchange operation result. - :param id: It should match what is used to GET the operation result. - :type id: str - :param name: It must match the last segment of the id field, and will typically be a GUID / + :ivar id: It should match what is used to GET the operation result. + :vartype id: str + :ivar name: It must match the last segment of the id field, and will typically be a GUID / system generated value. - :type name: str - :param status: Status of the operation. Possible values include: "Succeeded", "Failed", + :vartype name: str + :ivar status: Status of the operation. Possible values include: "Succeeded", "Failed", "Cancelled", "Pending". - :type status: str or ~azure.mgmt.reservations.models.CalculateExchangeOperationResultStatus - :param properties: CalculateExchange response properties. - :type properties: ~azure.mgmt.reservations.models.CalculateExchangeResponseProperties - :param error: Required if status == failed or status == canceled. - :type error: ~azure.mgmt.reservations.models.OperationResultError + :vartype status: str or ~azure.mgmt.reservations.models.CalculateExchangeOperationResultStatus + :ivar properties: CalculateExchange response properties. + :vartype properties: ~azure.mgmt.reservations.models.CalculateExchangeResponseProperties + :ivar error: Required if status == failed or status == canceled. + :vartype error: ~azure.mgmt.reservations.models.OperationResultError """ _attribute_map = { @@ -211,6 +241,21 @@ def __init__( error: Optional["OperationResultError"] = None, **kwargs ): + """ + :keyword id: It should match what is used to GET the operation result. + :paramtype id: str + :keyword name: It must match the last segment of the id field, and will typically be a GUID / + system generated value. + :paramtype name: str + :keyword status: Status of the operation. Possible values include: "Succeeded", "Failed", + "Cancelled", "Pending". + :paramtype status: str or + ~azure.mgmt.reservations.models.CalculateExchangeOperationResultStatus + :keyword properties: CalculateExchange response properties. + :paramtype properties: ~azure.mgmt.reservations.models.CalculateExchangeResponseProperties + :keyword error: Required if status == failed or status == canceled. + :paramtype error: ~azure.mgmt.reservations.models.OperationResultError + """ super(CalculateExchangeOperationResultResponse, self).__init__(**kwargs) self.id = id self.name = name @@ -222,8 +267,8 @@ def __init__( class CalculateExchangeRequest(msrest.serialization.Model): """Calculate exchange request. - :param properties: Calculate exchange request properties. - :type properties: ~azure.mgmt.reservations.models.CalculateExchangeRequestProperties + :ivar properties: Calculate exchange request properties. + :vartype properties: ~azure.mgmt.reservations.models.CalculateExchangeRequestProperties """ _attribute_map = { @@ -236,6 +281,10 @@ def __init__( properties: Optional["CalculateExchangeRequestProperties"] = None, **kwargs ): + """ + :keyword properties: Calculate exchange request properties. + :paramtype properties: ~azure.mgmt.reservations.models.CalculateExchangeRequestProperties + """ super(CalculateExchangeRequest, self).__init__(**kwargs) self.properties = properties @@ -243,11 +292,10 @@ def __init__( class CalculateExchangeRequestProperties(msrest.serialization.Model): """Calculate exchange request properties. - :param reservations_to_purchase: List of reservations that are being purchased in this - exchange. - :type reservations_to_purchase: list[~azure.mgmt.reservations.models.PurchaseRequest] - :param reservations_to_exchange: List of reservations that are being returned in this exchange. - :type reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToReturn] + :ivar reservations_to_purchase: List of reservations that are being purchased in this exchange. + :vartype reservations_to_purchase: list[~azure.mgmt.reservations.models.PurchaseRequest] + :ivar reservations_to_exchange: List of reservations that are being returned in this exchange. + :vartype reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToReturn] """ _attribute_map = { @@ -262,6 +310,14 @@ def __init__( reservations_to_exchange: Optional[List["ReservationToReturn"]] = None, **kwargs ): + """ + :keyword reservations_to_purchase: List of reservations that are being purchased in this + exchange. + :paramtype reservations_to_purchase: list[~azure.mgmt.reservations.models.PurchaseRequest] + :keyword reservations_to_exchange: List of reservations that are being returned in this + exchange. + :paramtype reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToReturn] + """ super(CalculateExchangeRequestProperties, self).__init__(**kwargs) self.reservations_to_purchase = reservations_to_purchase self.reservations_to_exchange = reservations_to_exchange @@ -270,21 +326,21 @@ def __init__( class CalculateExchangeResponseProperties(msrest.serialization.Model): """CalculateExchange response properties. - :param session_id: Exchange session identifier. - :type session_id: str - :param net_payable: - :type net_payable: ~azure.mgmt.reservations.models.Price - :param refunds_total: - :type refunds_total: ~azure.mgmt.reservations.models.Price - :param purchases_total: - :type purchases_total: ~azure.mgmt.reservations.models.Price - :param reservations_to_purchase: Details of the reservations being purchased. - :type reservations_to_purchase: + :ivar session_id: Exchange session identifier. + :vartype session_id: str + :ivar net_payable: + :vartype net_payable: ~azure.mgmt.reservations.models.Price + :ivar refunds_total: + :vartype refunds_total: ~azure.mgmt.reservations.models.Price + :ivar purchases_total: + :vartype purchases_total: ~azure.mgmt.reservations.models.Price + :ivar reservations_to_purchase: Details of the reservations being purchased. + :vartype reservations_to_purchase: list[~azure.mgmt.reservations.models.ReservationToPurchaseCalculateExchange] - :param reservations_to_exchange: Details of the reservations being returned. - :type reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToExchange] - :param policy_result: Exchange policy errors. - :type policy_result: ~azure.mgmt.reservations.models.ExchangePolicyErrors + :ivar reservations_to_exchange: Details of the reservations being returned. + :vartype reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToExchange] + :ivar policy_result: Exchange policy errors. + :vartype policy_result: ~azure.mgmt.reservations.models.ExchangePolicyErrors """ _attribute_map = { @@ -309,6 +365,24 @@ def __init__( policy_result: Optional["ExchangePolicyErrors"] = None, **kwargs ): + """ + :keyword session_id: Exchange session identifier. + :paramtype session_id: str + :keyword net_payable: + :paramtype net_payable: ~azure.mgmt.reservations.models.Price + :keyword refunds_total: + :paramtype refunds_total: ~azure.mgmt.reservations.models.Price + :keyword purchases_total: + :paramtype purchases_total: ~azure.mgmt.reservations.models.Price + :keyword reservations_to_purchase: Details of the reservations being purchased. + :paramtype reservations_to_purchase: + list[~azure.mgmt.reservations.models.ReservationToPurchaseCalculateExchange] + :keyword reservations_to_exchange: Details of the reservations being returned. + :paramtype reservations_to_exchange: + list[~azure.mgmt.reservations.models.ReservationToExchange] + :keyword policy_result: Exchange policy errors. + :paramtype policy_result: ~azure.mgmt.reservations.models.ExchangePolicyErrors + """ super(CalculateExchangeResponseProperties, self).__init__(**kwargs) self.session_id = session_id self.net_payable = net_payable @@ -322,8 +396,8 @@ def __init__( class CalculatePriceResponse(msrest.serialization.Model): """CalculatePriceResponse. - :param properties: - :type properties: ~azure.mgmt.reservations.models.CalculatePriceResponseProperties + :ivar properties: + :vartype properties: ~azure.mgmt.reservations.models.CalculatePriceResponseProperties """ _attribute_map = { @@ -336,6 +410,10 @@ def __init__( properties: Optional["CalculatePriceResponseProperties"] = None, **kwargs ): + """ + :keyword properties: + :paramtype properties: ~azure.mgmt.reservations.models.CalculatePriceResponseProperties + """ super(CalculatePriceResponse, self).__init__(**kwargs) self.properties = properties @@ -343,30 +421,42 @@ def __init__( class CalculatePriceResponseProperties(msrest.serialization.Model): """CalculatePriceResponseProperties. - :param billing_currency_total: Currency and amount that customer will be charged in customer's + :ivar billing_currency_total: Currency and amount that customer will be charged in customer's local currency. Tax is not included. - :type billing_currency_total: + :vartype billing_currency_total: ~azure.mgmt.reservations.models.CalculatePriceResponsePropertiesBillingCurrencyTotal - :param is_billing_partner_managed: True if billing is managed by Microsoft Partner. Used only + :ivar net_total: Net total amount in pricing currency. + :vartype net_total: float + :ivar tax_total: Tax amount in pricing currency. + :vartype tax_total: float + :ivar grand_total: Total amount in pricing currency. + :vartype grand_total: float + :ivar is_tax_included: Whether or not tax is included in grand total. + :vartype is_tax_included: bool + :ivar is_billing_partner_managed: True if billing is managed by Microsoft Partner. Used only for CSP accounts. - :type is_billing_partner_managed: bool - :param reservation_order_id: GUID that represents reservation order that can be placed after + :vartype is_billing_partner_managed: bool + :ivar reservation_order_id: GUID that represents reservation order that can be placed after calculating price. - :type reservation_order_id: str - :param sku_title: Title of SKU that is being purchased. - :type sku_title: str - :param sku_description: Description of SKU that is being purchased. - :type sku_description: str - :param pricing_currency_total: Amount that Microsoft uses for record. Used during refund for + :vartype reservation_order_id: str + :ivar sku_title: Title of SKU that is being purchased. + :vartype sku_title: str + :ivar sku_description: Description of SKU that is being purchased. + :vartype sku_description: str + :ivar pricing_currency_total: Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. - :type pricing_currency_total: + :vartype pricing_currency_total: ~azure.mgmt.reservations.models.CalculatePriceResponsePropertiesPricingCurrencyTotal - :param payment_schedule: - :type payment_schedule: list[~azure.mgmt.reservations.models.PaymentDetail] + :ivar payment_schedule: + :vartype payment_schedule: list[~azure.mgmt.reservations.models.PaymentDetail] """ _attribute_map = { 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'CalculatePriceResponsePropertiesBillingCurrencyTotal'}, + 'net_total': {'key': 'netTotal', 'type': 'float'}, + 'tax_total': {'key': 'taxTotal', 'type': 'float'}, + 'grand_total': {'key': 'grandTotal', 'type': 'float'}, + 'is_tax_included': {'key': 'isTaxIncluded', 'type': 'bool'}, 'is_billing_partner_managed': {'key': 'isBillingPartnerManaged', 'type': 'bool'}, 'reservation_order_id': {'key': 'reservationOrderId', 'type': 'str'}, 'sku_title': {'key': 'skuTitle', 'type': 'str'}, @@ -379,6 +469,10 @@ def __init__( self, *, billing_currency_total: Optional["CalculatePriceResponsePropertiesBillingCurrencyTotal"] = None, + net_total: Optional[float] = None, + tax_total: Optional[float] = None, + grand_total: Optional[float] = None, + is_tax_included: Optional[bool] = None, is_billing_partner_managed: Optional[bool] = None, reservation_order_id: Optional[str] = None, sku_title: Optional[str] = None, @@ -387,8 +481,42 @@ def __init__( payment_schedule: Optional[List["PaymentDetail"]] = None, **kwargs ): + """ + :keyword billing_currency_total: Currency and amount that customer will be charged in + customer's local currency. Tax is not included. + :paramtype billing_currency_total: + ~azure.mgmt.reservations.models.CalculatePriceResponsePropertiesBillingCurrencyTotal + :keyword net_total: Net total amount in pricing currency. + :paramtype net_total: float + :keyword tax_total: Tax amount in pricing currency. + :paramtype tax_total: float + :keyword grand_total: Total amount in pricing currency. + :paramtype grand_total: float + :keyword is_tax_included: Whether or not tax is included in grand total. + :paramtype is_tax_included: bool + :keyword is_billing_partner_managed: True if billing is managed by Microsoft Partner. Used only + for CSP accounts. + :paramtype is_billing_partner_managed: bool + :keyword reservation_order_id: GUID that represents reservation order that can be placed after + calculating price. + :paramtype reservation_order_id: str + :keyword sku_title: Title of SKU that is being purchased. + :paramtype sku_title: str + :keyword sku_description: Description of SKU that is being purchased. + :paramtype sku_description: str + :keyword pricing_currency_total: Amount that Microsoft uses for record. Used during refund for + calculating refund limit. Tax is not included. + :paramtype pricing_currency_total: + ~azure.mgmt.reservations.models.CalculatePriceResponsePropertiesPricingCurrencyTotal + :keyword payment_schedule: + :paramtype payment_schedule: list[~azure.mgmt.reservations.models.PaymentDetail] + """ super(CalculatePriceResponseProperties, self).__init__(**kwargs) self.billing_currency_total = billing_currency_total + self.net_total = net_total + self.tax_total = tax_total + self.grand_total = grand_total + self.is_tax_included = is_tax_included self.is_billing_partner_managed = is_billing_partner_managed self.reservation_order_id = reservation_order_id self.sku_title = sku_title @@ -400,10 +528,11 @@ def __init__( class CalculatePriceResponsePropertiesBillingCurrencyTotal(msrest.serialization.Model): """Currency and amount that customer will be charged in customer's local currency. Tax is not included. - :param currency_code: - :type currency_code: str - :param amount: - :type amount: float + :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase + record. + :vartype currency_code: str + :ivar amount: Amount in pricing currency. Tax is not included. + :vartype amount: float """ _attribute_map = { @@ -418,6 +547,13 @@ def __init__( amount: Optional[float] = None, **kwargs ): + """ + :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this + purchase record. + :paramtype currency_code: str + :keyword amount: Amount in pricing currency. Tax is not included. + :paramtype amount: float + """ super(CalculatePriceResponsePropertiesBillingCurrencyTotal, self).__init__(**kwargs) self.currency_code = currency_code self.amount = amount @@ -426,10 +562,11 @@ def __init__( class CalculatePriceResponsePropertiesPricingCurrencyTotal(msrest.serialization.Model): """Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. - :param currency_code: - :type currency_code: str - :param amount: - :type amount: float + :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase + record. + :vartype currency_code: str + :ivar amount: + :vartype amount: float """ _attribute_map = { @@ -444,6 +581,13 @@ def __init__( amount: Optional[float] = None, **kwargs ): + """ + :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this + purchase record. + :paramtype currency_code: str + :keyword amount: + :paramtype amount: float + """ super(CalculatePriceResponsePropertiesPricingCurrencyTotal, self).__init__(**kwargs) self.currency_code = currency_code self.amount = amount @@ -458,8 +602,8 @@ class Catalog(msrest.serialization.Model): :vartype resource_type: str :ivar name: The name of SKU. :vartype name: str - :param billing_plans: The billing plan options available for this SKU. - :type billing_plans: dict[str, list[str or + :ivar billing_plans: The billing plan options available for this SKU. + :vartype billing_plans: dict[str, list[str or ~azure.mgmt.reservations.models.ReservationBillingPlan]] :ivar terms: Available reservation terms for this resource. :vartype terms: list[str or ~azure.mgmt.reservations.models.ReservationTerm] @@ -467,8 +611,16 @@ class Catalog(msrest.serialization.Model): :vartype locations: list[str] :ivar sku_properties: :vartype sku_properties: list[~azure.mgmt.reservations.models.SkuProperty] + :ivar msrp: Pricing information about the SKU. + :vartype msrp: ~azure.mgmt.reservations.models.CatalogMsrp :ivar restrictions: :vartype restrictions: list[~azure.mgmt.reservations.models.SkuRestriction] + :ivar tier: The tier of this SKU. + :vartype tier: str + :ivar size: The size of this SKU. + :vartype size: str + :ivar capabilities: + :vartype capabilities: list[~azure.mgmt.reservations.models.SkuCapability] """ _validation = { @@ -477,7 +629,11 @@ class Catalog(msrest.serialization.Model): 'terms': {'readonly': True}, 'locations': {'readonly': True}, 'sku_properties': {'readonly': True}, + 'msrp': {'readonly': True}, 'restrictions': {'readonly': True}, + 'tier': {'readonly': True}, + 'size': {'readonly': True}, + 'capabilities': {'readonly': True}, } _attribute_map = { @@ -487,7 +643,11 @@ class Catalog(msrest.serialization.Model): 'terms': {'key': 'terms', 'type': '[str]'}, 'locations': {'key': 'locations', 'type': '[str]'}, 'sku_properties': {'key': 'skuProperties', 'type': '[SkuProperty]'}, + 'msrp': {'key': 'msrp', 'type': 'CatalogMsrp'}, 'restrictions': {'key': 'restrictions', 'type': '[SkuRestriction]'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, } def __init__( @@ -496,6 +656,11 @@ def __init__( billing_plans: Optional[Dict[str, List[Union[str, "ReservationBillingPlan"]]]] = None, **kwargs ): + """ + :keyword billing_plans: The billing plan options available for this SKU. + :paramtype billing_plans: dict[str, list[str or + ~azure.mgmt.reservations.models.ReservationBillingPlan]] + """ super(Catalog, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -503,14 +668,148 @@ def __init__( self.terms = None self.locations = None self.sku_properties = None + self.msrp = None self.restrictions = None + self.tier = None + self.size = None + self.capabilities = None + + +class CatalogMsrp(msrest.serialization.Model): + """Pricing information about the SKU. + + :ivar p1_y: Amount in pricing currency. Tax not included. + :vartype p1_y: ~azure.mgmt.reservations.models.Price + """ + + _attribute_map = { + 'p1_y': {'key': 'p1Y', 'type': 'Price'}, + } + + def __init__( + self, + *, + p1_y: Optional["Price"] = None, + **kwargs + ): + """ + :keyword p1_y: Amount in pricing currency. Tax not included. + :paramtype p1_y: ~azure.mgmt.reservations.models.Price + """ + super(CatalogMsrp, self).__init__(**kwargs) + self.p1_y = p1_y + + +class ChangeDirectoryRequest(msrest.serialization.Model): + """ChangeDirectoryRequest. + + :ivar destination_tenant_id: Tenant id GUID that reservation order is to be transferred to. + :vartype destination_tenant_id: str + """ + + _attribute_map = { + 'destination_tenant_id': {'key': 'destinationTenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + destination_tenant_id: Optional[str] = None, + **kwargs + ): + """ + :keyword destination_tenant_id: Tenant id GUID that reservation order is to be transferred to. + :paramtype destination_tenant_id: str + """ + super(ChangeDirectoryRequest, self).__init__(**kwargs) + self.destination_tenant_id = destination_tenant_id + + +class ChangeDirectoryResponse(msrest.serialization.Model): + """Change directory response. + + :ivar reservation_order: Change directory result for reservation order or reservation. + :vartype reservation_order: ~azure.mgmt.reservations.models.ChangeDirectoryResult + :ivar reservations: + :vartype reservations: list[~azure.mgmt.reservations.models.ChangeDirectoryResult] + """ + + _attribute_map = { + 'reservation_order': {'key': 'reservationOrder', 'type': 'ChangeDirectoryResult'}, + 'reservations': {'key': 'reservations', 'type': '[ChangeDirectoryResult]'}, + } + + def __init__( + self, + *, + reservation_order: Optional["ChangeDirectoryResult"] = None, + reservations: Optional[List["ChangeDirectoryResult"]] = None, + **kwargs + ): + """ + :keyword reservation_order: Change directory result for reservation order or reservation. + :paramtype reservation_order: ~azure.mgmt.reservations.models.ChangeDirectoryResult + :keyword reservations: + :paramtype reservations: list[~azure.mgmt.reservations.models.ChangeDirectoryResult] + """ + super(ChangeDirectoryResponse, self).__init__(**kwargs) + self.reservation_order = reservation_order + self.reservations = reservations + + +class ChangeDirectoryResult(msrest.serialization.Model): + """Change directory result for reservation order or reservation. + + :ivar id: Identifier of the reservation order or reservation. + :vartype id: str + :ivar name: Name of the reservation order or reservation. + :vartype name: str + :ivar is_succeeded: True if change directory operation succeeded on this reservation order or + reservation. + :vartype is_succeeded: bool + :ivar error: Error reason if operation failed. Null otherwise. + :vartype error: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'is_succeeded': {'key': 'isSucceeded', 'type': 'bool'}, + 'error': {'key': 'error', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + is_succeeded: Optional[bool] = None, + error: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Identifier of the reservation order or reservation. + :paramtype id: str + :keyword name: Name of the reservation order or reservation. + :paramtype name: str + :keyword is_succeeded: True if change directory operation succeeded on this reservation order + or reservation. + :paramtype is_succeeded: bool + :keyword error: Error reason if operation failed. Null otherwise. + :paramtype error: str + """ + super(ChangeDirectoryResult, self).__init__(**kwargs) + self.id = id + self.name = name + self.is_succeeded = is_succeeded + self.error = error class CreateGenericQuotaRequestParameters(msrest.serialization.Model): """Quota change requests information. - :param value: Quota change requests. - :type value: list[~azure.mgmt.reservations.models.CurrentQuotaLimitBase] + :ivar value: Quota change requests. + :vartype value: list[~azure.mgmt.reservations.models.CurrentQuotaLimitBase] """ _attribute_map = { @@ -523,6 +822,10 @@ def __init__( value: Optional[List["CurrentQuotaLimitBase"]] = None, **kwargs ): + """ + :keyword value: Quota change requests. + :paramtype value: list[~azure.mgmt.reservations.models.CurrentQuotaLimitBase] + """ super(CreateGenericQuotaRequestParameters, self).__init__(**kwargs) self.value = value @@ -537,8 +840,8 @@ class CurrentQuotaLimit(msrest.serialization.Model): :vartype provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState :ivar message: A user friendly message. :vartype message: str - :param properties: Quota properties for the resource. - :type properties: ~azure.mgmt.reservations.models.QuotaProperties + :ivar properties: Quota properties for the resource. + :vartype properties: ~azure.mgmt.reservations.models.QuotaProperties """ _validation = { @@ -558,6 +861,10 @@ def __init__( properties: Optional["QuotaProperties"] = None, **kwargs ): + """ + :keyword properties: Quota properties for the resource. + :paramtype properties: ~azure.mgmt.reservations.models.QuotaProperties + """ super(CurrentQuotaLimit, self).__init__(**kwargs) self.provisioning_state = None self.message = None @@ -567,8 +874,8 @@ def __init__( class CurrentQuotaLimitBase(msrest.serialization.Model): """Quota properties. - :param properties: Quota properties for the resource. - :type properties: ~azure.mgmt.reservations.models.QuotaProperties + :ivar properties: Quota properties for the resource. + :vartype properties: ~azure.mgmt.reservations.models.QuotaProperties """ _attribute_map = { @@ -581,6 +888,10 @@ def __init__( properties: Optional["QuotaProperties"] = None, **kwargs ): + """ + :keyword properties: Quota properties for the resource. + :paramtype properties: ~azure.mgmt.reservations.models.QuotaProperties + """ super(CurrentQuotaLimitBase, self).__init__(**kwargs) self.properties = properties @@ -588,8 +899,8 @@ def __init__( class Error(msrest.serialization.Model): """Error. - :param error: - :type error: ~azure.mgmt.reservations.models.ExtendedErrorInfo + :ivar error: + :vartype error: ~azure.mgmt.reservations.models.ExtendedErrorInfo """ _attribute_map = { @@ -602,15 +913,81 @@ def __init__( error: Optional["ExtendedErrorInfo"] = None, **kwargs ): + """ + :keyword error: + :paramtype error: ~azure.mgmt.reservations.models.ExtendedErrorInfo + """ super(Error, self).__init__(**kwargs) self.error = error +class ErrorDetails(msrest.serialization.Model): + """The details of the error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + + :ivar error: The details of the error. + :vartype error: ~azure.mgmt.reservations.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetails"] = None, + **kwargs + ): + """ + :keyword error: The details of the error. + :paramtype error: ~azure.mgmt.reservations.models.ErrorDetails + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + class ExceptionResponse(msrest.serialization.Model): """The API error. - :param error: The API error details. - :type error: ~azure.mgmt.reservations.models.ServiceError + :ivar error: The API error details. + :vartype error: ~azure.mgmt.reservations.models.ServiceError """ _attribute_map = { @@ -623,6 +1000,10 @@ def __init__( error: Optional["ServiceError"] = None, **kwargs ): + """ + :keyword error: The API error details. + :paramtype error: ~azure.mgmt.reservations.models.ServiceError + """ super(ExceptionResponse, self).__init__(**kwargs) self.error = error @@ -630,18 +1011,18 @@ def __init__( class ExchangeOperationResultResponse(msrest.serialization.Model): """Exchange operation result. - :param id: It should match what is used to GET the operation result. - :type id: str - :param name: It must match the last segment of the id field, and will typically be a GUID / + :ivar id: It should match what is used to GET the operation result. + :vartype id: str + :ivar name: It must match the last segment of the id field, and will typically be a GUID / system generated value. - :type name: str - :param status: Status of the operation. Possible values include: "Succeeded", "Failed", + :vartype name: str + :ivar status: Status of the operation. Possible values include: "Succeeded", "Failed", "Cancelled", "PendingRefunds", "PendingPurchases". - :type status: str or ~azure.mgmt.reservations.models.ExchangeOperationResultStatus - :param properties: Exchange response properties. - :type properties: ~azure.mgmt.reservations.models.ExchangeResponseProperties - :param error: Required if status == failed or status == canceled. - :type error: ~azure.mgmt.reservations.models.OperationResultError + :vartype status: str or ~azure.mgmt.reservations.models.ExchangeOperationResultStatus + :ivar properties: Exchange response properties. + :vartype properties: ~azure.mgmt.reservations.models.ExchangeResponseProperties + :ivar error: Required if status == failed or status == canceled. + :vartype error: ~azure.mgmt.reservations.models.OperationResultError """ _attribute_map = { @@ -662,6 +1043,20 @@ def __init__( error: Optional["OperationResultError"] = None, **kwargs ): + """ + :keyword id: It should match what is used to GET the operation result. + :paramtype id: str + :keyword name: It must match the last segment of the id field, and will typically be a GUID / + system generated value. + :paramtype name: str + :keyword status: Status of the operation. Possible values include: "Succeeded", "Failed", + "Cancelled", "PendingRefunds", "PendingPurchases". + :paramtype status: str or ~azure.mgmt.reservations.models.ExchangeOperationResultStatus + :keyword properties: Exchange response properties. + :paramtype properties: ~azure.mgmt.reservations.models.ExchangeResponseProperties + :keyword error: Required if status == failed or status == canceled. + :paramtype error: ~azure.mgmt.reservations.models.OperationResultError + """ super(ExchangeOperationResultResponse, self).__init__(**kwargs) self.id = id self.name = name @@ -673,10 +1068,10 @@ def __init__( class ExchangePolicyError(msrest.serialization.Model): """error details. - :param code: - :type code: str - :param message: - :type message: str + :ivar code: + :vartype code: str + :ivar message: + :vartype message: str """ _attribute_map = { @@ -691,6 +1086,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: + :paramtype code: str + :keyword message: + :paramtype message: str + """ super(ExchangePolicyError, self).__init__(**kwargs) self.code = code self.message = message @@ -699,8 +1100,8 @@ def __init__( class ExchangePolicyErrors(msrest.serialization.Model): """Exchange policy errors. - :param policy_errors: Exchange Policy errors. - :type policy_errors: list[~azure.mgmt.reservations.models.ExchangePolicyError] + :ivar policy_errors: Exchange Policy errors. + :vartype policy_errors: list[~azure.mgmt.reservations.models.ExchangePolicyError] """ _attribute_map = { @@ -713,6 +1114,10 @@ def __init__( policy_errors: Optional[List["ExchangePolicyError"]] = None, **kwargs ): + """ + :keyword policy_errors: Exchange Policy errors. + :paramtype policy_errors: list[~azure.mgmt.reservations.models.ExchangePolicyError] + """ super(ExchangePolicyErrors, self).__init__(**kwargs) self.policy_errors = policy_errors @@ -720,8 +1125,8 @@ def __init__( class ExchangeRequest(msrest.serialization.Model): """Exchange request. - :param properties: Exchange request properties. - :type properties: ~azure.mgmt.reservations.models.ExchangeRequestProperties + :ivar properties: Exchange request properties. + :vartype properties: ~azure.mgmt.reservations.models.ExchangeRequestProperties """ _attribute_map = { @@ -734,6 +1139,10 @@ def __init__( properties: Optional["ExchangeRequestProperties"] = None, **kwargs ): + """ + :keyword properties: Exchange request properties. + :paramtype properties: ~azure.mgmt.reservations.models.ExchangeRequestProperties + """ super(ExchangeRequest, self).__init__(**kwargs) self.properties = properties @@ -741,8 +1150,8 @@ def __init__( class ExchangeRequestProperties(msrest.serialization.Model): """Exchange request properties. - :param session_id: SessionId that was returned by CalculateExchange API. - :type session_id: str + :ivar session_id: SessionId that was returned by CalculateExchange API. + :vartype session_id: str """ _attribute_map = { @@ -755,6 +1164,10 @@ def __init__( session_id: Optional[str] = None, **kwargs ): + """ + :keyword session_id: SessionId that was returned by CalculateExchange API. + :paramtype session_id: str + """ super(ExchangeRequestProperties, self).__init__(**kwargs) self.session_id = session_id @@ -762,22 +1175,22 @@ def __init__( class ExchangeResponseProperties(msrest.serialization.Model): """Exchange response properties. - :param session_id: Exchange session identifier. - :type session_id: str - :param net_payable: - :type net_payable: ~azure.mgmt.reservations.models.Price - :param refunds_total: - :type refunds_total: ~azure.mgmt.reservations.models.Price - :param purchases_total: - :type purchases_total: ~azure.mgmt.reservations.models.Price - :param reservations_to_purchase: Details of the reservations being purchased. - :type reservations_to_purchase: + :ivar session_id: Exchange session identifier. + :vartype session_id: str + :ivar net_payable: + :vartype net_payable: ~azure.mgmt.reservations.models.Price + :ivar refunds_total: + :vartype refunds_total: ~azure.mgmt.reservations.models.Price + :ivar purchases_total: + :vartype purchases_total: ~azure.mgmt.reservations.models.Price + :ivar reservations_to_purchase: Details of the reservations being purchased. + :vartype reservations_to_purchase: list[~azure.mgmt.reservations.models.ReservationToPurchaseExchange] - :param reservations_to_exchange: Details of the reservations being returned. - :type reservations_to_exchange: + :ivar reservations_to_exchange: Details of the reservations being returned. + :vartype reservations_to_exchange: list[~azure.mgmt.reservations.models.ReservationToReturnForExchange] - :param policy_result: Exchange policy errors. - :type policy_result: ~azure.mgmt.reservations.models.ExchangePolicyErrors + :ivar policy_result: Exchange policy errors. + :vartype policy_result: ~azure.mgmt.reservations.models.ExchangePolicyErrors """ _attribute_map = { @@ -802,6 +1215,24 @@ def __init__( policy_result: Optional["ExchangePolicyErrors"] = None, **kwargs ): + """ + :keyword session_id: Exchange session identifier. + :paramtype session_id: str + :keyword net_payable: + :paramtype net_payable: ~azure.mgmt.reservations.models.Price + :keyword refunds_total: + :paramtype refunds_total: ~azure.mgmt.reservations.models.Price + :keyword purchases_total: + :paramtype purchases_total: ~azure.mgmt.reservations.models.Price + :keyword reservations_to_purchase: Details of the reservations being purchased. + :paramtype reservations_to_purchase: + list[~azure.mgmt.reservations.models.ReservationToPurchaseExchange] + :keyword reservations_to_exchange: Details of the reservations being returned. + :paramtype reservations_to_exchange: + list[~azure.mgmt.reservations.models.ReservationToReturnForExchange] + :keyword policy_result: Exchange policy errors. + :paramtype policy_result: ~azure.mgmt.reservations.models.ExchangePolicyErrors + """ super(ExchangeResponseProperties, self).__init__(**kwargs) self.session_id = session_id self.net_payable = net_payable @@ -815,7 +1246,7 @@ def __init__( class ExtendedErrorInfo(msrest.serialization.Model): """ExtendedErrorInfo. - :param code: Possible values include: "NotSpecified", "InternalServerError", "ServerTimeout", + :ivar code: Possible values include: "NotSpecified", "InternalServerError", "ServerTimeout", "AuthorizationFailed", "BadRequest", "ClientCertificateThumbprintNotSet", "InvalidRequestContent", "OperationFailed", "HttpMethodNotSupported", "InvalidRequestUri", "MissingTenantId", "InvalidTenantId", "InvalidReservationOrderId", "InvalidReservationId", @@ -833,10 +1264,10 @@ class ExtendedErrorInfo(msrest.serialization.Model): "BillingPaymentInstrumentSoftError", "BillingPaymentInstrumentHardError", "BillingTransientError", "BillingError", "FulfillmentConfigurationError", "FulfillmentOutOfStockError", "FulfillmentTransientError", "FulfillmentError", - "CalculatePriceFailed". - :type code: str or ~azure.mgmt.reservations.models.ErrorResponseCode - :param message: - :type message: str + "CalculatePriceFailed", "AppliedScopesSameAsExisting". + :vartype code: str or ~azure.mgmt.reservations.models.ErrorResponseCode + :ivar message: + :vartype message: str """ _attribute_map = { @@ -851,6 +1282,30 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Possible values include: "NotSpecified", "InternalServerError", "ServerTimeout", + "AuthorizationFailed", "BadRequest", "ClientCertificateThumbprintNotSet", + "InvalidRequestContent", "OperationFailed", "HttpMethodNotSupported", "InvalidRequestUri", + "MissingTenantId", "InvalidTenantId", "InvalidReservationOrderId", "InvalidReservationId", + "ReservationIdNotInReservationOrder", "ReservationOrderNotFound", "InvalidSubscriptionId", + "InvalidAccessToken", "InvalidLocationId", "UnauthenticatedRequestsThrottled", + "InvalidHealthCheckType", "Forbidden", "BillingScopeIdCannotBeChanged", + "AppliedScopesNotAssociatedWithCommerceAccount", "PatchValuesSameAsExisting", + "RoleAssignmentCreationFailed", "ReservationOrderCreationFailed", "ReservationOrderNotEnabled", + "CapacityUpdateScopesFailed", "UnsupportedReservationTerm", "ReservationOrderIdAlreadyExists", + "RiskCheckFailed", "CreateQuoteFailed", "ActivateQuoteFailed", "NonsupportedAccountId", + "PaymentInstrumentNotFound", "MissingAppliedScopesForSingle", "NoValidReservationsToReRate", + "ReRateOnlyAllowedForEA", "OperationCannotBePerformedInCurrentState", + "InvalidSingleAppliedScopesCount", "InvalidFulfillmentRequestParameters", + "NotSupportedCountry", "InvalidRefundQuantity", "PurchaseError", "BillingCustomerInputError", + "BillingPaymentInstrumentSoftError", "BillingPaymentInstrumentHardError", + "BillingTransientError", "BillingError", "FulfillmentConfigurationError", + "FulfillmentOutOfStockError", "FulfillmentTransientError", "FulfillmentError", + "CalculatePriceFailed", "AppliedScopesSameAsExisting". + :paramtype code: str or ~azure.mgmt.reservations.models.ErrorResponseCode + :keyword message: + :paramtype message: str + """ super(ExtendedErrorInfo, self).__init__(**kwargs) self.code = code self.message = message @@ -859,11 +1314,11 @@ def __init__( class ExtendedStatusInfo(msrest.serialization.Model): """ExtendedStatusInfo. - :param status_code: Possible values include: "None", "Pending", "Active", "PurchaseError", + :ivar status_code: Possible values include: "None", "Pending", "Active", "PurchaseError", "PaymentInstrumentError", "Split", "Merged", "Expired", "Succeeded". - :type status_code: str or ~azure.mgmt.reservations.models.ReservationStatusCode - :param message: The message giving detailed information about the status code. - :type message: str + :vartype status_code: str or ~azure.mgmt.reservations.models.ReservationStatusCode + :ivar message: The message giving detailed information about the status code. + :vartype message: str """ _attribute_map = { @@ -878,6 +1333,13 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword status_code: Possible values include: "None", "Pending", "Active", "PurchaseError", + "PaymentInstrumentError", "Split", "Merged", "Expired", "Succeeded". + :paramtype status_code: str or ~azure.mgmt.reservations.models.ReservationStatusCode + :keyword message: The message giving detailed information about the status code. + :paramtype message: str + """ super(ExtendedStatusInfo, self).__init__(**kwargs) self.status_code = status_code self.message = message @@ -886,9 +1348,9 @@ def __init__( class MergeRequest(msrest.serialization.Model): """MergeRequest. - :param sources: Format of the resource id should be + :ivar sources: Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type sources: list[str] + :vartype sources: list[str] """ _attribute_map = { @@ -901,6 +1363,11 @@ def __init__( sources: Optional[List[str]] = None, **kwargs ): + """ + :keyword sources: Format of the resource id should be + /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :paramtype sources: list[str] + """ super(MergeRequest, self).__init__(**kwargs) self.sources = sources @@ -908,14 +1375,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """OperationDisplay. - :param provider: - :type provider: str - :param resource: - :type resource: str - :param operation: - :type operation: str - :param description: - :type description: str + :ivar provider: + :vartype provider: str + :ivar resource: + :vartype resource: str + :ivar operation: + :vartype operation: str + :ivar description: + :vartype description: str """ _attribute_map = { @@ -934,6 +1401,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: + :paramtype provider: str + :keyword resource: + :paramtype resource: str + :keyword operation: + :paramtype operation: str + :keyword description: + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -944,10 +1421,10 @@ def __init__( class OperationList(msrest.serialization.Model): """OperationList. - :param value: - :type value: list[~azure.mgmt.reservations.models.OperationResponse] - :param next_link: Url to get the next page of items. - :type next_link: str + :ivar value: + :vartype value: list[~azure.mgmt.reservations.models.OperationResponse] + :ivar next_link: Url to get the next page of items. + :vartype next_link: str """ _attribute_map = { @@ -962,6 +1439,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.reservations.models.OperationResponse] + :keyword next_link: Url to get the next page of items. + :paramtype next_link: str + """ super(OperationList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -970,44 +1453,66 @@ def __init__( class OperationResponse(msrest.serialization.Model): """OperationResponse. - :param name: - :type name: str - :param display: - :type display: ~azure.mgmt.reservations.models.OperationDisplay - :param origin: - :type origin: str + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.reservations.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: any """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, } def __init__( self, *, name: Optional[str] = None, + is_data_action: Optional[bool] = None, display: Optional["OperationDisplay"] = None, origin: Optional[str] = None, + properties: Optional[Any] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.reservations.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: any + """ super(OperationResponse, self).__init__(**kwargs) self.name = name + self.is_data_action = is_data_action self.display = display self.origin = origin + self.properties = properties class OperationResultError(msrest.serialization.Model): """Required if status == failed or status == canceled. - :param code: Required if status == failed or status == cancelled. If status == failed, provide + :ivar code: Required if status == failed or status == cancelled. If status == failed, provide an invariant error code used for error troubleshooting, aggregation, and analysis. - :type code: str - :param message: Required if status == failed. Localized. If status == failed, provide an + :vartype code: str + :ivar message: Required if status == failed. Localized. If status == failed, provide an actionable error message indicating what error occurred, and what the user can do to address the issue. - :type message: str + :vartype message: str """ _attribute_map = { @@ -1022,6 +1527,15 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Required if status == failed or status == cancelled. If status == failed, + provide an invariant error code used for error troubleshooting, aggregation, and analysis. + :paramtype code: str + :keyword message: Required if status == failed. Localized. If status == failed, provide an + actionable error message indicating what error occurred, and what the user can do to address + the issue. + :paramtype message: str + """ super(OperationResultError, self).__init__(**kwargs) self.code = code self.message = message @@ -1030,23 +1544,23 @@ def __init__( class Patch(msrest.serialization.Model): """Patch. - :param applied_scope_type: Type of the Applied Scope. Possible values include: "Single", + :ivar applied_scope_type: Type of the Applied Scope. Possible values include: "Single", "Shared". - :type applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType - :param applied_scopes: List of the subscriptions that the benefit will be applied. Do not + :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. - :type applied_scopes: list[str] - :param instance_flexibility: Turning this on will apply the reservation discount to other VMs - in the same VM size group. Only specify for VirtualMachines reserved resource type. Possible + :vartype applied_scopes: list[str] + :ivar instance_flexibility: Turning this on will apply the reservation discount to other VMs in + the same VM size group. Only specify for VirtualMachines reserved resource type. Possible values include: "On", "Off". - :type instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility - :param name: Name of the Reservation. - :type name: str - :param renew: Setting this to true will automatically purchase a new reservation on the + :vartype instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility + :ivar name: Name of the Reservation. + :vartype name: str + :ivar renew: Setting this to true will automatically purchase a new reservation on the expiration date time. - :type renew: bool - :param renew_properties: - :type renew_properties: ~azure.mgmt.reservations.models.PatchPropertiesRenewProperties + :vartype renew: bool + :ivar renew_properties: + :vartype renew_properties: ~azure.mgmt.reservations.models.PatchPropertiesRenewProperties """ _attribute_map = { @@ -1069,6 +1583,25 @@ def __init__( renew_properties: Optional["PatchPropertiesRenewProperties"] = None, **kwargs ): + """ + :keyword applied_scope_type: Type of the Applied Scope. Possible values include: "Single", + "Shared". + :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. + :paramtype applied_scopes: list[str] + :keyword instance_flexibility: Turning this on will apply the reservation discount to other VMs + in the same VM size group. Only specify for VirtualMachines reserved resource type. Possible + values include: "On", "Off". + :paramtype instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility + :keyword name: Name of the Reservation. + :paramtype name: str + :keyword renew: Setting this to true will automatically purchase a new reservation on the + expiration date time. + :paramtype renew: bool + :keyword renew_properties: + :paramtype renew_properties: ~azure.mgmt.reservations.models.PatchPropertiesRenewProperties + """ super(Patch, self).__init__(**kwargs) self.applied_scope_type = applied_scope_type self.applied_scopes = applied_scopes @@ -1081,8 +1614,8 @@ def __init__( class PatchPropertiesRenewProperties(msrest.serialization.Model): """PatchPropertiesRenewProperties. - :param purchase_properties: - :type purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest + :ivar purchase_properties: + :vartype purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest """ _attribute_map = { @@ -1095,6 +1628,10 @@ def __init__( purchase_properties: Optional["PurchaseRequest"] = None, **kwargs ): + """ + :keyword purchase_properties: + :paramtype purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest + """ super(PatchPropertiesRenewProperties, self).__init__(**kwargs) self.purchase_properties = purchase_properties @@ -1102,22 +1639,22 @@ def __init__( class PaymentDetail(msrest.serialization.Model): """Information about payment related to a reservation order. - :param due_date: Date when the payment needs to be done. - :type due_date: ~datetime.date - :param payment_date: Date when the transaction is completed. Is null when it is scheduled. - :type payment_date: ~datetime.date - :param pricing_currency_total: Amount in pricing currency. Tax not included. - :type pricing_currency_total: ~azure.mgmt.reservations.models.Price - :param billing_currency_total: Amount charged in Billing currency. Tax not included. Is null - for future payments. - :type billing_currency_total: ~azure.mgmt.reservations.models.Price - :param billing_account: Shows the Account that is charged for this payment. - :type billing_account: str - :param status: Describes whether the payment is completed, failed, cancelled or scheduled in - the future. Possible values include: "Succeeded", "Failed", "Scheduled", "Cancelled". - :type status: str or ~azure.mgmt.reservations.models.PaymentStatus - :param extended_status_info: - :type extended_status_info: ~azure.mgmt.reservations.models.ExtendedStatusInfo + :ivar due_date: Date when the payment needs to be done. + :vartype due_date: ~datetime.date + :ivar payment_date: Date when the transaction is completed. Is null when it is scheduled. + :vartype payment_date: ~datetime.date + :ivar pricing_currency_total: Amount in pricing currency. Tax not included. + :vartype pricing_currency_total: ~azure.mgmt.reservations.models.Price + :ivar billing_currency_total: Amount charged in Billing currency. Tax not included. Is null for + future payments. + :vartype billing_currency_total: ~azure.mgmt.reservations.models.Price + :ivar billing_account: Shows the Account that is charged for this payment. + :vartype billing_account: str + :ivar status: Describes whether the payment is completed, failed, cancelled or scheduled in the + future. Possible values include: "Succeeded", "Failed", "Scheduled", "Cancelled". + :vartype status: str or ~azure.mgmt.reservations.models.PaymentStatus + :ivar extended_status_info: + :vartype extended_status_info: ~azure.mgmt.reservations.models.ExtendedStatusInfo """ _attribute_map = { @@ -1142,6 +1679,24 @@ def __init__( extended_status_info: Optional["ExtendedStatusInfo"] = None, **kwargs ): + """ + :keyword due_date: Date when the payment needs to be done. + :paramtype due_date: ~datetime.date + :keyword payment_date: Date when the transaction is completed. Is null when it is scheduled. + :paramtype payment_date: ~datetime.date + :keyword pricing_currency_total: Amount in pricing currency. Tax not included. + :paramtype pricing_currency_total: ~azure.mgmt.reservations.models.Price + :keyword billing_currency_total: Amount charged in Billing currency. Tax not included. Is null + for future payments. + :paramtype billing_currency_total: ~azure.mgmt.reservations.models.Price + :keyword billing_account: Shows the Account that is charged for this payment. + :paramtype billing_account: str + :keyword status: Describes whether the payment is completed, failed, cancelled or scheduled in + the future. Possible values include: "Succeeded", "Failed", "Scheduled", "Cancelled". + :paramtype status: str or ~azure.mgmt.reservations.models.PaymentStatus + :keyword extended_status_info: + :paramtype extended_status_info: ~azure.mgmt.reservations.models.ExtendedStatusInfo + """ super(PaymentDetail, self).__init__(**kwargs) self.due_date = due_date self.payment_date = payment_date @@ -1155,11 +1710,11 @@ def __init__( class Price(msrest.serialization.Model): """Price. - :param currency_code: The ISO 4217 3-letter currency code for the currency used by this - purchase record. - :type currency_code: str - :param amount: - :type amount: float + :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase + record. + :vartype currency_code: str + :ivar amount: + :vartype amount: float """ _attribute_map = { @@ -1174,6 +1729,13 @@ def __init__( amount: Optional[float] = None, **kwargs ): + """ + :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this + purchase record. + :paramtype currency_code: str + :keyword amount: + :paramtype amount: float + """ super(Price, self).__init__(**kwargs) self.currency_code = currency_code self.amount = amount @@ -1182,40 +1744,39 @@ def __init__( class PurchaseRequest(msrest.serialization.Model): """PurchaseRequest. - :param sku: - :type sku: ~azure.mgmt.reservations.models.SkuName - :param location: The Azure Region where the reserved resource lives. - :type location: str - :param reserved_resource_type: The type of the resource that is being reserved. Possible values + :ivar sku: + :vartype sku: ~azure.mgmt.reservations.models.SkuName + :ivar location: The Azure Region where the reserved resource lives. + :vartype location: str + :ivar reserved_resource_type: The type of the resource that is being reserved. Possible values include: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", "SqlDataWarehouse", "VMwareCloudSimple", "RedHatOsa", "Databricks", "AppService", "ManagedDisk", "BlockBlob", "RedisCache", "AzureDataExplorer", "MySql", "MariaDb", - "PostgreSql", "DedicatedHost", "SapHana", "SqlAzureHybridBenefit". - :type reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType - :param billing_scope_id: Subscription that will be charged for purchasing Reservation. - :type billing_scope_id: str - :param term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y". - :type term: str or ~azure.mgmt.reservations.models.ReservationTerm - :param billing_plan: Represent the billing plans. Possible values include: "Upfront", - "Monthly". - :type billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan - :param quantity: Quantity of the SKUs that are part of the Reservation. Must be greater than - zero. - :type quantity: int - :param display_name: Friendly name of the Reservation. - :type display_name: str - :param applied_scope_type: Type of the Applied Scope. Possible values include: "Single", + "PostgreSql", "DedicatedHost", "SapHana", "SqlAzureHybridBenefit", "AVS", "DataFactory", + "NetAppStorage", "AzureFiles", "SqlEdge". + :vartype reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType + :ivar billing_scope_id: Subscription that will be charged for purchasing Reservation. + :vartype billing_scope_id: str + :ivar term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y", "P5Y". + :vartype term: str or ~azure.mgmt.reservations.models.ReservationTerm + :ivar billing_plan: Represent the billing plans. Possible values include: "Upfront", "Monthly". + :vartype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan + :ivar quantity: Quantity of the SKUs that are part of the Reservation. + :vartype quantity: int + :ivar display_name: Friendly name of the Reservation. + :vartype display_name: str + :ivar applied_scope_type: Type of the Applied Scope. Possible values include: "Single", "Shared". - :type applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType - :param applied_scopes: List of the subscriptions that the benefit will be applied. Do not + :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. - :type applied_scopes: list[str] - :param renew: Setting this to true will automatically purchase a new reservation on the + :vartype applied_scopes: list[str] + :ivar renew: Setting this to true will automatically purchase a new reservation on the expiration date time. - :type renew: bool - :param reserved_resource_properties: Properties specific to each reserved resource type. Not + :vartype renew: bool + :ivar reserved_resource_properties: Properties specific to each reserved resource type. Not required if not applicable. - :type reserved_resource_properties: + :vartype reserved_resource_properties: ~azure.mgmt.reservations.models.PurchaseRequestPropertiesReservedResourceProperties """ @@ -1251,6 +1812,43 @@ def __init__( reserved_resource_properties: Optional["PurchaseRequestPropertiesReservedResourceProperties"] = None, **kwargs ): + """ + :keyword sku: + :paramtype sku: ~azure.mgmt.reservations.models.SkuName + :keyword location: The Azure Region where the reserved resource lives. + :paramtype location: str + :keyword reserved_resource_type: The type of the resource that is being reserved. Possible + values include: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", + "SqlDataWarehouse", "VMwareCloudSimple", "RedHatOsa", "Databricks", "AppService", + "ManagedDisk", "BlockBlob", "RedisCache", "AzureDataExplorer", "MySql", "MariaDb", + "PostgreSql", "DedicatedHost", "SapHana", "SqlAzureHybridBenefit", "AVS", "DataFactory", + "NetAppStorage", "AzureFiles", "SqlEdge". + :paramtype reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType + :keyword billing_scope_id: Subscription that will be charged for purchasing Reservation. + :paramtype billing_scope_id: str + :keyword term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y", "P5Y". + :paramtype term: str or ~azure.mgmt.reservations.models.ReservationTerm + :keyword billing_plan: Represent the billing plans. Possible values include: "Upfront", + "Monthly". + :paramtype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan + :keyword quantity: Quantity of the SKUs that are part of the Reservation. + :paramtype quantity: int + :keyword display_name: Friendly name of the Reservation. + :paramtype display_name: str + :keyword applied_scope_type: Type of the Applied Scope. Possible values include: "Single", + "Shared". + :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. + :paramtype applied_scopes: list[str] + :keyword renew: Setting this to true will automatically purchase a new reservation on the + expiration date time. + :paramtype renew: bool + :keyword reserved_resource_properties: Properties specific to each reserved resource type. Not + required if not applicable. + :paramtype reserved_resource_properties: + ~azure.mgmt.reservations.models.PurchaseRequestPropertiesReservedResourceProperties + """ super(PurchaseRequest, self).__init__(**kwargs) self.sku = sku self.location = location @@ -1269,10 +1867,10 @@ def __init__( class PurchaseRequestPropertiesReservedResourceProperties(msrest.serialization.Model): """Properties specific to each reserved resource type. Not required if not applicable. - :param instance_flexibility: Turning this on will apply the reservation discount to other VMs - in the same VM size group. Only specify for VirtualMachines reserved resource type. Possible + :ivar instance_flexibility: Turning this on will apply the reservation discount to other VMs in + the same VM size group. Only specify for VirtualMachines reserved resource type. Possible values include: "On", "Off". - :type instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility + :vartype instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility """ _attribute_map = { @@ -1285,6 +1883,12 @@ def __init__( instance_flexibility: Optional[Union[str, "InstanceFlexibility"]] = None, **kwargs ): + """ + :keyword instance_flexibility: Turning this on will apply the reservation discount to other VMs + in the same VM size group. Only specify for VirtualMachines reserved resource type. Possible + values include: "On", "Off". + :paramtype instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility + """ super(PurchaseRequestPropertiesReservedResourceProperties, self).__init__(**kwargs) self.instance_flexibility = instance_flexibility @@ -1292,11 +1896,11 @@ def __init__( class QuotaLimits(msrest.serialization.Model): """Quota limits. - :param value: List of quotas (service limits). - :type value: list[~azure.mgmt.reservations.models.CurrentQuotaLimitBase] - :param next_link: The URI for fetching the next page of quotas (service limits). When no more + :ivar value: List of quotas (service limits). + :vartype value: list[~azure.mgmt.reservations.models.CurrentQuotaLimitBase] + :ivar next_link: The URI for fetching the next page of quotas (service limits). When no more pages exist, the value is null. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1311,6 +1915,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of quotas (service limits). + :paramtype value: list[~azure.mgmt.reservations.models.CurrentQuotaLimitBase] + :keyword next_link: The URI for fetching the next page of quotas (service limits). When no more + pages exist, the value is null. + :paramtype next_link: str + """ super(QuotaLimits, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1319,11 +1930,11 @@ def __init__( class QuotaLimitsResponse(msrest.serialization.Model): """Quotas (service limits) in the request response. - :param value: List of quotas with the quota request status. - :type value: list[~azure.mgmt.reservations.models.CurrentQuotaLimit] - :param next_link: The URI for fetching the next page of quota limits. When no more pages exist, + :ivar value: List of quotas with the quota request status. + :vartype value: list[~azure.mgmt.reservations.models.CurrentQuotaLimit] + :ivar next_link: The URI for fetching the next page of quota limits. When no more pages exist, the value is null. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1338,6 +1949,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of quotas with the quota request status. + :paramtype value: list[~azure.mgmt.reservations.models.CurrentQuotaLimit] + :keyword next_link: The URI for fetching the next page of quota limits. When no more pages + exist, the value is null. + :paramtype next_link: str + """ super(QuotaLimitsResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1348,25 +1966,25 @@ class QuotaProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param limit: Quota properties. - :type limit: int + :ivar limit: Quota properties. + :vartype limit: int :ivar current_value: Current usage value for the resource. :vartype current_value: int - :param unit: The limit units, such as **count** and **bytes**. Use the unit field provided in + :ivar unit: The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota operation. - :type unit: str - :param name: Name of the resource provide by the resource provider. Use this property for + :vartype unit: str + :ivar name: Name of the resource provide by the resource provider. Use this property for quotaRequests resource operations. - :type name: ~azure.mgmt.reservations.models.ResourceName - :param resource_type: The name of the resource type. Possible values include: "standard", + :vartype name: ~azure.mgmt.reservations.models.ResourceName + :ivar resource_type: The name of the resource type. Possible values include: "standard", "dedicated", "lowPriority", "shared", "serviceSpecific". - :type resource_type: str or ~azure.mgmt.reservations.models.ResourceType + :vartype resource_type: str or ~azure.mgmt.reservations.models.ResourceType :ivar quota_period: The time period over which the quota usage values are summarized. For example, P1D (per one day), PT1M (per one minute), and PT1S (per one second). This parameter is optional because, for some resources such as compute, the time period is irrelevant. :vartype quota_period: str - :param properties: Additional properties for the specified resource provider. - :type properties: any + :ivar properties: Additional properties for the specified resource provider. + :vartype properties: any """ _validation = { @@ -1394,6 +2012,21 @@ def __init__( properties: Optional[Any] = None, **kwargs ): + """ + :keyword limit: Quota properties. + :paramtype limit: int + :keyword unit: The limit units, such as **count** and **bytes**. Use the unit field provided in + the response of the GET quota operation. + :paramtype unit: str + :keyword name: Name of the resource provide by the resource provider. Use this property for + quotaRequests resource operations. + :paramtype name: ~azure.mgmt.reservations.models.ResourceName + :keyword resource_type: The name of the resource type. Possible values include: "standard", + "dedicated", "lowPriority", "shared", "serviceSpecific". + :paramtype resource_type: str or ~azure.mgmt.reservations.models.ResourceType + :keyword properties: Additional properties for the specified resource provider. + :paramtype properties: any + """ super(QuotaProperties, self).__init__(**kwargs) self.limit = limit self.current_value = None @@ -1415,16 +2048,16 @@ class QuotaRequestDetails(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param provisioning_state: The quota request status. Possible values include: "Accepted", + :ivar provisioning_state: The quota request status. Possible values include: "Accepted", "Invalid", "Succeeded", "Failed", "InProgress". - :type provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState + :vartype provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState :ivar message: User friendly status message. :vartype message: str :ivar request_submit_time: The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. :vartype request_submit_time: ~datetime.datetime - :param value: The quotaRequests. - :type value: list[~azure.mgmt.reservations.models.SubRequest] + :ivar value: The quotaRequests. + :vartype value: list[~azure.mgmt.reservations.models.SubRequest] """ _validation = { @@ -1452,6 +2085,13 @@ def __init__( value: Optional[List["SubRequest"]] = None, **kwargs ): + """ + :keyword provisioning_state: The quota request status. Possible values include: "Accepted", + "Invalid", "Succeeded", "Failed", "InProgress". + :paramtype provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState + :keyword value: The quotaRequests. + :paramtype value: list[~azure.mgmt.reservations.models.SubRequest] + """ super(QuotaRequestDetails, self).__init__(**kwargs) self.id = None self.name = None @@ -1465,11 +2105,11 @@ def __init__( class QuotaRequestDetailsList(msrest.serialization.Model): """Quota request details. - :param value: The quota requests. - :type value: list[~azure.mgmt.reservations.models.QuotaRequestDetails] - :param next_link: The URI to fetch the next page of quota limits. When there are no more pages, + :ivar value: The quota requests. + :vartype value: list[~azure.mgmt.reservations.models.QuotaRequestDetails] + :ivar next_link: The URI to fetch the next page of quota limits. When there are no more pages, this is null. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1484,6 +2124,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The quota requests. + :paramtype value: list[~azure.mgmt.reservations.models.QuotaRequestDetails] + :keyword next_link: The URI to fetch the next page of quota limits. When there are no more + pages, this is null. + :paramtype next_link: str + """ super(QuotaRequestDetailsList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1508,8 +2155,8 @@ class QuotaRequestOneResourceSubmitResponse(msrest.serialization.Model): :ivar request_submit_time: The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. :vartype request_submit_time: ~datetime.datetime - :param properties: Quota properties for the resource. - :type properties: ~azure.mgmt.reservations.models.QuotaProperties + :ivar properties: Quota properties for the resource. + :vartype properties: ~azure.mgmt.reservations.models.QuotaProperties """ _validation = { @@ -1537,6 +2184,10 @@ def __init__( properties: Optional["QuotaProperties"] = None, **kwargs ): + """ + :keyword properties: Quota properties for the resource. + :paramtype properties: ~azure.mgmt.reservations.models.QuotaProperties + """ super(QuotaRequestOneResourceSubmitResponse, self).__init__(**kwargs) self.id = None self.name = None @@ -1552,16 +2203,16 @@ class QuotaRequestProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param provisioning_state: The quota request status. Possible values include: "Accepted", + :ivar provisioning_state: The quota request status. Possible values include: "Accepted", "Invalid", "Succeeded", "Failed", "InProgress". - :type provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState + :vartype provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState :ivar message: User friendly status message. :vartype message: str :ivar request_submit_time: The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. :vartype request_submit_time: ~datetime.datetime - :param value: The quotaRequests. - :type value: list[~azure.mgmt.reservations.models.SubRequest] + :ivar value: The quotaRequests. + :vartype value: list[~azure.mgmt.reservations.models.SubRequest] """ _validation = { @@ -1583,6 +2234,13 @@ def __init__( value: Optional[List["SubRequest"]] = None, **kwargs ): + """ + :keyword provisioning_state: The quota request status. Possible values include: "Accepted", + "Invalid", "Succeeded", "Failed", "InProgress". + :paramtype provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState + :keyword value: The quotaRequests. + :paramtype value: list[~azure.mgmt.reservations.models.SubRequest] + """ super(QuotaRequestProperties, self).__init__(**kwargs) self.provisioning_state = provisioning_state self.message = None @@ -1599,8 +2257,8 @@ class QuotaRequestSubmitResponse(msrest.serialization.Model): :vartype id: str :ivar name: The name of the quota request. :vartype name: str - :param properties: The quota request details. - :type properties: ~azure.mgmt.reservations.models.QuotaRequestProperties + :ivar properties: The quota request details. + :vartype properties: ~azure.mgmt.reservations.models.QuotaRequestProperties :ivar type: Type of resource. "Microsoft.Capacity/serviceLimits". :vartype type: str """ @@ -1624,6 +2282,10 @@ def __init__( properties: Optional["QuotaRequestProperties"] = None, **kwargs ): + """ + :keyword properties: The quota request details. + :paramtype properties: ~azure.mgmt.reservations.models.QuotaRequestProperties + """ super(QuotaRequestSubmitResponse, self).__init__(**kwargs) self.id = None self.name = None @@ -1669,6 +2331,8 @@ def __init__( self, **kwargs ): + """ + """ super(QuotaRequestSubmitResponse201, self).__init__(**kwargs) self.id = None self.name = None @@ -1680,15 +2344,15 @@ def __init__( class RenewPropertiesResponse(msrest.serialization.Model): """RenewPropertiesResponse. - :param purchase_properties: - :type purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest - :param pricing_currency_total: Amount that Microsoft uses for record. Used during refund for + :ivar purchase_properties: + :vartype purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest + :ivar pricing_currency_total: Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. - :type pricing_currency_total: + :vartype pricing_currency_total: ~azure.mgmt.reservations.models.RenewPropertiesResponsePricingCurrencyTotal - :param billing_currency_total: Currency and amount that customer will be charged in customer's + :ivar billing_currency_total: Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not included. - :type billing_currency_total: + :vartype billing_currency_total: ~azure.mgmt.reservations.models.RenewPropertiesResponseBillingCurrencyTotal """ @@ -1706,6 +2370,18 @@ def __init__( billing_currency_total: Optional["RenewPropertiesResponseBillingCurrencyTotal"] = None, **kwargs ): + """ + :keyword purchase_properties: + :paramtype purchase_properties: ~azure.mgmt.reservations.models.PurchaseRequest + :keyword pricing_currency_total: Amount that Microsoft uses for record. Used during refund for + calculating refund limit. Tax is not included. This is locked price 30 days before expiry. + :paramtype pricing_currency_total: + ~azure.mgmt.reservations.models.RenewPropertiesResponsePricingCurrencyTotal + :keyword billing_currency_total: Currency and amount that customer will be charged in + customer's local currency for renewal purchase. Tax is not included. + :paramtype billing_currency_total: + ~azure.mgmt.reservations.models.RenewPropertiesResponseBillingCurrencyTotal + """ super(RenewPropertiesResponse, self).__init__(**kwargs) self.purchase_properties = purchase_properties self.pricing_currency_total = pricing_currency_total @@ -1715,10 +2391,11 @@ def __init__( class RenewPropertiesResponseBillingCurrencyTotal(msrest.serialization.Model): """Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not included. - :param currency_code: - :type currency_code: str - :param amount: - :type amount: float + :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase + record. + :vartype currency_code: str + :ivar amount: + :vartype amount: float """ _attribute_map = { @@ -1733,6 +2410,13 @@ def __init__( amount: Optional[float] = None, **kwargs ): + """ + :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this + purchase record. + :paramtype currency_code: str + :keyword amount: + :paramtype amount: float + """ super(RenewPropertiesResponseBillingCurrencyTotal, self).__init__(**kwargs) self.currency_code = currency_code self.amount = amount @@ -1741,10 +2425,11 @@ def __init__( class RenewPropertiesResponsePricingCurrencyTotal(msrest.serialization.Model): """Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. - :param currency_code: - :type currency_code: str - :param amount: - :type amount: float + :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase + record. + :vartype currency_code: str + :ivar amount: + :vartype amount: float """ _attribute_map = { @@ -1759,6 +2444,13 @@ def __init__( amount: Optional[float] = None, **kwargs ): + """ + :keyword currency_code: The ISO 4217 3-letter currency code for the currency used by this + purchase record. + :paramtype currency_code: str + :keyword amount: + :paramtype amount: float + """ super(RenewPropertiesResponsePricingCurrencyTotal, self).__init__(**kwargs) self.currency_code = currency_code self.amount = amount @@ -1767,10 +2459,10 @@ def __init__( class ReservationList(msrest.serialization.Model): """ReservationList. - :param value: - :type value: list[~azure.mgmt.reservations.models.ReservationResponse] - :param next_link: Url to get the next page of reservations. - :type next_link: str + :ivar value: + :vartype value: list[~azure.mgmt.reservations.models.ReservationResponse] + :ivar next_link: Url to get the next page of reservations. + :vartype next_link: str """ _attribute_map = { @@ -1785,6 +2477,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.reservations.models.ReservationResponse] + :keyword next_link: Url to get the next page of reservations. + :paramtype next_link: str + """ super(ReservationList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1793,14 +2491,14 @@ def __init__( class ReservationMergeProperties(msrest.serialization.Model): """ReservationMergeProperties. - :param merge_destination: Reservation Resource Id Created due to the merge. Format of the + :ivar merge_destination: Reservation Resource Id Created due to the merge. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type merge_destination: str - :param merge_sources: Resource Ids of the Source Reservation's merged to form this Reservation. + :vartype merge_destination: str + :ivar merge_sources: Resource Ids of the Source Reservation's merged to form this Reservation. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type merge_sources: list[str] + :vartype merge_sources: list[str] """ _attribute_map = { @@ -1815,6 +2513,16 @@ def __init__( merge_sources: Optional[List[str]] = None, **kwargs ): + """ + :keyword merge_destination: Reservation Resource Id Created due to the merge. Format of the + resource Id is + /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :paramtype merge_destination: str + :keyword merge_sources: Resource Ids of the Source Reservation's merged to form this + Reservation. Format of the resource Id is + /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :paramtype merge_sources: list[str] + """ super(ReservationMergeProperties, self).__init__(**kwargs) self.merge_destination = merge_destination self.merge_sources = merge_sources @@ -1823,15 +2531,15 @@ def __init__( class ReservationOrderBillingPlanInformation(msrest.serialization.Model): """Information describing the type of billing plan for this reservation. - :param pricing_currency_total: Amount of money to be paid for the Order. Tax is not included. - :type pricing_currency_total: ~azure.mgmt.reservations.models.Price - :param start_date: Date when the billing plan has started. - :type start_date: ~datetime.date - :param next_payment_due_date: For recurring billing plans, indicates the date when next payment + :ivar pricing_currency_total: Amount of money to be paid for the Order. Tax is not included. + :vartype pricing_currency_total: ~azure.mgmt.reservations.models.Price + :ivar start_date: Date when the billing plan has started. + :vartype start_date: ~datetime.date + :ivar next_payment_due_date: For recurring billing plans, indicates the date when next payment will be processed. Null when total is paid off. - :type next_payment_due_date: ~datetime.date - :param transactions: - :type transactions: list[~azure.mgmt.reservations.models.PaymentDetail] + :vartype next_payment_due_date: ~datetime.date + :ivar transactions: + :vartype transactions: list[~azure.mgmt.reservations.models.PaymentDetail] """ _attribute_map = { @@ -1850,6 +2558,17 @@ def __init__( transactions: Optional[List["PaymentDetail"]] = None, **kwargs ): + """ + :keyword pricing_currency_total: Amount of money to be paid for the Order. Tax is not included. + :paramtype pricing_currency_total: ~azure.mgmt.reservations.models.Price + :keyword start_date: Date when the billing plan has started. + :paramtype start_date: ~datetime.date + :keyword next_payment_due_date: For recurring billing plans, indicates the date when next + payment will be processed. Null when total is paid off. + :paramtype next_payment_due_date: ~datetime.date + :keyword transactions: + :paramtype transactions: list[~azure.mgmt.reservations.models.PaymentDetail] + """ super(ReservationOrderBillingPlanInformation, self).__init__(**kwargs) self.pricing_currency_total = pricing_currency_total self.start_date = start_date @@ -1860,10 +2579,10 @@ def __init__( class ReservationOrderList(msrest.serialization.Model): """ReservationOrderList. - :param value: - :type value: list[~azure.mgmt.reservations.models.ReservationOrderResponse] - :param next_link: Url to get the next page of reservationOrders. - :type next_link: str + :ivar value: + :vartype value: list[~azure.mgmt.reservations.models.ReservationOrderResponse] + :ivar next_link: Url to get the next page of reservationOrders. + :vartype next_link: str """ _attribute_map = { @@ -1878,6 +2597,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.reservations.models.ReservationOrderResponse] + :keyword next_link: Url to get the next page of reservationOrders. + :paramtype next_link: str + """ super(ReservationOrderList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1888,43 +2613,48 @@ class ReservationOrderResponse(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param etag: - :type etag: int + :ivar etag: + :vartype etag: int :ivar id: Identifier of the reservation. :vartype id: str :ivar name: Name of the reservation. :vartype name: str :ivar type: Type of resource. "Microsoft.Capacity/reservations". :vartype type: str - :param display_name: Friendly name for user to easily identified the reservation. - :type display_name: str - :param request_date_time: This is the DateTime when the reservation was initially requested for + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.reservations.models.SystemData + :ivar display_name: Friendly name for user to easily identified the reservation. + :vartype display_name: str + :ivar request_date_time: This is the DateTime when the reservation was initially requested for purchase. - :type request_date_time: ~datetime.datetime - :param created_date_time: This is the DateTime when the reservation was created. - :type created_date_time: ~datetime.datetime - :param expiry_date: This is the date when the Reservation will expire. - :type expiry_date: ~datetime.date - :param original_quantity: Quantity of the SKUs that are part of the Reservation. Must be - greater than zero. - :type original_quantity: int - :param term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y". - :type term: str or ~azure.mgmt.reservations.models.ReservationTerm - :param provisioning_state: Current state of the reservation. - :type provisioning_state: str - :param billing_plan: Represent the billing plans. Possible values include: "Upfront", - "Monthly". - :type billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan - :param plan_information: Information describing the type of billing plan for this reservation. - :type plan_information: ~azure.mgmt.reservations.models.ReservationOrderBillingPlanInformation - :param reservations: - :type reservations: list[~azure.mgmt.reservations.models.ReservationResponse] + :vartype request_date_time: ~datetime.datetime + :ivar created_date_time: This is the DateTime when the reservation was created. + :vartype created_date_time: ~datetime.datetime + :ivar expiry_date: This is the date when the Reservation will expire. + :vartype expiry_date: ~datetime.date + :ivar original_quantity: Total Quantity of the SKUs purchased in the Reservation. + :vartype original_quantity: int + :ivar term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y", "P5Y". + :vartype term: str or ~azure.mgmt.reservations.models.ReservationTerm + :ivar provisioning_state: Current state of the reservation. Possible values include: + "Creating", "PendingResourceHold", "ConfirmedResourceHold", "PendingBilling", + "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", "BillingFailed", "Failed", + "Split", "Merged". + :vartype provisioning_state: str or ~azure.mgmt.reservations.models.ProvisioningState + :ivar billing_plan: Represent the billing plans. Possible values include: "Upfront", "Monthly". + :vartype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan + :ivar plan_information: Information describing the type of billing plan for this reservation. + :vartype plan_information: + ~azure.mgmt.reservations.models.ReservationOrderBillingPlanInformation + :ivar reservations: + :vartype reservations: list[~azure.mgmt.reservations.models.ReservationResponse] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -1932,6 +2662,7 @@ class ReservationOrderResponse(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'request_date_time': {'key': 'properties.requestDateTime', 'type': 'iso-8601'}, 'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'}, @@ -1954,17 +2685,49 @@ def __init__( expiry_date: Optional[datetime.date] = None, original_quantity: Optional[int] = None, term: Optional[Union[str, "ReservationTerm"]] = None, - provisioning_state: Optional[str] = None, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, billing_plan: Optional[Union[str, "ReservationBillingPlan"]] = None, plan_information: Optional["ReservationOrderBillingPlanInformation"] = None, reservations: Optional[List["ReservationResponse"]] = None, **kwargs ): + """ + :keyword etag: + :paramtype etag: int + :keyword display_name: Friendly name for user to easily identified the reservation. + :paramtype display_name: str + :keyword request_date_time: This is the DateTime when the reservation was initially requested + for purchase. + :paramtype request_date_time: ~datetime.datetime + :keyword created_date_time: This is the DateTime when the reservation was created. + :paramtype created_date_time: ~datetime.datetime + :keyword expiry_date: This is the date when the Reservation will expire. + :paramtype expiry_date: ~datetime.date + :keyword original_quantity: Total Quantity of the SKUs purchased in the Reservation. + :paramtype original_quantity: int + :keyword term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y", "P5Y". + :paramtype term: str or ~azure.mgmt.reservations.models.ReservationTerm + :keyword provisioning_state: Current state of the reservation. Possible values include: + "Creating", "PendingResourceHold", "ConfirmedResourceHold", "PendingBilling", + "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", "BillingFailed", "Failed", + "Split", "Merged". + :paramtype provisioning_state: str or ~azure.mgmt.reservations.models.ProvisioningState + :keyword billing_plan: Represent the billing plans. Possible values include: "Upfront", + "Monthly". + :paramtype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan + :keyword plan_information: Information describing the type of billing plan for this + reservation. + :paramtype plan_information: + ~azure.mgmt.reservations.models.ReservationOrderBillingPlanInformation + :keyword reservations: + :paramtype reservations: list[~azure.mgmt.reservations.models.ReservationResponse] + """ super(ReservationOrderResponse, self).__init__(**kwargs) self.etag = etag self.id = None self.name = None self.type = None + self.system_data = None self.display_name = display_name self.request_date_time = request_date_time self.created_date_time = created_date_time @@ -1977,73 +2740,257 @@ def __init__( self.reservations = reservations -class ReservationProperties(msrest.serialization.Model): - """ReservationProperties. +class ReservationResponse(msrest.serialization.Model): + """The definition of the reservation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar location: The Azure Region where the reserved resource lives. + :vartype location: str + :ivar etag: + :vartype etag: int + :ivar id: Identifier of the reservation. + :vartype id: str + :ivar name: Name of the reservation. + :vartype name: str + :ivar sku: The sku information associated to this reservation. + :vartype sku: ~azure.mgmt.reservations.models.SkuName + :ivar properties: The properties associated to this reservation. + :vartype properties: ~azure.mgmt.reservations.models.ReservationsProperties + :ivar type: Type of resource. "Microsoft.Capacity/reservationOrders/reservations". + :vartype type: str + :ivar kind: Resource Provider type to be reserved. The only acceptable values to pass in are + None and "Microsoft.Compute". The default value is None. + :vartype kind: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.reservations.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SkuName'}, + 'properties': {'key': 'properties', 'type': 'ReservationsProperties'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + etag: Optional[int] = None, + sku: Optional["SkuName"] = None, + properties: Optional["ReservationsProperties"] = None, + kind: Optional[str] = None, + **kwargs + ): + """ + :keyword location: The Azure Region where the reserved resource lives. + :paramtype location: str + :keyword etag: + :paramtype etag: int + :keyword sku: The sku information associated to this reservation. + :paramtype sku: ~azure.mgmt.reservations.models.SkuName + :keyword properties: The properties associated to this reservation. + :paramtype properties: ~azure.mgmt.reservations.models.ReservationsProperties + :keyword kind: Resource Provider type to be reserved. The only acceptable values to pass in are + None and "Microsoft.Compute". The default value is None. + :paramtype kind: str + """ + super(ReservationResponse, self).__init__(**kwargs) + self.location = location + self.etag = etag + self.id = None + self.name = None + self.sku = sku + self.properties = properties + self.type = None + self.kind = kind + self.system_data = None + + +class ReservationsListResult(msrest.serialization.Model): + """The list of reservations and summary of roll out count of reservations in each state. Variables are only populated by the server, and will be ignored when sending a request. - :param reserved_resource_type: The type of the resource that is being reserved. Possible values + :ivar value: The list of reservations. + :vartype value: list[~azure.mgmt.reservations.models.ReservationResponse] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + :ivar summary: The roll out count summary of the reservations. + :vartype summary: ~azure.mgmt.reservations.models.ReservationSummary + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ReservationResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'summary': {'key': 'summary', 'type': 'ReservationSummary'}, + } + + def __init__( + self, + *, + summary: Optional["ReservationSummary"] = None, + **kwargs + ): + """ + :keyword summary: The roll out count summary of the reservations. + :paramtype summary: ~azure.mgmt.reservations.models.ReservationSummary + """ + super(ReservationsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + self.summary = summary + + +class ReservationSplitProperties(msrest.serialization.Model): + """ReservationSplitProperties. + + :ivar split_destinations: List of destination Resource Id that are created due to split. Format + of the resource Id is + /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :vartype split_destinations: list[str] + :ivar split_source: Resource Id of the Reservation from which this is split. Format of the + resource Id is + /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :vartype split_source: str + """ + + _attribute_map = { + 'split_destinations': {'key': 'splitDestinations', 'type': '[str]'}, + 'split_source': {'key': 'splitSource', 'type': 'str'}, + } + + def __init__( + self, + *, + split_destinations: Optional[List[str]] = None, + split_source: Optional[str] = None, + **kwargs + ): + """ + :keyword split_destinations: List of destination Resource Id that are created due to split. + Format of the resource Id is + /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :paramtype split_destinations: list[str] + :keyword split_source: Resource Id of the Reservation from which this is split. Format of the + resource Id is + /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :paramtype split_source: str + """ + super(ReservationSplitProperties, self).__init__(**kwargs) + self.split_destinations = split_destinations + self.split_source = split_source + + +class ReservationsProperties(msrest.serialization.Model): + """The properties of the reservations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar reserved_resource_type: The type of the resource that is being reserved. Possible values include: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", "SqlDataWarehouse", "VMwareCloudSimple", "RedHatOsa", "Databricks", "AppService", "ManagedDisk", "BlockBlob", "RedisCache", "AzureDataExplorer", "MySql", "MariaDb", - "PostgreSql", "DedicatedHost", "SapHana", "SqlAzureHybridBenefit". - :type reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType - :param instance_flexibility: Turning this on will apply the reservation discount to other VMs - in the same VM size group. Only specify for VirtualMachines reserved resource type. Possible - values include: "On", "Off". - :type instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility - :param display_name: Friendly name for user to easily identify the reservation. - :type display_name: str - :param applied_scopes: List of the subscriptions that the benefit will be applied. Do not - specify if AppliedScopeType is Shared. - :type applied_scopes: list[str] - :param applied_scope_type: Type of the Applied Scope. Possible values include: "Single", - "Shared". - :type applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType - :param quantity: Quantity of the SKUs that are part of the Reservation. Must be greater than - zero. - :type quantity: int - :param provisioning_state: Current state of the reservation. - :type provisioning_state: str - :param effective_date_time: DateTime of the Reservation starting when this version is effective + "PostgreSql", "DedicatedHost", "SapHana", "SqlAzureHybridBenefit", "AVS", "DataFactory", + "NetAppStorage", "AzureFiles", "SqlEdge". + :vartype reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType + :ivar instance_flexibility: Allows reservation discount to be applied across skus within the + same Autofit group. Not all skus support instance size flexibility. Possible values include: + "On", "Off". + :vartype instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility + :ivar display_name: Friendly name for user to easily identify the reservation. + :vartype display_name: str + :ivar applied_scopes: The list of applied scopes. + :vartype applied_scopes: list[str] + :ivar applied_scope_type: The applied scope type. Possible values include: "Single", "Shared". + :vartype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType + :ivar archived: Indicates if the reservation is archived. + :vartype archived: bool + :ivar capabilities: Capabilities of the reservation. + :vartype capabilities: str + :ivar quantity: Quantity of the SKUs that are part of the Reservation. + :vartype quantity: int + :ivar provisioning_state: Current state of the reservation. Possible values include: + "Creating", "PendingResourceHold", "ConfirmedResourceHold", "PendingBilling", + "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", "BillingFailed", "Failed", + "Split", "Merged". + :vartype provisioning_state: str or ~azure.mgmt.reservations.models.ProvisioningState + :ivar effective_date_time: DateTime of the Reservation starting when this version is effective from. - :type effective_date_time: ~datetime.datetime + :vartype effective_date_time: ~datetime.datetime :ivar last_updated_date_time: DateTime of the last time the Reservation was updated. :vartype last_updated_date_time: ~datetime.datetime - :param expiry_date: This is the date when the Reservation will expire. - :type expiry_date: ~datetime.date - :param sku_description: Description of the SKU in english. - :type sku_description: str - :param extended_status_info: - :type extended_status_info: ~azure.mgmt.reservations.models.ExtendedStatusInfo - :param billing_plan: Represent the billing plans. Possible values include: "Upfront", - "Monthly". - :type billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan - :param split_properties: - :type split_properties: ~azure.mgmt.reservations.models.ReservationSplitProperties - :param merge_properties: - :type merge_properties: ~azure.mgmt.reservations.models.ReservationMergeProperties - :param billing_scope_id: Subscription that will be charged for purchasing Reservation. - :type billing_scope_id: str - :param renew: Setting this to true will automatically purchase a new reservation on the + :ivar expiry_date: This is the date when the Reservation will expire. + :vartype expiry_date: ~datetime.date + :ivar sku_description: Description of the SKU in english. + :vartype sku_description: str + :ivar extended_status_info: The message giving detailed information about the status code. + :vartype extended_status_info: ~azure.mgmt.reservations.models.ExtendedStatusInfo + :ivar billing_plan: The billing plan options available for this SKU. Possible values include: + "Upfront", "Monthly". + :vartype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan + :ivar display_provisioning_state: The provisioning state of the reservation for display, e.g. + Succeeded. + :vartype display_provisioning_state: str + :ivar provisioning_sub_state: The provisioning state of the reservation, e.g. Succeeded. + :vartype provisioning_sub_state: str + :ivar purchase_date: This is the date when the Reservation was purchased. + :vartype purchase_date: ~datetime.date + :ivar split_properties: + :vartype split_properties: ~azure.mgmt.reservations.models.ReservationSplitProperties + :ivar merge_properties: + :vartype merge_properties: ~azure.mgmt.reservations.models.ReservationMergeProperties + :ivar billing_scope_id: Subscription that will be charged for purchasing Reservation. + :vartype billing_scope_id: str + :ivar renew: Setting this to true will automatically purchase a new reservation on the expiration date time. - :type renew: bool - :param renew_source: Reservation Id of the reservation from which this reservation is renewed. + :vartype renew: bool + :ivar renew_source: Reservation Id of the reservation from which this reservation is renewed. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type renew_source: str - :param renew_destination: Reservation Id of the reservation which is purchased because of - renew. Format of the resource Id is + :vartype renew_source: str + :ivar renew_destination: Reservation Id of the reservation which is purchased because of renew. + Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type renew_destination: str - :param renew_properties: - :type renew_properties: ~azure.mgmt.reservations.models.RenewPropertiesResponse - :param term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y". - :type term: str or ~azure.mgmt.reservations.models.ReservationTerm + :vartype renew_destination: str + :ivar renew_properties: + :vartype renew_properties: ~azure.mgmt.reservations.models.RenewPropertiesResponse + :ivar term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y", "P5Y". + :vartype term: str or ~azure.mgmt.reservations.models.ReservationTerm + :ivar user_friendly_applied_scope_type: The applied scope type of the reservation for display, + e.g. Shared. + :vartype user_friendly_applied_scope_type: str + :ivar user_friendly_renew_state: The renew state of the reservation for display, e.g. On. + :vartype user_friendly_renew_state: str + :ivar utilization: Reservation utilization. + :vartype utilization: ~azure.mgmt.reservations.models.ReservationsPropertiesUtilization """ _validation = { 'last_updated_date_time': {'readonly': True}, + 'display_provisioning_state': {'readonly': True}, + 'provisioning_sub_state': {'readonly': True}, + 'user_friendly_applied_scope_type': {'readonly': True}, + 'user_friendly_renew_state': {'readonly': True}, + 'utilization': {'readonly': True}, } _attribute_map = { @@ -2052,6 +2999,8 @@ class ReservationProperties(msrest.serialization.Model): 'display_name': {'key': 'displayName', 'type': 'str'}, 'applied_scopes': {'key': 'appliedScopes', 'type': '[str]'}, 'applied_scope_type': {'key': 'appliedScopeType', 'type': 'str'}, + 'archived': {'key': 'archived', 'type': 'bool'}, + 'capabilities': {'key': 'capabilities', 'type': 'str'}, 'quantity': {'key': 'quantity', 'type': 'int'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'effective_date_time': {'key': 'effectiveDateTime', 'type': 'iso-8601'}, @@ -2060,6 +3009,9 @@ class ReservationProperties(msrest.serialization.Model): 'sku_description': {'key': 'skuDescription', 'type': 'str'}, 'extended_status_info': {'key': 'extendedStatusInfo', 'type': 'ExtendedStatusInfo'}, 'billing_plan': {'key': 'billingPlan', 'type': 'str'}, + 'display_provisioning_state': {'key': 'displayProvisioningState', 'type': 'str'}, + 'provisioning_sub_state': {'key': 'provisioningSubState', 'type': 'str'}, + 'purchase_date': {'key': 'purchaseDate', 'type': 'date'}, 'split_properties': {'key': 'splitProperties', 'type': 'ReservationSplitProperties'}, 'merge_properties': {'key': 'mergeProperties', 'type': 'ReservationMergeProperties'}, 'billing_scope_id': {'key': 'billingScopeId', 'type': 'str'}, @@ -2068,6 +3020,9 @@ class ReservationProperties(msrest.serialization.Model): 'renew_destination': {'key': 'renewDestination', 'type': 'str'}, 'renew_properties': {'key': 'renewProperties', 'type': 'RenewPropertiesResponse'}, 'term': {'key': 'term', 'type': 'str'}, + 'user_friendly_applied_scope_type': {'key': 'userFriendlyAppliedScopeType', 'type': 'str'}, + 'user_friendly_renew_state': {'key': 'userFriendlyRenewState', 'type': 'str'}, + 'utilization': {'key': 'utilization', 'type': 'ReservationsPropertiesUtilization'}, } def __init__( @@ -2078,13 +3033,16 @@ def __init__( display_name: Optional[str] = None, applied_scopes: Optional[List[str]] = None, applied_scope_type: Optional[Union[str, "AppliedScopeType"]] = None, + archived: Optional[bool] = None, + capabilities: Optional[str] = None, quantity: Optional[int] = None, - provisioning_state: Optional[str] = None, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, effective_date_time: Optional[datetime.datetime] = None, expiry_date: Optional[datetime.date] = None, sku_description: Optional[str] = None, extended_status_info: Optional["ExtendedStatusInfo"] = None, billing_plan: Optional[Union[str, "ReservationBillingPlan"]] = None, + purchase_date: Optional[datetime.date] = None, split_properties: Optional["ReservationSplitProperties"] = None, merge_properties: Optional["ReservationMergeProperties"] = None, billing_scope_id: Optional[str] = None, @@ -2095,12 +3053,80 @@ def __init__( term: Optional[Union[str, "ReservationTerm"]] = None, **kwargs ): - super(ReservationProperties, self).__init__(**kwargs) + """ + :keyword reserved_resource_type: The type of the resource that is being reserved. Possible + values include: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", + "SqlDataWarehouse", "VMwareCloudSimple", "RedHatOsa", "Databricks", "AppService", + "ManagedDisk", "BlockBlob", "RedisCache", "AzureDataExplorer", "MySql", "MariaDb", + "PostgreSql", "DedicatedHost", "SapHana", "SqlAzureHybridBenefit", "AVS", "DataFactory", + "NetAppStorage", "AzureFiles", "SqlEdge". + :paramtype reserved_resource_type: str or ~azure.mgmt.reservations.models.ReservedResourceType + :keyword instance_flexibility: Allows reservation discount to be applied across skus within the + same Autofit group. Not all skus support instance size flexibility. Possible values include: + "On", "Off". + :paramtype instance_flexibility: str or ~azure.mgmt.reservations.models.InstanceFlexibility + :keyword display_name: Friendly name for user to easily identify the reservation. + :paramtype display_name: str + :keyword applied_scopes: The list of applied scopes. + :paramtype applied_scopes: list[str] + :keyword applied_scope_type: The applied scope type. Possible values include: "Single", + "Shared". + :paramtype applied_scope_type: str or ~azure.mgmt.reservations.models.AppliedScopeType + :keyword archived: Indicates if the reservation is archived. + :paramtype archived: bool + :keyword capabilities: Capabilities of the reservation. + :paramtype capabilities: str + :keyword quantity: Quantity of the SKUs that are part of the Reservation. + :paramtype quantity: int + :keyword provisioning_state: Current state of the reservation. Possible values include: + "Creating", "PendingResourceHold", "ConfirmedResourceHold", "PendingBilling", + "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", "BillingFailed", "Failed", + "Split", "Merged". + :paramtype provisioning_state: str or ~azure.mgmt.reservations.models.ProvisioningState + :keyword effective_date_time: DateTime of the Reservation starting when this version is + effective from. + :paramtype effective_date_time: ~datetime.datetime + :keyword expiry_date: This is the date when the Reservation will expire. + :paramtype expiry_date: ~datetime.date + :keyword sku_description: Description of the SKU in english. + :paramtype sku_description: str + :keyword extended_status_info: The message giving detailed information about the status code. + :paramtype extended_status_info: ~azure.mgmt.reservations.models.ExtendedStatusInfo + :keyword billing_plan: The billing plan options available for this SKU. Possible values + include: "Upfront", "Monthly". + :paramtype billing_plan: str or ~azure.mgmt.reservations.models.ReservationBillingPlan + :keyword purchase_date: This is the date when the Reservation was purchased. + :paramtype purchase_date: ~datetime.date + :keyword split_properties: + :paramtype split_properties: ~azure.mgmt.reservations.models.ReservationSplitProperties + :keyword merge_properties: + :paramtype merge_properties: ~azure.mgmt.reservations.models.ReservationMergeProperties + :keyword billing_scope_id: Subscription that will be charged for purchasing Reservation. + :paramtype billing_scope_id: str + :keyword renew: Setting this to true will automatically purchase a new reservation on the + expiration date time. + :paramtype renew: bool + :keyword renew_source: Reservation Id of the reservation from which this reservation is + renewed. Format of the resource Id is + /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :paramtype renew_source: str + :keyword renew_destination: Reservation Id of the reservation which is purchased because of + renew. Format of the resource Id is + /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :paramtype renew_destination: str + :keyword renew_properties: + :paramtype renew_properties: ~azure.mgmt.reservations.models.RenewPropertiesResponse + :keyword term: Represent the term of Reservation. Possible values include: "P1Y", "P3Y", "P5Y". + :paramtype term: str or ~azure.mgmt.reservations.models.ReservationTerm + """ + super(ReservationsProperties, self).__init__(**kwargs) self.reserved_resource_type = reserved_resource_type self.instance_flexibility = instance_flexibility self.display_name = display_name self.applied_scopes = applied_scopes self.applied_scope_type = applied_scope_type + self.archived = archived + self.capabilities = capabilities self.quantity = quantity self.provisioning_state = provisioning_state self.effective_date_time = effective_date_time @@ -2109,6 +3135,9 @@ def __init__( self.sku_description = sku_description self.extended_status_info = extended_status_info self.billing_plan = billing_plan + self.display_provisioning_state = None + self.provisioning_sub_state = None + self.purchase_date = purchase_date self.split_properties = split_properties self.merge_properties = merge_properties self.billing_scope_id = billing_scope_id @@ -2117,105 +3146,109 @@ def __init__( self.renew_destination = renew_destination self.renew_properties = renew_properties self.term = term + self.user_friendly_applied_scope_type = None + self.user_friendly_renew_state = None + self.utilization = None -class ReservationResponse(msrest.serialization.Model): - """ReservationResponse. +class ReservationsPropertiesUtilization(msrest.serialization.Model): + """Reservation utilization. Variables are only populated by the server, and will be ignored when sending a request. - :ivar location: The Azure Region where the reserved resource lives. - :vartype location: str - :param etag: - :type etag: int - :ivar id: Identifier of the reservation. - :vartype id: str - :ivar name: Name of the reservation. - :vartype name: str - :param sku: - :type sku: ~azure.mgmt.reservations.models.SkuName - :param properties: - :type properties: ~azure.mgmt.reservations.models.ReservationProperties - :ivar type: Type of resource. "Microsoft.Capacity/reservationOrders/reservations". - :vartype type: str + :ivar trend: The number of days trend for a reservation. + :vartype trend: str + :ivar aggregates: The array of aggregates of a reservation's utilization. + :vartype aggregates: list[~azure.mgmt.reservations.models.ReservationUtilizationAggregates] """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'trend': {'readonly': True}, } _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'int'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SkuName'}, - 'properties': {'key': 'properties', 'type': 'ReservationProperties'}, - 'type': {'key': 'type', 'type': 'str'}, + 'trend': {'key': 'trend', 'type': 'str'}, + 'aggregates': {'key': 'aggregates', 'type': '[ReservationUtilizationAggregates]'}, } def __init__( self, *, - etag: Optional[int] = None, - sku: Optional["SkuName"] = None, - properties: Optional["ReservationProperties"] = None, + aggregates: Optional[List["ReservationUtilizationAggregates"]] = None, **kwargs ): - super(ReservationResponse, self).__init__(**kwargs) - self.location = None - self.etag = etag - self.id = None - self.name = None - self.sku = sku - self.properties = properties - self.type = None + """ + :keyword aggregates: The array of aggregates of a reservation's utilization. + :paramtype aggregates: list[~azure.mgmt.reservations.models.ReservationUtilizationAggregates] + """ + super(ReservationsPropertiesUtilization, self).__init__(**kwargs) + self.trend = None + self.aggregates = aggregates -class ReservationSplitProperties(msrest.serialization.Model): - """ReservationSplitProperties. +class ReservationSummary(msrest.serialization.Model): + """The roll up count summary of reservations in each state. - :param split_destinations: List of destination Resource Id that are created due to split. - Format of the resource Id is - /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type split_destinations: list[str] - :param split_source: Resource Id of the Reservation from which this is split. Format of the - resource Id is - /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type split_source: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar succeeded_count: The number of reservation in Succeeded state. + :vartype succeeded_count: float + :ivar failed_count: The number of reservation in Failed state. + :vartype failed_count: float + :ivar expiring_count: The number of reservation in Expiring state. + :vartype expiring_count: float + :ivar expired_count: The number of reservation in Expired state. + :vartype expired_count: float + :ivar pending_count: The number of reservation in Pending state. + :vartype pending_count: float + :ivar cancelled_count: The number of reservation in Cancelled state. + :vartype cancelled_count: float """ + _validation = { + 'succeeded_count': {'readonly': True}, + 'failed_count': {'readonly': True}, + 'expiring_count': {'readonly': True}, + 'expired_count': {'readonly': True}, + 'pending_count': {'readonly': True}, + 'cancelled_count': {'readonly': True}, + } + _attribute_map = { - 'split_destinations': {'key': 'splitDestinations', 'type': '[str]'}, - 'split_source': {'key': 'splitSource', 'type': 'str'}, + 'succeeded_count': {'key': 'succeededCount', 'type': 'float'}, + 'failed_count': {'key': 'failedCount', 'type': 'float'}, + 'expiring_count': {'key': 'expiringCount', 'type': 'float'}, + 'expired_count': {'key': 'expiredCount', 'type': 'float'}, + 'pending_count': {'key': 'pendingCount', 'type': 'float'}, + 'cancelled_count': {'key': 'cancelledCount', 'type': 'float'}, } def __init__( self, - *, - split_destinations: Optional[List[str]] = None, - split_source: Optional[str] = None, **kwargs ): - super(ReservationSplitProperties, self).__init__(**kwargs) - self.split_destinations = split_destinations - self.split_source = split_source + """ + """ + super(ReservationSummary, self).__init__(**kwargs) + self.succeeded_count = None + self.failed_count = None + self.expiring_count = None + self.expired_count = None + self.pending_count = None + self.cancelled_count = None class ReservationToExchange(msrest.serialization.Model): """Reservation refund details. - :param reservation_id: Fully qualified id of the Reservation being returned. - :type reservation_id: str - :param quantity: Quantity to be returned. - :type quantity: int - :param billing_refund_amount: - :type billing_refund_amount: ~azure.mgmt.reservations.models.Price - :param billing_information: billing information. - :type billing_information: ~azure.mgmt.reservations.models.BillingInformation + :ivar reservation_id: Fully qualified id of the Reservation being returned. + :vartype reservation_id: str + :ivar quantity: Quantity to be returned. + :vartype quantity: int + :ivar billing_refund_amount: + :vartype billing_refund_amount: ~azure.mgmt.reservations.models.Price + :ivar billing_information: billing information. + :vartype billing_information: ~azure.mgmt.reservations.models.BillingInformation """ _attribute_map = { @@ -2234,6 +3267,16 @@ def __init__( billing_information: Optional["BillingInformation"] = None, **kwargs ): + """ + :keyword reservation_id: Fully qualified id of the Reservation being returned. + :paramtype reservation_id: str + :keyword quantity: Quantity to be returned. + :paramtype quantity: int + :keyword billing_refund_amount: + :paramtype billing_refund_amount: ~azure.mgmt.reservations.models.Price + :keyword billing_information: billing information. + :paramtype billing_information: ~azure.mgmt.reservations.models.BillingInformation + """ super(ReservationToExchange, self).__init__(**kwargs) self.reservation_id = reservation_id self.quantity = quantity @@ -2244,10 +3287,10 @@ def __init__( class ReservationToPurchaseCalculateExchange(msrest.serialization.Model): """Reservation purchase details. - :param properties: - :type properties: ~azure.mgmt.reservations.models.PurchaseRequest - :param billing_currency_total: - :type billing_currency_total: ~azure.mgmt.reservations.models.Price + :ivar properties: + :vartype properties: ~azure.mgmt.reservations.models.PurchaseRequest + :ivar billing_currency_total: + :vartype billing_currency_total: ~azure.mgmt.reservations.models.Price """ _attribute_map = { @@ -2262,6 +3305,12 @@ def __init__( billing_currency_total: Optional["Price"] = None, **kwargs ): + """ + :keyword properties: + :paramtype properties: ~azure.mgmt.reservations.models.PurchaseRequest + :keyword billing_currency_total: + :paramtype billing_currency_total: ~azure.mgmt.reservations.models.Price + """ super(ReservationToPurchaseCalculateExchange, self).__init__(**kwargs) self.properties = properties self.billing_currency_total = billing_currency_total @@ -2270,18 +3319,18 @@ def __init__( class ReservationToPurchaseExchange(msrest.serialization.Model): """Reservation purchase details. - :param reservation_order_id: Fully qualified id of the ReservationOrder being purchased. - :type reservation_order_id: str - :param reservation_id: Fully qualified id of the Reservation being purchased. This value is - only guaranteed to be non-null if the purchase is successful. - :type reservation_id: str - :param properties: - :type properties: ~azure.mgmt.reservations.models.PurchaseRequest - :param billing_currency_total: - :type billing_currency_total: ~azure.mgmt.reservations.models.Price - :param status: Status of the individual operation. Possible values include: "Succeeded", + :ivar reservation_order_id: Fully qualified id of the ReservationOrder being purchased. + :vartype reservation_order_id: str + :ivar reservation_id: Fully qualified id of the Reservation being purchased. This value is only + guaranteed to be non-null if the purchase is successful. + :vartype reservation_id: str + :ivar properties: + :vartype properties: ~azure.mgmt.reservations.models.PurchaseRequest + :ivar billing_currency_total: + :vartype billing_currency_total: ~azure.mgmt.reservations.models.Price + :ivar status: Status of the individual operation. Possible values include: "Succeeded", "Failed", "Cancelled", "Pending". - :type status: str or ~azure.mgmt.reservations.models.OperationStatus + :vartype status: str or ~azure.mgmt.reservations.models.OperationStatus """ _attribute_map = { @@ -2302,6 +3351,20 @@ def __init__( status: Optional[Union[str, "OperationStatus"]] = None, **kwargs ): + """ + :keyword reservation_order_id: Fully qualified id of the ReservationOrder being purchased. + :paramtype reservation_order_id: str + :keyword reservation_id: Fully qualified id of the Reservation being purchased. This value is + only guaranteed to be non-null if the purchase is successful. + :paramtype reservation_id: str + :keyword properties: + :paramtype properties: ~azure.mgmt.reservations.models.PurchaseRequest + :keyword billing_currency_total: + :paramtype billing_currency_total: ~azure.mgmt.reservations.models.Price + :keyword status: Status of the individual operation. Possible values include: "Succeeded", + "Failed", "Cancelled", "Pending". + :paramtype status: str or ~azure.mgmt.reservations.models.OperationStatus + """ super(ReservationToPurchaseExchange, self).__init__(**kwargs) self.reservation_order_id = reservation_order_id self.reservation_id = reservation_id @@ -2313,10 +3376,10 @@ def __init__( class ReservationToReturn(msrest.serialization.Model): """Reservation to return. - :param reservation_id: Fully qualified identifier of the Reservation being returned. - :type reservation_id: str - :param quantity: Quantity to be returned. Must be greater than zero. - :type quantity: int + :ivar reservation_id: Fully qualified identifier of the Reservation being returned. + :vartype reservation_id: str + :ivar quantity: Quantity to be returned. Must be greater than zero. + :vartype quantity: int """ _attribute_map = { @@ -2331,6 +3394,12 @@ def __init__( quantity: Optional[int] = None, **kwargs ): + """ + :keyword reservation_id: Fully qualified identifier of the Reservation being returned. + :paramtype reservation_id: str + :keyword quantity: Quantity to be returned. Must be greater than zero. + :paramtype quantity: int + """ super(ReservationToReturn, self).__init__(**kwargs) self.reservation_id = reservation_id self.quantity = quantity @@ -2339,17 +3408,17 @@ def __init__( class ReservationToReturnForExchange(msrest.serialization.Model): """Reservation refund details. - :param reservation_id: Fully qualified id of the Reservation being returned. - :type reservation_id: str - :param quantity: Quantity to be returned. - :type quantity: int - :param billing_refund_amount: - :type billing_refund_amount: ~azure.mgmt.reservations.models.Price - :param billing_information: billing information. - :type billing_information: ~azure.mgmt.reservations.models.BillingInformation - :param status: Status of the individual operation. Possible values include: "Succeeded", + :ivar reservation_id: Fully qualified id of the Reservation being returned. + :vartype reservation_id: str + :ivar quantity: Quantity to be returned. + :vartype quantity: int + :ivar billing_refund_amount: + :vartype billing_refund_amount: ~azure.mgmt.reservations.models.Price + :ivar billing_information: billing information. + :vartype billing_information: ~azure.mgmt.reservations.models.BillingInformation + :ivar status: Status of the individual operation. Possible values include: "Succeeded", "Failed", "Cancelled", "Pending". - :type status: str or ~azure.mgmt.reservations.models.OperationStatus + :vartype status: str or ~azure.mgmt.reservations.models.OperationStatus """ _attribute_map = { @@ -2370,6 +3439,19 @@ def __init__( status: Optional[Union[str, "OperationStatus"]] = None, **kwargs ): + """ + :keyword reservation_id: Fully qualified id of the Reservation being returned. + :paramtype reservation_id: str + :keyword quantity: Quantity to be returned. + :paramtype quantity: int + :keyword billing_refund_amount: + :paramtype billing_refund_amount: ~azure.mgmt.reservations.models.Price + :keyword billing_information: billing information. + :paramtype billing_information: ~azure.mgmt.reservations.models.BillingInformation + :keyword status: Status of the individual operation. Possible values include: "Succeeded", + "Failed", "Cancelled", "Pending". + :paramtype status: str or ~azure.mgmt.reservations.models.OperationStatus + """ super(ReservationToReturnForExchange, self).__init__(**kwargs) self.reservation_id = reservation_id self.quantity = quantity @@ -2378,13 +3460,55 @@ def __init__( self.status = status +class ReservationUtilizationAggregates(msrest.serialization.Model): + """The aggregate values of reservation utilization. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar grain: The grain of the aggregate. + :vartype grain: float + :ivar grain_unit: The grain unit of the aggregate. + :vartype grain_unit: str + :ivar value: The aggregate value. + :vartype value: float + :ivar value_unit: The aggregate value unit. + :vartype value_unit: str + """ + + _validation = { + 'grain': {'readonly': True}, + 'grain_unit': {'readonly': True}, + 'value': {'readonly': True}, + 'value_unit': {'readonly': True}, + } + + _attribute_map = { + 'grain': {'key': 'grain', 'type': 'float'}, + 'grain_unit': {'key': 'grainUnit', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'float'}, + 'value_unit': {'key': 'valueUnit', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ReservationUtilizationAggregates, self).__init__(**kwargs) + self.grain = None + self.grain_unit = None + self.value = None + self.value_unit = None + + class ResourceName(msrest.serialization.Model): """Resource name provided by the resource provider. Use this property for quotaRequest parameter. Variables are only populated by the server, and will be ignored when sending a request. - :param value: Resource name. - :type value: str + :ivar value: Resource name. + :vartype value: str :ivar localized_value: Resource display localized name. :vartype localized_value: str """ @@ -2404,6 +3528,10 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword value: Resource name. + :paramtype value: str + """ super(ResourceName, self).__init__(**kwargs) self.value = value self.localized_value = None @@ -2412,10 +3540,10 @@ def __init__( class ScopeProperties(msrest.serialization.Model): """ScopeProperties. - :param scope: - :type scope: str - :param valid: - :type valid: bool + :ivar scope: + :vartype scope: str + :ivar valid: + :vartype valid: bool """ _attribute_map = { @@ -2430,6 +3558,12 @@ def __init__( valid: Optional[bool] = None, **kwargs ): + """ + :keyword scope: + :paramtype scope: str + :keyword valid: + :paramtype valid: bool + """ super(ScopeProperties, self).__init__(**kwargs) self.scope = scope self.valid = valid @@ -2440,10 +3574,10 @@ class ServiceError(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param code: The error code. - :type code: str - :param message: The error message text. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message text. + :vartype message: str :ivar details: The list of error details. :vartype details: list[~azure.mgmt.reservations.models.ServiceErrorDetail] """ @@ -2465,6 +3599,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message text. + :paramtype message: str + """ super(ServiceError, self).__init__(**kwargs) self.code = code self.message = message @@ -2496,16 +3636,50 @@ def __init__( self, **kwargs ): + """ + """ super(ServiceErrorDetail, self).__init__(**kwargs) self.code = None self.message = None +class SkuCapability(msrest.serialization.Model): + """SkuCapability. + + :ivar name: An invariant to describe the feature. + :vartype name: str + :ivar value: An invariant if the feature is measured by quantity. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword name: An invariant to describe the feature. + :paramtype name: str + :keyword value: An invariant if the feature is measured by quantity. + :paramtype value: str + """ + super(SkuCapability, self).__init__(**kwargs) + self.name = name + self.value = value + + class SkuName(msrest.serialization.Model): """SkuName. - :param name: - :type name: str + :ivar name: + :vartype name: str """ _attribute_map = { @@ -2518,6 +3692,10 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + """ super(SkuName, self).__init__(**kwargs) self.name = name @@ -2525,10 +3703,10 @@ def __init__( class SkuProperty(msrest.serialization.Model): """SkuProperty. - :param name: An invariant to describe the feature. - :type name: str - :param value: An invariant if the feature is measured by quantity. - :type value: str + :ivar name: An invariant to describe the feature. + :vartype name: str + :ivar value: An invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -2543,6 +3721,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: An invariant to describe the feature. + :paramtype name: str + :keyword value: An invariant if the feature is measured by quantity. + :paramtype value: str + """ super(SkuProperty, self).__init__(**kwargs) self.name = name self.value = value @@ -2551,13 +3735,13 @@ def __init__( class SkuRestriction(msrest.serialization.Model): """SkuRestriction. - :param type: The type of restrictions. - :type type: str - :param values: The value of restrictions. If the restriction type is set to location. This - would be different locations where the SKU is restricted. - :type values: list[str] - :param reason_code: The reason for restriction. - :type reason_code: str + :ivar type: The type of restrictions. + :vartype type: str + :ivar values: The value of restrictions. If the restriction type is set to location. This would + be different locations where the SKU is restricted. + :vartype values: list[str] + :ivar reason_code: The reason for restriction. + :vartype reason_code: str """ _attribute_map = { @@ -2574,6 +3758,15 @@ def __init__( reason_code: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of restrictions. + :paramtype type: str + :keyword values: The value of restrictions. If the restriction type is set to location. This + would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword reason_code: The reason for restriction. + :paramtype reason_code: str + """ super(SkuRestriction, self).__init__(**kwargs) self.type = type self.values = values @@ -2583,12 +3776,12 @@ def __init__( class SplitRequest(msrest.serialization.Model): """SplitRequest. - :param quantities: List of the quantities in the new reservations to create. - :type quantities: list[int] - :param reservation_id: Resource id of the reservation to be split. Format of the resource id + :ivar quantities: List of the quantities in the new reservations to create. + :vartype quantities: list[int] + :ivar reservation_id: Resource id of the reservation to be split. Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - :type reservation_id: str + :vartype reservation_id: str """ _attribute_map = { @@ -2603,6 +3796,14 @@ def __init__( reservation_id: Optional[str] = None, **kwargs ): + """ + :keyword quantities: List of the quantities in the new reservations to create. + :paramtype quantities: list[int] + :keyword reservation_id: Resource id of the reservation to be split. Format of the resource id + should be + /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :paramtype reservation_id: str + """ super(SplitRequest, self).__init__(**kwargs) self.quantities = quantities self.reservation_id = reservation_id @@ -2615,16 +3816,16 @@ class SubRequest(msrest.serialization.Model): :ivar limit: Quota (resource limit). :vartype limit: int - :param name: The resource name. - :type name: ~azure.mgmt.reservations.models.ResourceName + :ivar name: The resource name. + :vartype name: ~azure.mgmt.reservations.models.ResourceName :ivar resource_type: Resource type for which the quota check was made. :vartype resource_type: str - :param unit: The limit units, such as **count** and **bytes**. Use the unit field provided in + :ivar unit: The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota operation. - :type unit: str - :param provisioning_state: The quota request status. Possible values include: "Accepted", + :vartype unit: str + :ivar provisioning_state: The quota request status. Possible values include: "Accepted", "Invalid", "Succeeded", "Failed", "InProgress". - :type provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState + :vartype provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState :ivar message: User-friendly status message. :vartype message: str :ivar sub_request_id: Sub request ID for individual request. @@ -2656,6 +3857,16 @@ def __init__( provisioning_state: Optional[Union[str, "QuotaRequestState"]] = None, **kwargs ): + """ + :keyword name: The resource name. + :paramtype name: ~azure.mgmt.reservations.models.ResourceName + :keyword unit: The limit units, such as **count** and **bytes**. Use the unit field provided in + the response of the GET quota operation. + :paramtype unit: str + :keyword provisioning_state: The quota request status. Possible values include: "Accepted", + "Invalid", "Succeeded", "Failed", "InProgress". + :paramtype provisioning_state: str or ~azure.mgmt.reservations.models.QuotaRequestState + """ super(SubRequest, self).__init__(**kwargs) self.limit = None self.name = name @@ -2669,8 +3880,8 @@ def __init__( class SubscriptionScopeProperties(msrest.serialization.Model): """SubscriptionScopeProperties. - :param scopes: - :type scopes: list[~azure.mgmt.reservations.models.ScopeProperties] + :ivar scopes: + :vartype scopes: list[~azure.mgmt.reservations.models.ScopeProperties] """ _attribute_map = { @@ -2683,5 +3894,73 @@ def __init__( scopes: Optional[List["ScopeProperties"]] = None, **kwargs ): + """ + :keyword scopes: + :paramtype scopes: list[~azure.mgmt.reservations.models.ScopeProperties] + """ super(SubscriptionScopeProperties, self).__init__(**kwargs) self.scopes = scopes + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.reservations.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.reservations.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.reservations.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.reservations.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at 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 01b79fad9a728..ecf6800a6481c 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 @@ -5,34 +5,106 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_catalog_request( + subscription_id: str, + *, + reserved_resource_type: Optional[str] = None, + location: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if reserved_resource_type is not None: + query_parameters['reservedResourceType'] = _SERIALIZER.query("reserved_resource_type", reserved_resource_type, 'str') + if location is not None: + query_parameters['location'] = _SERIALIZER.query("location", location, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_applied_reservation_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AzureReservationAPIOperationsMixin(object): + @distributed_trace def get_catalog( self, - subscription_id, # type: str - reserved_resource_type, # type: str - location=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> List["_models.Catalog"] - """Get the regions and skus that are available for RI purchase for the specified Azure subscription. + subscription_id: str, + reserved_resource_type: Optional[str] = None, + location: Optional[str] = None, + **kwargs: Any + ) -> List["_models.Catalog"]: + """Get the regions and skus that are available for RI purchase for the specified Azure + subscription. Get the regions and skus that are available for RI purchase for the specified Azure subscription. @@ -54,34 +126,23 @@ def get_catalog( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - # Construct URL - url = self.get_catalog.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + + request = build_get_catalog_request( + subscription_id=subscription_id, + reserved_resource_type=reserved_resource_type, + location=location, + template_url=self.get_catalog.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['reservedResourceType'] = self._serialize.query("reserved_resource_type", reserved_resource_type, 'str') - if location is not None: - query_parameters['location'] = self._serialize.query("location", location, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[Catalog]', pipeline_response) @@ -90,14 +151,16 @@ def get_catalog( return cls(pipeline_response, deserialized, {}) return deserialized + get_catalog.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs'} # type: ignore + + @distributed_trace def get_applied_reservation_list( self, - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AppliedReservations" + subscription_id: str, + **kwargs: Any + ) -> "_models.AppliedReservations": """Get list of applicable ``Reservation``\ s. Get applicable ``Reservation``\ s that are applied to this subscription or a resource group @@ -115,31 +178,21 @@ def get_applied_reservation_list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_applied_reservation_list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_applied_reservation_list_request( + subscription_id=subscription_id, + template_url=self.get_applied_reservation_list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AppliedReservations', pipeline_response) @@ -148,4 +201,6 @@ def get_applied_reservation_list( return cls(pipeline_response, deserialized, {}) return deserialized + get_applied_reservation_list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations'} # type: ignore + 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 dfe26fcffad80..d08dc3a61fd31 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 @@ -5,24 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_post_request_initial( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/calculateExchange') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class CalculateExchangeOperations(object): """CalculateExchangeOperations operations. @@ -48,45 +85,36 @@ def __init__(self, client, config, serializer, deserializer): def _post_initial( self, - body, # type: "_models.CalculateExchangeRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.CalculateExchangeOperationResultResponse"] + body: "_models.CalculateExchangeRequest", + **kwargs: Any + ) -> Optional["_models.CalculateExchangeOperationResultResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CalculateExchangeOperationResultResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._post_initial.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'CalculateExchangeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'CalculateExchangeRequest') + + request = build_post_request_initial( + content_type=content_type, + json=_json, + template_url=self._post_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('CalculateExchangeOperationResultResponse', pipeline_response) @@ -94,19 +122,22 @@ def _post_initial( response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _post_initial.metadata = {'url': '/providers/Microsoft.Capacity/calculateExchange'} # type: ignore + + @distributed_trace def begin_post( self, - body, # type: "_models.CalculateExchangeRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CalculateExchangeOperationResultResponse"] + body: "_models.CalculateExchangeRequest", + **kwargs: Any + ) -> LROPoller["_models.CalculateExchangeOperationResultResponse"]: """Calculates the refund amounts and price of the new purchases. Calculates price for exchanging ``Reservations`` if there are no policy errors. @@ -115,15 +146,20 @@ def begin_post( :type body: ~azure.mgmt.reservations.models.CalculateExchangeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :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 CalculateExchangeOperationResultResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.CalculateExchangeOperationResultResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 CalculateExchangeOperationResultResponse + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.CalculateExchangeOperationResultResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CalculateExchangeOperationResultResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -133,21 +169,21 @@ def begin_post( if cont_token is None: raw_result = self._post_initial( body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CalculateExchangeOperationResultResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -159,4 +195,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post.metadata = {'url': '/providers/Microsoft.Capacity/calculateExchange'} # type: ignore 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 ee839067fea04..09aeb7289141c 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 @@ -5,24 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_post_request_initial( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/exchange') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ExchangeOperations(object): """ExchangeOperations operations. @@ -48,45 +85,36 @@ def __init__(self, client, config, serializer, deserializer): def _post_initial( self, - body, # type: "_models.ExchangeRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ExchangeOperationResultResponse"] + body: "_models.ExchangeRequest", + **kwargs: Any + ) -> Optional["_models.ExchangeOperationResultResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ExchangeOperationResultResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._post_initial.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'ExchangeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'ExchangeRequest') + + request = build_post_request_initial( + content_type=content_type, + json=_json, + template_url=self._post_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('ExchangeOperationResultResponse', pipeline_response) @@ -94,19 +122,22 @@ def _post_initial( response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _post_initial.metadata = {'url': '/providers/Microsoft.Capacity/exchange'} # type: ignore + + @distributed_trace def begin_post( self, - body, # type: "_models.ExchangeRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ExchangeOperationResultResponse"] + body: "_models.ExchangeRequest", + **kwargs: Any + ) -> LROPoller["_models.ExchangeOperationResultResponse"]: """Exchange Reservation(s). Returns one or more ``Reservations`` in exchange for one or more ``Reservation`` purchases. @@ -115,15 +146,20 @@ def begin_post( :type body: ~azure.mgmt.reservations.models.ExchangeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :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 ExchangeOperationResultResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.ExchangeOperationResultResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 ExchangeOperationResultResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.ExchangeOperationResultResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExchangeOperationResultResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -133,21 +169,21 @@ def begin_post( if cont_token is None: raw_result = self._post_initial( body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExchangeOperationResultResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -159,4 +195,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post.metadata = {'url': '/providers/Microsoft.Capacity/exchange'} # type: ignore 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 52d75e01f0ac8..f35c567107b98 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 @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationOperations(object): """OperationOperations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationList"] + **kwargs: Any + ) -> Iterable["_models.OperationList"]: """Get operations. List all the operations. @@ -64,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,12 +124,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) 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) return pipeline_response + return ItemPaged( get_next, extract_data ) 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 3184a6dbca573..565e7f8b767cb 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 @@ -5,25 +5,192 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + provider_id: str, + location: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "providerId": _SERIALIZER.url("provider_id", provider_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + provider_id: str, + location: str, + resource_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "providerId": _SERIALIZER.url("provider_id", provider_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + provider_id: str, + location: str, + resource_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "providerId": _SERIALIZER.url("provider_id", provider_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + provider_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "providerId": _SERIALIZER.url("provider_id", provider_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class QuotaOperations(object): """QuotaOperations operations. @@ -47,15 +214,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - subscription_id, # type: str - provider_id, # type: str - location, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CurrentQuotaLimitBase" + subscription_id: str, + provider_id: str, + location: str, + resource_name: str, + **kwargs: Any + ) -> "_models.CurrentQuotaLimitBase": """Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. @@ -78,95 +245,76 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + resource_name=resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'} # type: ignore + def _create_or_update_initial( self, - subscription_id, # type: str - provider_id, # type: str - location, # type: str - resource_name, # type: str - create_quota_request, # type: "_models.CurrentQuotaLimitBase" - **kwargs # type: Any - ): - # type: (...) -> Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"] + subscription_id: str, + provider_id: str, + location: str, + resource_name: str, + create_quota_request: "_models.CurrentQuotaLimitBase", + **kwargs: Any + ) -> Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]: cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') + + request = build_create_or_update_request_initial( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + resource_name=resource_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('QuotaRequestOneResourceSubmitResponse', pipeline_response) @@ -178,18 +326,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - subscription_id, # type: str - provider_id, # type: str - location, # type: str - resource_name, # type: str - create_quota_request, # type: "_models.CurrentQuotaLimitBase" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]] + subscription_id: str, + provider_id: str, + location: str, + resource_name: str, + create_quota_request: "_models.CurrentQuotaLimitBase", + **kwargs: Any + ) -> LROPoller[Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]]: """Create or update the quota (service limits) of a resource to the requested value. Steps: @@ -218,15 +368,21 @@ def begin_create_or_update( :type create_quota_request: ~azure.mgmt.reservations.models.CurrentQuotaLimitBase :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :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 QuotaRequestOneResourceSubmitResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.QuotaRequestOneResourceSubmitResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 QuotaRequestOneResourceSubmitResponse or + QuotaRequestSubmitResponse201 or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.QuotaRequestOneResourceSubmitResponse + or ~azure.mgmt.reservations.models.QuotaRequestSubmitResponse201] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]] lro_delay = kwargs.pop( 'polling_interval', @@ -240,28 +396,21 @@ def begin_create_or_update( location=location, resource_name=resource_name, create_quota_request=create_quota_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('QuotaRequestOneResourceSubmitResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -273,57 +422,46 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'} # type: ignore def _update_initial( self, - subscription_id, # type: str - provider_id, # type: str - location, # type: str - resource_name, # type: str - create_quota_request, # type: "_models.CurrentQuotaLimitBase" - **kwargs # type: Any - ): - # type: (...) -> Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"] + subscription_id: str, + provider_id: str, + location: str, + resource_name: str, + create_quota_request: "_models.CurrentQuotaLimitBase", + **kwargs: Any + ) -> Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]: cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') + + request = build_update_request_initial( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + resource_name=resource_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('QuotaRequestOneResourceSubmitResponse', pipeline_response) @@ -335,18 +473,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'} # type: ignore + + @distributed_trace def begin_update( self, - subscription_id, # type: str - provider_id, # type: str - location, # type: str - resource_name, # type: str - create_quota_request, # type: "_models.CurrentQuotaLimitBase" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]] + subscription_id: str, + provider_id: str, + location: str, + resource_name: str, + create_quota_request: "_models.CurrentQuotaLimitBase", + **kwargs: Any + ) -> LROPoller[Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]]: """Update the quota (service limits) of this resource to the requested value. • To get the quota information for specific resource, send a GET request. @@ -370,15 +510,21 @@ def begin_update( :type create_quota_request: ~azure.mgmt.reservations.models.CurrentQuotaLimitBase :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :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 QuotaRequestOneResourceSubmitResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.QuotaRequestOneResourceSubmitResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :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 QuotaRequestOneResourceSubmitResponse or + QuotaRequestSubmitResponse201 or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.QuotaRequestOneResourceSubmitResponse + or ~azure.mgmt.reservations.models.QuotaRequestSubmitResponse201] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.QuotaRequestOneResourceSubmitResponse", "_models.QuotaRequestSubmitResponse201"]] lro_delay = kwargs.pop( 'polling_interval', @@ -392,28 +538,21 @@ def begin_update( location=location, resource_name=resource_name, create_quota_request=create_quota_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('QuotaRequestOneResourceSubmitResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -425,16 +564,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'} # type: ignore + @distributed_trace def list( self, - subscription_id, # type: str - provider_id, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.QuotaLimits"] + subscription_id: str, + provider_id: str, + location: str, + **kwargs: Any + ) -> Iterable["_models.QuotaLimits"]: """Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. @@ -454,36 +594,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('QuotaLimits', pipeline_response) + deserialized = self._deserialize("QuotaLimits", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,12 +633,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) 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 f602094b7489a..7747247b3e080 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 @@ -5,23 +5,107 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + provider_id: str, + location: str, + id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "providerId": _SERIALIZER.url("provider_id", provider_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "id": _SERIALIZER.url("id", id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + provider_id: str, + location: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skiptoken: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-25" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "providerId": _SERIALIZER.url("provider_id", provider_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skiptoken is not None: + query_parameters['$skiptoken'] = _SERIALIZER.query("skiptoken", skiptoken, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class QuotaRequestStatusOperations(object): """QuotaRequestStatusOperations operations. @@ -45,15 +129,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - subscription_id, # type: str - provider_id, # type: str - location, # type: str - id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.QuotaRequestDetails" + subscription_id: str, + provider_id: str, + location: str, + id: str, + **kwargs: Any + ) -> "_models.QuotaRequestDetails": """For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. @@ -76,34 +160,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'id': self._serialize.url("id", id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + id=id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QuotaRequestDetails', pipeline_response) @@ -112,19 +186,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id}'} # type: ignore + + @distributed_trace def list( self, - subscription_id, # type: str - provider_id, # type: str - location, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - skiptoken=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.QuotaRequestDetailsList"] + subscription_id: str, + provider_id: str, + location: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skiptoken: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.QuotaRequestDetailsList"]: """For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. @@ -152,7 +228,8 @@ def list( skiptoken parameter that specifies a starting point to use for subsequent calls. :type skiptoken: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either QuotaRequestDetailsList or the result of cls(response) + :return: An iterator like instance of either QuotaRequestDetailsList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.reservations.models.QuotaRequestDetailsList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -161,42 +238,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-25" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - 'providerId': self._serialize.url("provider_id", provider_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + filter=filter, + top=top, + skiptoken=skiptoken, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=subscription_id, + provider_id=provider_id, + location=location, + filter=filter, + top=top, + skiptoken=skiptoken, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('QuotaRequestDetailsList', pipeline_response) + deserialized = self._deserialize("QuotaRequestDetailsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -209,12 +283,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ExceptionResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) 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 df30d195067d2..09cce1e1ddbe3 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 @@ -5,25 +5,337 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_available_scopes_request_initial( + reservation_order_id: str, + reservation_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes') + path_format_arguments = { + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, 'str'), + "reservationId": _SERIALIZER.url("reservation_id", reservation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_split_request_initial( + reservation_order_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split') + path_format_arguments = { + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_merge_request_initial( + reservation_order_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge') + path_format_arguments = { + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + reservation_order_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations') + path_format_arguments = { + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + reservation_id: str, + reservation_order_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}') + path_format_arguments = { + "reservationId": _SERIALIZER.url("reservation_id", reservation_id, 'str'), + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + reservation_order_id: str, + reservation_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}') + path_format_arguments = { + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, 'str'), + "reservationId": _SERIALIZER.url("reservation_id", reservation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_revisions_request( + reservation_id: str, + reservation_order_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions') + path_format_arguments = { + "reservationId": _SERIALIZER.url("reservation_id", reservation_id, 'str'), + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + *, + filter: Optional[str] = None, + orderby: Optional[str] = None, + refresh_summary: Optional[str] = None, + skiptoken: Optional[float] = None, + selected_state: Optional[str] = None, + take: Optional[float] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + if refresh_summary is not None: + query_parameters['refreshSummary'] = _SERIALIZER.query("refresh_summary", refresh_summary, 'str') + if skiptoken is not None: + query_parameters['$skiptoken'] = _SERIALIZER.query("skiptoken", skiptoken, 'float') + if selected_state is not None: + query_parameters['selectedState'] = _SERIALIZER.query("selected_state", selected_state, 'str') + if take is not None: + query_parameters['take'] = _SERIALIZER.query("take", take, 'float') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ReservationOperations(object): """ReservationOperations operations. @@ -49,49 +361,37 @@ def __init__(self, client, config, serializer, deserializer): def _available_scopes_initial( self, - reservation_order_id, # type: str - reservation_id, # type: str - body, # type: "_models.AvailableScopeRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableScopeProperties" + reservation_order_id: str, + reservation_id: str, + body: "_models.AvailableScopeRequest", + **kwargs: Any + ) -> "_models.AvailableScopeProperties": cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableScopeProperties"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._available_scopes_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'AvailableScopeRequest') + + request = build_available_scopes_request_initial( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + content_type=content_type, + json=_json, + template_url=self._available_scopes_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'AvailableScopeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('AvailableScopeProperties', pipeline_response) @@ -99,16 +399,18 @@ def _available_scopes_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _available_scopes_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes'} # type: ignore + + @distributed_trace def begin_available_scopes( self, - reservation_order_id, # type: str - reservation_id, # type: str - body, # type: "_models.AvailableScopeRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AvailableScopeProperties"] + reservation_order_id: str, + reservation_id: str, + body: "_models.AvailableScopeRequest", + **kwargs: Any + ) -> LROPoller["_models.AvailableScopeProperties"]: """Get Available Scopes for ``Reservation``. Get Available Scopes for ``Reservation``. @@ -121,15 +423,19 @@ def begin_available_scopes( :type body: ~azure.mgmt.reservations.models.AvailableScopeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :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 AvailableScopeProperties or the result of cls(response) + :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 AvailableScopeProperties or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.AvailableScopeProperties] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableScopeProperties"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,26 +447,21 @@ def begin_available_scopes( reservation_order_id=reservation_order_id, reservation_id=reservation_id, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AvailableScopeProperties', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -172,51 +473,40 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_available_scopes.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes'} # type: ignore def _split_initial( self, - reservation_order_id, # type: str - body, # type: "_models.SplitRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional[List["_models.ReservationResponse"]] + reservation_order_id: str, + body: "_models.SplitRequest", + **kwargs: Any + ) -> Optional[List["_models.ReservationResponse"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["_models.ReservationResponse"]]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._split_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'SplitRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_split_request_initial( + reservation_order_id=reservation_order_id, + content_type=content_type, + json=_json, + template_url=self._split_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'SplitRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -226,15 +516,17 @@ def _split_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _split_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split'} # type: ignore + + @distributed_trace def begin_split( self, - reservation_order_id, # type: str - body, # type: "_models.SplitRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[List["_models.ReservationResponse"]] + reservation_order_id: str, + body: "_models.SplitRequest", + **kwargs: Any + ) -> LROPoller[List["_models.ReservationResponse"]]: """Split the ``Reservation``. Split a ``Reservation`` into two ``Reservation``\ s with specified quantity distribution. @@ -245,15 +537,20 @@ def begin_split( :type body: ~azure.mgmt.reservations.models.SplitRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :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 list of ReservationResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[list[~azure.mgmt.reservations.models.ReservationResponse]] - :raises ~azure.core.exceptions.HttpResponseError: + :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 list of ReservationResponse or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[list[~azure.mgmt.reservations.models.ReservationResponse]] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ReservationResponse"]] lro_delay = kwargs.pop( 'polling_interval', @@ -264,25 +561,21 @@ def begin_split( raw_result = self._split_initial( reservation_order_id=reservation_order_id, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('[ReservationResponse]', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -294,51 +587,40 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_split.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split'} # type: ignore def _merge_initial( self, - reservation_order_id, # type: str - body, # type: "_models.MergeRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional[List["_models.ReservationResponse"]] + reservation_order_id: str, + body: "_models.MergeRequest", + **kwargs: Any + ) -> Optional[List["_models.ReservationResponse"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["_models.ReservationResponse"]]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._merge_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'MergeRequest') + + request = build_merge_request_initial( + reservation_order_id=reservation_order_id, + content_type=content_type, + json=_json, + template_url=self._merge_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'MergeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -348,15 +630,17 @@ def _merge_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _merge_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge'} # type: ignore + + @distributed_trace def begin_merge( self, - reservation_order_id, # type: str - body, # type: "_models.MergeRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[List["_models.ReservationResponse"]] + reservation_order_id: str, + body: "_models.MergeRequest", + **kwargs: Any + ) -> LROPoller[List["_models.ReservationResponse"]]: """Merges two ``Reservation``\ s. Merge the specified ``Reservation``\ s into a new ``Reservation``. The two ``Reservation``\ s @@ -368,15 +652,20 @@ def begin_merge( :type body: ~azure.mgmt.reservations.models.MergeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :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 list of ReservationResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[list[~azure.mgmt.reservations.models.ReservationResponse]] - :raises ~azure.core.exceptions.HttpResponseError: + :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 list of ReservationResponse or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[list[~azure.mgmt.reservations.models.ReservationResponse]] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ReservationResponse"]] lro_delay = kwargs.pop( 'polling_interval', @@ -387,25 +676,21 @@ def begin_merge( raw_result = self._merge_initial( reservation_order_id=reservation_order_id, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('[ReservationResponse]', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -417,14 +702,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_merge.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge'} # type: ignore + @distributed_trace def list( self, - reservation_order_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReservationList"] + reservation_order_id: str, + **kwargs: Any + ) -> Iterable["_models.ReservationList"]: """Get ``Reservation``\ s in a given reservation Order. List ``Reservation``\ s within a single ``ReservationOrder``. @@ -441,34 +727,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + reservation_order_id=reservation_order_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + reservation_order_id=reservation_order_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReservationList', pipeline_response) + deserialized = self._deserialize("ReservationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -481,25 +762,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) 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) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations'} # type: ignore + @distributed_trace def get( self, - reservation_id, # type: str - reservation_order_id, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ReservationResponse" + reservation_id: str, + reservation_order_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.ReservationResponse": """Get ``Reservation`` details. Get specific ``Reservation`` details. @@ -520,34 +802,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['expand'] = self._serialize.query("expand", expand, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + reservation_id=reservation_id, + reservation_order_id=reservation_order_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ReservationResponse', pipeline_response) @@ -556,53 +827,43 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'} # type: ignore + def _update_initial( self, - reservation_order_id, # type: str - reservation_id, # type: str - parameters, # type: "_models.Patch" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReservationResponse"] + reservation_order_id: str, + reservation_id: str, + parameters: "_models.Patch", + **kwargs: Any + ) -> Optional["_models.ReservationResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReservationResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Patch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Patch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -612,16 +873,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'} # type: ignore + + @distributed_trace def begin_update( self, - reservation_order_id, # type: str - reservation_id, # type: str - parameters, # type: "_models.Patch" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReservationResponse"] + reservation_order_id: str, + reservation_id: str, + parameters: "_models.Patch", + **kwargs: Any + ) -> LROPoller["_models.ReservationResponse"]: """Updates a ``Reservation``. Updates the applied scopes of the ``Reservation``. @@ -634,15 +897,19 @@ def begin_update( :type parameters: ~azure.mgmt.reservations.models.Patch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :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 ReservationResponse or the result of cls(response) + :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 ReservationResponse or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.ReservationResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -654,26 +921,21 @@ def begin_update( reservation_order_id=reservation_order_id, reservation_id=reservation_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ReservationResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -685,15 +947,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'} # type: ignore + @distributed_trace def list_revisions( self, - reservation_id, # type: str - reservation_order_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReservationList"] + reservation_id: str, + reservation_order_id: str, + **kwargs: Any + ) -> Iterable["_models.ReservationList"]: """Get ``Reservation`` revisions. List of all the revisions for the ``Reservation``. @@ -712,35 +975,31 @@ def list_revisions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_revisions.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'), - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_revisions_request( + reservation_id=reservation_id, + reservation_order_id=reservation_order_id, + template_url=self.list_revisions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_revisions_request( + reservation_id=reservation_id, + reservation_order_id=reservation_order_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReservationList', pipeline_response) + deserialized = self._deserialize("ReservationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -753,13 +1012,113 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) 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) return pipeline_response + return ItemPaged( get_next, extract_data ) list_revisions.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions'} # type: ignore + + @distributed_trace + def list_all( + self, + filter: Optional[str] = None, + orderby: Optional[str] = None, + refresh_summary: Optional[str] = None, + skiptoken: Optional[float] = None, + selected_state: Optional[str] = None, + take: Optional[float] = None, + **kwargs: Any + ) -> Iterable["_models.ReservationsListResult"]: + """List the reservations and the roll up counts of reservations group by provisioning states that + the user has access to in the current tenant. + + :param filter: May be used to filter by reservation properties. The filter supports 'eq', 'or', + and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation + properties include sku/name, properties/{appliedScopeType, archived, displayName, + displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, + reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState}. + :type filter: str + :param orderby: May be used to sort order by reservation properties. + :type orderby: str + :param refresh_summary: To indicate whether to refresh the roll up counts of the reservations + group by provisioning states. + :type refresh_summary: str + :param skiptoken: The number of reservations to skip from the list before returning results. + :type skiptoken: float + :param selected_state: The selected provisioning state. + :type selected_state: str + :param take: To number of reservations to return. + :type take: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ReservationsListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.reservations.models.ReservationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_all_request( + filter=filter, + orderby=orderby, + refresh_summary=refresh_summary, + skiptoken=skiptoken, + selected_state=selected_state, + take=take, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_all_request( + filter=filter, + orderby=orderby, + refresh_summary=refresh_summary, + skiptoken=skiptoken, + selected_state=selected_state, + take=take, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ReservationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/providers/Microsoft.Capacity/reservations'} # type: ignore 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 c4d0104a11eb8..e0509f6ce6658 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 @@ -5,25 +5,202 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_calculate_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/calculatePrice') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purchase_request_initial( + reservation_order_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}') + path_format_arguments = { + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + reservation_order_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}') + path_format_arguments = { + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_change_directory_request( + reservation_order_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/changeDirectory') + path_format_arguments = { + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ReservationOrderOperations(object): """ReservationOrderOperations operations. @@ -47,12 +224,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def calculate( self, - body, # type: "_models.PurchaseRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CalculatePriceResponse" + body: "_models.PurchaseRequest", + **kwargs: Any + ) -> "_models.CalculatePriceResponse": """Calculate price for a ``ReservationOrder``. Calculate price for placing a ``ReservationOrder``. @@ -69,32 +246,25 @@ def calculate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.calculate.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'PurchaseRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'PurchaseRequest') + + request = build_calculate_request( + content_type=content_type, + json=_json, + template_url=self.calculate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CalculatePriceResponse', pipeline_response) @@ -103,19 +273,22 @@ def calculate( return cls(pipeline_response, deserialized, {}) return deserialized + calculate.metadata = {'url': '/providers/Microsoft.Capacity/calculatePrice'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReservationOrderList"] + **kwargs: Any + ) -> Iterable["_models.ReservationOrderList"]: """Get all ``ReservationOrder``\ s. List of all the ``ReservationOrder``\ s that the user has access to in the current tenant. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReservationOrderList or the result of cls(response) + :return: An iterator like instance of either ReservationOrderList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.reservations.models.ReservationOrderList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -124,30 +297,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReservationOrderList', pipeline_response) + deserialized = self._deserialize("ReservationOrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -160,12 +330,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) 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) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -173,47 +344,35 @@ def get_next(next_link=None): def _purchase_initial( self, - reservation_order_id, # type: str - body, # type: "_models.PurchaseRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.ReservationOrderResponse" + reservation_order_id: str, + body: "_models.PurchaseRequest", + **kwargs: Any + ) -> "_models.ReservationOrderResponse": cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationOrderResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._purchase_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'PurchaseRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_purchase_request_initial( + reservation_order_id=reservation_order_id, + content_type=content_type, + json=_json, + template_url=self._purchase_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'PurchaseRequest') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ReservationOrderResponse', pipeline_response) @@ -225,15 +384,17 @@ def _purchase_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _purchase_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'} # type: ignore + + @distributed_trace def begin_purchase( self, - reservation_order_id, # type: str - body, # type: "_models.PurchaseRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReservationOrderResponse"] + reservation_order_id: str, + body: "_models.PurchaseRequest", + **kwargs: Any + ) -> LROPoller["_models.ReservationOrderResponse"]: """Purchase ``ReservationOrder``. Purchase ``ReservationOrder`` and create resource under the specified URI. @@ -244,15 +405,19 @@ def begin_purchase( :type body: ~azure.mgmt.reservations.models.PurchaseRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :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 ReservationOrderResponse or the result of cls(response) + :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 ReservationOrderResponse or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.reservations.models.ReservationOrderResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationOrderResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,25 +428,21 @@ def begin_purchase( raw_result = self._purchase_initial( reservation_order_id=reservation_order_id, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ReservationOrderResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -293,15 +454,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purchase.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'} # type: ignore + @distributed_trace def get( self, - reservation_order_id, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.ReservationOrderResponse" + reservation_order_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> "_models.ReservationOrderResponse": """Get a specific ``ReservationOrder``. Get the details of the ``ReservationOrder``. @@ -320,39 +482,88 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), + + request = build_get_request( + reservation_order_id=reservation_order_id, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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) + + deserialized = self._deserialize('ReservationOrderResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'} # type: ignore + + + @distributed_trace + def change_directory( + self, + reservation_order_id: str, + body: "_models.ChangeDirectoryRequest", + **kwargs: Any + ) -> "_models.ChangeDirectoryResponse": + """Change directory of ``ReservationOrder``. + + Change directory (tenant) of ``ReservationOrder`` and all ``Reservation`` under it to specified + tenant id. + + :param reservation_order_id: Order Id of the reservation. + :type reservation_order_id: str + :param body: Information needed to change directory of reservation order. + :type body: ~azure.mgmt.reservations.models.ChangeDirectoryRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ChangeDirectoryResponse, or the result of cls(response) + :rtype: ~azure.mgmt.reservations.models.ChangeDirectoryResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ChangeDirectoryResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + _json = self._serialize.body(body, 'ChangeDirectoryRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_change_directory_request( + reservation_order_id=reservation_order_id, + content_type=content_type, + json=_json, + template_url=self.change_directory.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ReservationOrderResponse', pipeline_response) + deserialized = self._deserialize('ChangeDirectoryResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'} # type: ignore + + change_directory.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/changeDirectory'} # type: ignore +