From 2490dd3cf7f893cac141989435b5ac6d0061cbec Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 30 Oct 2020 00:18:40 +0000 Subject: [PATCH] Generated from f6af6522204bb7f63ab95236eb2ab47ba8cc2c3f --- .../reservations/_azure_reservation_api.py | 10 + .../mgmt/reservations/models/__init__.py | 90 ++- .../models/_azure_reservation_api_enums.py | 101 ++-- .../azure/mgmt/reservations/models/_models.py | 519 +++++++++++++++++- .../mgmt/reservations/models/_models_py3.py | 519 +++++++++++++++++- .../mgmt/reservations/operations/__init__.py | 4 + .../_azure_reservation_api_operations.py | 4 +- .../_calculate_exchange_operations.py | 148 +++++ .../operations/_exchange_operations.py | 147 +++++ .../operations/_operation_operations.py | 4 +- .../operations/_reservation_operations.py | 32 +- .../_reservation_order_operations.py | 4 +- .../azure-mgmt-reservations/setup.py | 2 +- 13 files changed, 1474 insertions(+), 110 deletions(-) create mode 100644 sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_exchange_operations.py create mode 100644 sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_exchange_operations.py 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 174cb5eeba4..da6bf0b9051 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 @@ -20,6 +20,8 @@ from .operations import ReservationOperations from .operations import ReservationOrderOperations from .operations import OperationOperations +from .operations import CalculateExchangeOperations +from .operations import ExchangeOperations from . import models @@ -41,6 +43,10 @@ class AzureReservationAPI(AzureReservationAPIOperationsMixin, SDKClient): :vartype reservation_order: azure.mgmt.reservations.operations.ReservationOrderOperations :ivar operation: Operation operations :vartype operation: azure.mgmt.reservations.operations.OperationOperations + :ivar calculate_exchange: CalculateExchange operations + :vartype calculate_exchange: azure.mgmt.reservations.operations.CalculateExchangeOperations + :ivar exchange: Exchange operations + :vartype exchange: azure.mgmt.reservations.operations.ExchangeOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -70,3 +76,7 @@ def __init__( 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) 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 c272e08f0df..cfac82a9880 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 @@ -15,6 +15,14 @@ from ._models_py3 import AppliedReservations from ._models_py3 import AqiSettings from ._models_py3 import AutoQuotaIncreaseDetail + 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 @@ -27,17 +35,23 @@ from ._models_py3 import EmailActions from ._models_py3 import Error, ErrorException from ._models_py3 import ExceptionResponse, ExceptionResponseException + 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 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 PhoneAction from ._models_py3 import Price - from ._models_py3 import Properties from ._models_py3 import PurchaseRequest from ._models_py3 import PurchaseRequestPropertiesReservedResourceProperties from ._models_py3 import QuotaLimitsResponse @@ -56,7 +70,13 @@ 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 ResourceName + from ._models_py3 import ReturnRequest + from ._models_py3 import ReturnRequestProperties from ._models_py3 import ScopeProperties from ._models_py3 import ServiceError from ._models_py3 import ServiceErrorDetail @@ -73,6 +93,14 @@ from ._models import AppliedReservations from ._models import AqiSettings from ._models import AutoQuotaIncreaseDetail + from ._models import AvailableScopeProperties + from ._models import AvailableScopeRequest + from ._models import AvailableScopeRequestProperties + from ._models import BillingInformation + from ._models import CalculateExchangeOperationResultResponse + from ._models import CalculateExchangeRequest + from ._models import CalculateExchangeRequestProperties + from ._models import CalculateExchangeResponseProperties from ._models import CalculatePriceResponse from ._models import CalculatePriceResponseProperties from ._models import CalculatePriceResponsePropertiesBillingCurrencyTotal @@ -85,17 +113,23 @@ from ._models import EmailActions from ._models import Error, ErrorException from ._models import ExceptionResponse, ExceptionResponseException + from ._models import ExchangeOperationResultResponse + from ._models import ExchangePolicyError + from ._models import ExchangePolicyErrors + from ._models import ExchangeRequest + from ._models import ExchangeRequestProperties + from ._models import ExchangeResponseProperties from ._models import ExtendedErrorInfo from ._models import ExtendedStatusInfo from ._models import MergeRequest from ._models import OperationDisplay from ._models import OperationResponse + from ._models import OperationResultError from ._models import Patch from ._models import PatchPropertiesRenewProperties from ._models import PaymentDetail from ._models import PhoneAction from ._models import Price - from ._models import Properties from ._models import PurchaseRequest from ._models import PurchaseRequestPropertiesReservedResourceProperties from ._models import QuotaLimitsResponse @@ -114,7 +148,13 @@ from ._models import ReservationProperties from ._models import ReservationResponse from ._models import ReservationSplitProperties + from ._models import ReservationToExchange + from ._models import ReservationToPurchaseCalculateExchange + from ._models import ReservationToPurchaseExchange + from ._models import ReservationToReturn from ._models import ResourceName + from ._models import ReturnRequest + from ._models import ReturnRequestProperties from ._models import ScopeProperties from ._models import ServiceError from ._models import ServiceErrorDetail @@ -131,14 +171,16 @@ from ._paged_models import ReservationOrderResponsePaged from ._paged_models import ReservationResponsePaged from ._azure_reservation_api_enums import ( + ReservedResourceType, + ReservationTerm, + ReservationBillingPlan, + AppliedScopeType, + InstanceFlexibility, ReservationStatusCode, ErrorResponseCode, - ReservationBillingPlan, - ReservationTerm, + CalculateExchangeOperationResultStatus, + ExchangeOperationResultStatus, PaymentStatus, - ReservedResourceType, - InstanceFlexibility, - AppliedScopeType, ) __all__ = [ @@ -147,6 +189,14 @@ 'AppliedReservations', 'AqiSettings', 'AutoQuotaIncreaseDetail', + 'AvailableScopeProperties', + 'AvailableScopeRequest', + 'AvailableScopeRequestProperties', + 'BillingInformation', + 'CalculateExchangeOperationResultResponse', + 'CalculateExchangeRequest', + 'CalculateExchangeRequestProperties', + 'CalculateExchangeResponseProperties', 'CalculatePriceResponse', 'CalculatePriceResponseProperties', 'CalculatePriceResponsePropertiesBillingCurrencyTotal', @@ -159,17 +209,23 @@ 'EmailActions', 'Error', 'ErrorException', 'ExceptionResponse', 'ExceptionResponseException', + 'ExchangeOperationResultResponse', + 'ExchangePolicyError', + 'ExchangePolicyErrors', + 'ExchangeRequest', + 'ExchangeRequestProperties', + 'ExchangeResponseProperties', 'ExtendedErrorInfo', 'ExtendedStatusInfo', 'MergeRequest', 'OperationDisplay', 'OperationResponse', + 'OperationResultError', 'Patch', 'PatchPropertiesRenewProperties', 'PaymentDetail', 'PhoneAction', 'Price', - 'Properties', 'PurchaseRequest', 'PurchaseRequestPropertiesReservedResourceProperties', 'QuotaLimitsResponse', @@ -188,7 +244,13 @@ 'ReservationProperties', 'ReservationResponse', 'ReservationSplitProperties', + 'ReservationToExchange', + 'ReservationToPurchaseCalculateExchange', + 'ReservationToPurchaseExchange', + 'ReservationToReturn', 'ResourceName', + 'ReturnRequest', + 'ReturnRequestProperties', 'ScopeProperties', 'ServiceError', 'ServiceErrorDetail', @@ -204,12 +266,14 @@ 'ReservationResponsePaged', 'ReservationOrderResponsePaged', 'OperationResponsePaged', + 'ReservedResourceType', + 'ReservationTerm', + 'ReservationBillingPlan', + 'AppliedScopeType', + 'InstanceFlexibility', 'ReservationStatusCode', 'ErrorResponseCode', - 'ReservationBillingPlan', - 'ReservationTerm', + 'CalculateExchangeOperationResultStatus', + 'ExchangeOperationResultStatus', 'PaymentStatus', - 'ReservedResourceType', - 'InstanceFlexibility', - 'AppliedScopeType', ] 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 99f064c808c..e932f26826e 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 @@ -12,6 +12,54 @@ from enum import Enum +class ReservedResourceType(str, Enum): + + virtual_machines = "VirtualMachines" + sql_databases = "SqlDatabases" + suse_linux = "SuseLinux" + cosmos_db = "CosmosDb" + red_hat = "RedHat" + sql_data_warehouse = "SqlDataWarehouse" + vmware_cloud_simple = "VMwareCloudSimple" + red_hat_osa = "RedHatOsa" + databricks = "Databricks" + app_service = "AppService" + managed_disk = "ManagedDisk" + block_blob = "BlockBlob" + redis_cache = "RedisCache" + azure_data_explorer = "AzureDataExplorer" + my_sql = "MySql" + maria_db = "MariaDb" + postgre_sql = "PostgreSql" + dedicated_host = "DedicatedHost" + sap_hana = "SapHana" + sql_azure_hybrid_benefit = "SqlAzureHybridBenefit" + + +class ReservationTerm(str, Enum): + + p1_y = "P1Y" + p3_y = "P3Y" + + +class ReservationBillingPlan(str, Enum): + + upfront = "Upfront" + monthly = "Monthly" + + +class AppliedScopeType(str, Enum): + + single = "Single" + shared = "Shared" + + +class InstanceFlexibility(str, Enum): + + on = "On" + off = "Off" + + class ReservationStatusCode(str, Enum): none = "None" @@ -84,16 +132,21 @@ class ErrorResponseCode(str, Enum): calculate_price_failed = "CalculatePriceFailed" -class ReservationBillingPlan(str, Enum): +class CalculateExchangeOperationResultStatus(str, Enum): - upfront = "Upfront" - monthly = "Monthly" + succeeded = "Succeeded" + failed = "Failed" + cancelled = "Cancelled" + pending = "Pending" -class ReservationTerm(str, Enum): +class ExchangeOperationResultStatus(str, Enum): - p1_y = "P1Y" - p3_y = "P3Y" + succeeded = "Succeeded" + failed = "Failed" + cancelled = "Cancelled" + pending_refunds = "PendingRefunds" + pending_purchases = "PendingPurchases" class PaymentStatus(str, Enum): @@ -102,39 +155,3 @@ class PaymentStatus(str, Enum): failed = "Failed" scheduled = "Scheduled" cancelled = "Cancelled" - - -class ReservedResourceType(str, Enum): - - virtual_machines = "VirtualMachines" - sql_databases = "SqlDatabases" - suse_linux = "SuseLinux" - cosmos_db = "CosmosDb" - red_hat = "RedHat" - sql_data_warehouse = "SqlDataWarehouse" - vmware_cloud_simple = "VMwareCloudSimple" - red_hat_osa = "RedHatOsa" - databricks = "Databricks" - app_service = "AppService" - managed_disk = "ManagedDisk" - block_blob = "BlockBlob" - redis_cache = "RedisCache" - azure_data_explorer = "AzureDataExplorer" - my_sql = "MySql" - maria_db = "MariaDb" - postgre_sql = "PostgreSql" - dedicated_host = "DedicatedHost" - sap_hana = "SapHana" - sql_azure_hybrid_benefit = "SqlAzureHybridBenefit" - - -class InstanceFlexibility(str, Enum): - - on = "On" - off = "Off" - - -class AppliedScopeType(str, Enum): - - single = "Single" - shared = "Shared" 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 index f94dbebbfb0..dc78e922c73 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models.py @@ -154,6 +154,204 @@ def __init__(self, **kwargs): self.support_ticket_action = kwargs.get('support_ticket_action', None) +class AvailableScopeProperties(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(Model): + """Available scope. + + :param 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(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(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(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: + :type properties: + ~azure.mgmt.reservations.models.CalculateExchangeResponseProperties + :param error: + :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(Model): + """Calculate exchange request. + + :param 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(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.ReturnRequest] + """ + + _attribute_map = { + 'reservations_to_purchase': {'key': 'reservationsToPurchase', 'type': '[PurchaseRequest]'}, + 'reservations_to_exchange': {'key': 'reservationsToExchange', 'type': '[ReturnRequest]'}, + } + + 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(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: + :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(Model): """CalculatePriceResponse. @@ -475,6 +673,156 @@ def __init__(self, deserialize, response, *args): super(ExceptionResponseException, self).__init__(deserialize, response, 'ExceptionResponse', *args) +class ExchangeOperationResultResponse(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: + :type properties: + ~azure.mgmt.reservations.models.ExchangeResponseProperties + :param error: + :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(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(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(Model): + """Exchange request. + + :param 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(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(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.ReservationToExchange] + :param policy_result: + :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': '[ReservationToExchange]'}, + '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(Model): """ExtendedErrorInfo. @@ -613,6 +961,30 @@ def __init__(self, **kwargs): self.origin = kwargs.get('origin', None) +class OperationResultError(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(Model): """Patch. @@ -755,23 +1127,6 @@ def __init__(self, **kwargs): self.amount = kwargs.get('amount', None) -class Properties(Model): - """Properties. - - :param properties: - :type properties: - ~azure.mgmt.reservations.models.SubscriptionScopeProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'SubscriptionScopeProperties'}, - } - - def __init__(self, **kwargs): - super(Properties, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - class PurchaseRequest(Model): """PurchaseRequest. @@ -1569,6 +1924,94 @@ def __init__(self, **kwargs): self.split_source = kwargs.get('split_source', None) +class ReservationToExchange(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: + :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(Model): + """Reservation purchase details. + + :param billing_currency_total: + :type billing_currency_total: ~azure.mgmt.reservations.models.Price + """ + + _attribute_map = { + 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'Price'}, + } + + def __init__(self, **kwargs): + super(ReservationToPurchaseCalculateExchange, self).__init__(**kwargs) + self.billing_currency_total = kwargs.get('billing_currency_total', None) + + +class ReservationToPurchaseExchange(Model): + """Reservation purchase details. + + :param reservation_order_id: Fully qualified id of the ReservationOrder + being purchased + :type reservation_order_id: str + :param billing_currency_total: + :type billing_currency_total: ~azure.mgmt.reservations.models.Price + """ + + _attribute_map = { + 'reservation_order_id': {'key': 'reservationOrderId', 'type': 'str'}, + 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'Price'}, + } + + def __init__(self, **kwargs): + super(ReservationToPurchaseExchange, self).__init__(**kwargs) + self.reservation_order_id = kwargs.get('reservation_order_id', None) + self.billing_currency_total = kwargs.get('billing_currency_total', None) + + +class ReservationToReturn(Model): + """To be present only if ReturnRequestScope = Reservation and null otherwise. + + :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 ResourceName(Model): """Name of the resource provide by the resource Provider. Please use this name property for quotaRequests. @@ -1597,6 +2040,48 @@ def __init__(self, **kwargs): self.localized_value = None +class ReturnRequest(Model): + """Return request. + + :param id: Fully qualified identifier of the ReservationOrder being + returned + :type id: str + :param properties: + :type properties: ~azure.mgmt.reservations.models.ReturnRequestProperties + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ReturnRequestProperties'}, + } + + def __init__(self, **kwargs): + super(ReturnRequest, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.properties = kwargs.get('properties', None) + + +class ReturnRequestProperties(Model): + """Return request properties. + + :param scope: Possible values include: 'Reservation' + :type scope: str or ~azure.mgmt.reservations.models.enum + :param reservation_to_return: + :type reservation_to_return: + ~azure.mgmt.reservations.models.ReservationToReturn + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': 'str'}, + 'reservation_to_return': {'key': 'reservationToReturn', 'type': 'ReservationToReturn'}, + } + + def __init__(self, **kwargs): + super(ReturnRequestProperties, self).__init__(**kwargs) + self.scope = kwargs.get('scope', None) + self.reservation_to_return = kwargs.get('reservation_to_return', None) + + class ScopeProperties(Model): """ScopeProperties. 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 bcb0c049c4e..e0073dac6f5 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 @@ -154,6 +154,204 @@ def __init__(self, *, settings=None, on_failure=None, on_success=None, support_t self.support_ticket_action = support_ticket_action +class AvailableScopeProperties(Model): + """AvailableScopeProperties. + + :param properties: + :type properties: + ~azure.mgmt.reservations.models.SubscriptionScopeProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'SubscriptionScopeProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(AvailableScopeProperties, self).__init__(**kwargs) + self.properties = properties + + +class AvailableScopeRequest(Model): + """Available scope. + + :param properties: + :type properties: + ~azure.mgmt.reservations.models.AvailableScopeRequestProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'AvailableScopeRequestProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(AvailableScopeRequest, self).__init__(**kwargs) + self.properties = properties + + +class AvailableScopeRequestProperties(Model): + """Available scope request properties. + + :param scopes: + :type scopes: list[str] + """ + + _attribute_map = { + 'scopes': {'key': 'scopes', 'type': '[str]'}, + } + + def __init__(self, *, scopes=None, **kwargs) -> None: + super(AvailableScopeRequestProperties, self).__init__(**kwargs) + self.scopes = scopes + + +class BillingInformation(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, *, billing_currency_total_paid_amount=None, billing_currency_prorated_amount=None, billing_currency_remaining_commitment_amount=None, **kwargs) -> None: + 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 + self.billing_currency_remaining_commitment_amount = billing_currency_remaining_commitment_amount + + +class CalculateExchangeOperationResultResponse(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: + :type properties: + ~azure.mgmt.reservations.models.CalculateExchangeResponseProperties + :param error: + :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, *, id: str=None, name: str=None, status=None, properties=None, error=None, **kwargs) -> None: + super(CalculateExchangeOperationResultResponse, self).__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.properties = properties + self.error = error + + +class CalculateExchangeRequest(Model): + """Calculate exchange request. + + :param properties: + :type properties: + ~azure.mgmt.reservations.models.CalculateExchangeRequestProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CalculateExchangeRequestProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(CalculateExchangeRequest, self).__init__(**kwargs) + self.properties = properties + + +class CalculateExchangeRequestProperties(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.ReturnRequest] + """ + + _attribute_map = { + 'reservations_to_purchase': {'key': 'reservationsToPurchase', 'type': '[PurchaseRequest]'}, + 'reservations_to_exchange': {'key': 'reservationsToExchange', 'type': '[ReturnRequest]'}, + } + + def __init__(self, *, reservations_to_purchase=None, reservations_to_exchange=None, **kwargs) -> None: + super(CalculateExchangeRequestProperties, self).__init__(**kwargs) + self.reservations_to_purchase = reservations_to_purchase + self.reservations_to_exchange = reservations_to_exchange + + +class CalculateExchangeResponseProperties(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: + :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, *, session_id: str=None, net_payable=None, refunds_total=None, purchases_total=None, reservations_to_purchase=None, reservations_to_exchange=None, policy_result=None, **kwargs) -> None: + super(CalculateExchangeResponseProperties, self).__init__(**kwargs) + self.session_id = session_id + self.net_payable = net_payable + self.refunds_total = refunds_total + self.purchases_total = purchases_total + self.reservations_to_purchase = reservations_to_purchase + self.reservations_to_exchange = reservations_to_exchange + self.policy_result = policy_result + + class CalculatePriceResponse(Model): """CalculatePriceResponse. @@ -475,6 +673,156 @@ def __init__(self, deserialize, response, *args): super(ExceptionResponseException, self).__init__(deserialize, response, 'ExceptionResponse', *args) +class ExchangeOperationResultResponse(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: + :type properties: + ~azure.mgmt.reservations.models.ExchangeResponseProperties + :param error: + :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, *, id: str=None, name: str=None, status=None, properties=None, error=None, **kwargs) -> None: + super(ExchangeOperationResultResponse, self).__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.properties = properties + self.error = error + + +class ExchangePolicyError(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, *, code: str=None, message: str=None, **kwargs) -> None: + super(ExchangePolicyError, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ExchangePolicyErrors(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, *, policy_errors=None, **kwargs) -> None: + super(ExchangePolicyErrors, self).__init__(**kwargs) + self.policy_errors = policy_errors + + +class ExchangeRequest(Model): + """Exchange request. + + :param properties: + :type properties: + ~azure.mgmt.reservations.models.ExchangeRequestProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'ExchangeRequestProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(ExchangeRequest, self).__init__(**kwargs) + self.properties = properties + + +class ExchangeRequestProperties(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, *, session_id: str=None, **kwargs) -> None: + super(ExchangeRequestProperties, self).__init__(**kwargs) + self.session_id = session_id + + +class ExchangeResponseProperties(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.ReservationToExchange] + :param policy_result: + :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': '[ReservationToExchange]'}, + 'policy_result': {'key': 'policyResult', 'type': 'ExchangePolicyErrors'}, + } + + def __init__(self, *, session_id: str=None, net_payable=None, refunds_total=None, purchases_total=None, reservations_to_purchase=None, reservations_to_exchange=None, policy_result=None, **kwargs) -> None: + super(ExchangeResponseProperties, self).__init__(**kwargs) + self.session_id = session_id + self.net_payable = net_payable + self.refunds_total = refunds_total + self.purchases_total = purchases_total + self.reservations_to_purchase = reservations_to_purchase + self.reservations_to_exchange = reservations_to_exchange + self.policy_result = policy_result + + class ExtendedErrorInfo(Model): """ExtendedErrorInfo. @@ -613,6 +961,30 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, **kwargs) self.origin = origin +class OperationResultError(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, *, code: str=None, message: str=None, **kwargs) -> None: + super(OperationResultError, self).__init__(**kwargs) + self.code = code + self.message = message + + class Patch(Model): """Patch. @@ -755,23 +1127,6 @@ def __init__(self, *, currency_code: str=None, amount: float=None, **kwargs) -> self.amount = amount -class Properties(Model): - """Properties. - - :param properties: - :type properties: - ~azure.mgmt.reservations.models.SubscriptionScopeProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'SubscriptionScopeProperties'}, - } - - def __init__(self, *, properties=None, **kwargs) -> None: - super(Properties, self).__init__(**kwargs) - self.properties = properties - - class PurchaseRequest(Model): """PurchaseRequest. @@ -1569,6 +1924,94 @@ def __init__(self, *, split_destinations=None, split_source: str=None, **kwargs) self.split_source = split_source +class ReservationToExchange(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: + :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, *, reservation_id: str=None, quantity: int=None, billing_refund_amount=None, billing_information=None, **kwargs) -> None: + super(ReservationToExchange, self).__init__(**kwargs) + self.reservation_id = reservation_id + self.quantity = quantity + self.billing_refund_amount = billing_refund_amount + self.billing_information = billing_information + + +class ReservationToPurchaseCalculateExchange(Model): + """Reservation purchase details. + + :param billing_currency_total: + :type billing_currency_total: ~azure.mgmt.reservations.models.Price + """ + + _attribute_map = { + 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'Price'}, + } + + def __init__(self, *, billing_currency_total=None, **kwargs) -> None: + super(ReservationToPurchaseCalculateExchange, self).__init__(**kwargs) + self.billing_currency_total = billing_currency_total + + +class ReservationToPurchaseExchange(Model): + """Reservation purchase details. + + :param reservation_order_id: Fully qualified id of the ReservationOrder + being purchased + :type reservation_order_id: str + :param billing_currency_total: + :type billing_currency_total: ~azure.mgmt.reservations.models.Price + """ + + _attribute_map = { + 'reservation_order_id': {'key': 'reservationOrderId', 'type': 'str'}, + 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'Price'}, + } + + def __init__(self, *, reservation_order_id: str=None, billing_currency_total=None, **kwargs) -> None: + super(ReservationToPurchaseExchange, self).__init__(**kwargs) + self.reservation_order_id = reservation_order_id + self.billing_currency_total = billing_currency_total + + +class ReservationToReturn(Model): + """To be present only if ReturnRequestScope = Reservation and null otherwise. + + :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, *, reservation_id: str=None, quantity: int=None, **kwargs) -> None: + super(ReservationToReturn, self).__init__(**kwargs) + self.reservation_id = reservation_id + self.quantity = quantity + + class ResourceName(Model): """Name of the resource provide by the resource Provider. Please use this name property for quotaRequests. @@ -1597,6 +2040,48 @@ def __init__(self, *, value: str=None, **kwargs) -> None: self.localized_value = None +class ReturnRequest(Model): + """Return request. + + :param id: Fully qualified identifier of the ReservationOrder being + returned + :type id: str + :param properties: + :type properties: ~azure.mgmt.reservations.models.ReturnRequestProperties + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ReturnRequestProperties'}, + } + + def __init__(self, *, id: str=None, properties=None, **kwargs) -> None: + super(ReturnRequest, self).__init__(**kwargs) + self.id = id + self.properties = properties + + +class ReturnRequestProperties(Model): + """Return request properties. + + :param scope: Possible values include: 'Reservation' + :type scope: str or ~azure.mgmt.reservations.models.enum + :param reservation_to_return: + :type reservation_to_return: + ~azure.mgmt.reservations.models.ReservationToReturn + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': 'str'}, + 'reservation_to_return': {'key': 'reservationToReturn', 'type': 'ReservationToReturn'}, + } + + def __init__(self, *, scope=None, reservation_to_return=None, **kwargs) -> None: + super(ReturnRequestProperties, self).__init__(**kwargs) + self.scope = scope + self.reservation_to_return = reservation_to_return + + class ScopeProperties(Model): """ScopeProperties. diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py index 4d18278cf6d..8c987319da0 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py @@ -15,6 +15,8 @@ from ._reservation_operations import ReservationOperations from ._reservation_order_operations import ReservationOrderOperations from ._operation_operations import OperationOperations +from ._calculate_exchange_operations import CalculateExchangeOperations +from ._exchange_operations import ExchangeOperations from ._azure_reservation_api_operations import AzureReservationAPIOperationsMixin __all__ = [ @@ -24,5 +26,7 @@ 'ReservationOperations', 'ReservationOrderOperations', 'OperationOperations', + 'CalculateExchangeOperations', + 'ExchangeOperations', 'AzureReservationAPIOperationsMixin', ] 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 c2efa851797..19d68f99638 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 @@ -42,7 +42,7 @@ def get_catalog( :raises: :class:`ErrorException` """ - api_version = "2019-04-01" + api_version = "2020-10-01-preview" # Construct URL url = self.get_catalog.metadata['url'] @@ -106,7 +106,7 @@ def get_applied_reservation_list( :raises: :class:`ErrorException` """ - api_version = "2019-04-01" + api_version = "2020-10-01-preview" # Construct URL url = self.get_applied_reservation_list.metadata['url'] 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 new file mode 100644 index 00000000000..716012a358d --- /dev/null +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_calculate_exchange_operations.py @@ -0,0 +1,148 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class CalculateExchangeOperations(object): + """CalculateExchangeOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Supported version for this document is 2020-10-01-preview. Constant value: "2020-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-10-01-preview" + + self.config = config + + + def _post_initial( + self, properties=None, custom_headers=None, raw=False, **operation_config): + body = models.CalculateExchangeRequest(properties=properties) + + # Construct URL + url = self.post.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, 'CalculateExchangeRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('CalculateExchangeOperationResultResponse', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def post( + self, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Calculates the refund amounts and price of the new purchases. + + Calculates price for exchanging `Reservations` if there are no policy + errors. + . + + :param properties: + :type properties: + ~azure.mgmt.reservations.models.CalculateExchangeRequestProperties + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + CalculateExchangeOperationResultResponse or + ClientRawResponse if + raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.reservations.models.CalculateExchangeOperationResultResponse] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.reservations.models.CalculateExchangeOperationResultResponse]] + :raises: + :class:`ErrorException` + """ + raw_result = self._post_initial( + properties=properties, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + deserialized = self._deserialize('CalculateExchangeOperationResultResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + post.metadata = {'url': '/providers/Microsoft.Capacity/calculateExchange'} 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 new file mode 100644 index 00000000000..b4abccc8521 --- /dev/null +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_exchange_operations.py @@ -0,0 +1,147 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ExchangeOperations(object): + """ExchangeOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Supported version for this document is 2020-10-01-preview. Constant value: "2020-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-10-01-preview" + + self.config = config + + + def _post_initial( + self, properties=None, custom_headers=None, raw=False, **operation_config): + body = models.ExchangeRequest(properties=properties) + + # Construct URL + url = self.post.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, 'ExchangeRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('ExchangeOperationResultResponse', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def post( + self, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Exchange Reservation(s). + + Returns one or more `Reservations` in exchange for one or more + `Reservation` purchases. + . + + :param properties: + :type properties: + ~azure.mgmt.reservations.models.ExchangeRequestProperties + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ExchangeOperationResultResponse or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.reservations.models.ExchangeOperationResultResponse] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.reservations.models.ExchangeOperationResultResponse]] + :raises: + :class:`ErrorException` + """ + raw_result = self._post_initial( + properties=properties, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + deserialized = self._deserialize('ExchangeOperationResultResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + post.metadata = {'url': '/providers/Microsoft.Capacity/exchange'} 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 ef16719e837..b997ad9249f 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 @@ -24,7 +24,7 @@ class OperationOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Supported version for this document is 2019-04-01. Constant value: "2019-04-01". + :ivar api_version: Supported version for this document is 2020-10-01-preview. Constant value: "2020-10-01-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-01" + self.api_version = "2020-10-01-preview" self.config = config 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 b36986777ef..6d9f9c7c613 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 @@ -26,7 +26,7 @@ class ReservationOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Supported version for this document is 2019-04-01. Constant value: "2019-04-01". + :ivar api_version: Supported version for this document is 2020-10-01-preview. Constant value: "2020-10-01-preview". """ models = models @@ -36,13 +36,15 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-01" + self.api_version = "2020-10-01-preview" self.config = config def _available_scopes_initial( - self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, **operation_config): + self, reservation_order_id, reservation_id, properties=None, custom_headers=None, raw=False, **operation_config): + body = models.AvailableScopeRequest(properties=properties) + # Construct URL url = self.available_scopes.metadata['url'] path_format_arguments = { @@ -67,7 +69,7 @@ def _available_scopes_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(body, '[str]') + body_content = self._serialize.body(body, 'AvailableScopeRequest') # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) @@ -79,7 +81,7 @@ def _available_scopes_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Properties', response) + deserialized = self._deserialize('AvailableScopeProperties', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -88,7 +90,7 @@ def _available_scopes_initial( return deserialized def available_scopes( - self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, polling=True, **operation_config): + self, reservation_order_id, reservation_id, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): """Get Available Scopes for `Reservation`. Get Available Scopes for `Reservation`. @@ -98,33 +100,35 @@ def available_scopes( :type reservation_order_id: str :param reservation_id: Id of the Reservation Item :type reservation_id: str - :param body: - :type body: list[str] + :param properties: + :type properties: + ~azure.mgmt.reservations.models.AvailableScopeRequestProperties :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Properties or - ClientRawResponse if raw==True + :return: An instance of LROPoller that returns + AvailableScopeProperties or + ClientRawResponse if raw==True :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.reservations.models.Properties] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.reservations.models.AvailableScopeProperties] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.reservations.models.Properties]] + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.reservations.models.AvailableScopeProperties]] :raises: :class:`ErrorException` """ raw_result = self._available_scopes_initial( reservation_order_id=reservation_order_id, reservation_id=reservation_id, - body=body, + properties=properties, custom_headers=custom_headers, raw=True, **operation_config ) def get_long_running_output(response): - deserialized = self._deserialize('Properties', response) + deserialized = self._deserialize('AvailableScopeProperties', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_order_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_order_operations.py index 27c9f60ca54..dca3a3cb095 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 @@ -26,7 +26,7 @@ class ReservationOrderOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Supported version for this document is 2019-04-01. Constant value: "2019-04-01". + :ivar api_version: Supported version for this document is 2020-10-01-preview. Constant value: "2020-10-01-preview". """ models = models @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-01" + self.api_version = "2020-10-01-preview" self.config = config diff --git a/sdk/reservations/azure-mgmt-reservations/setup.py b/sdk/reservations/azure-mgmt-reservations/setup.py index 4fd436ee640..eaf6266b555 100644 --- a/sdk/reservations/azure-mgmt-reservations/setup.py +++ b/sdk/reservations/azure-mgmt-reservations/setup.py @@ -36,7 +36,7 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py') +with open(os.path.join(package_folder_path, 'version.py') if os.path.exists(os.path.join(package_folder_path, 'version.py')) else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',