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 174cb5eeba42..da6bf0b90517 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 c272e08f0dfa..e2a8cc6e6dfd 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,11 +15,22 @@ 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 from ._models_py3 import CalculatePriceResponsePropertiesPricingCurrencyTotal from ._models_py3 import Catalog + 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 @@ -27,17 +38,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,6 +73,11 @@ 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 @@ -73,11 +95,22 @@ 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 from ._models import CalculatePriceResponsePropertiesPricingCurrencyTotal from ._models import Catalog + from ._models import ChangeDirectoryRequest + from ._models import ChangeDirectoryResponse + from ._models import ChangeDirectoryResult from ._models import CreateGenericQuotaRequestParameters from ._models import CurrentQuotaLimit from ._models import CurrentQuotaLimitBase @@ -85,17 +118,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,6 +153,11 @@ 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 ReservationToReturnForExchange from ._models import ResourceName from ._models import ScopeProperties from ._models import ServiceError @@ -131,14 +175,17 @@ 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, + OperationStatus, PaymentStatus, - ReservedResourceType, - InstanceFlexibility, - AppliedScopeType, ) __all__ = [ @@ -147,11 +194,22 @@ 'AppliedReservations', 'AqiSettings', 'AutoQuotaIncreaseDetail', + 'AvailableScopeProperties', + 'AvailableScopeRequest', + 'AvailableScopeRequestProperties', + 'BillingInformation', + 'CalculateExchangeOperationResultResponse', + 'CalculateExchangeRequest', + 'CalculateExchangeRequestProperties', + 'CalculateExchangeResponseProperties', 'CalculatePriceResponse', 'CalculatePriceResponseProperties', 'CalculatePriceResponsePropertiesBillingCurrencyTotal', 'CalculatePriceResponsePropertiesPricingCurrencyTotal', 'Catalog', + 'ChangeDirectoryRequest', + 'ChangeDirectoryResponse', + 'ChangeDirectoryResult', 'CreateGenericQuotaRequestParameters', 'CurrentQuotaLimit', 'CurrentQuotaLimitBase', @@ -159,17 +217,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,6 +252,11 @@ 'ReservationProperties', 'ReservationResponse', 'ReservationSplitProperties', + 'ReservationToExchange', + 'ReservationToPurchaseCalculateExchange', + 'ReservationToPurchaseExchange', + 'ReservationToReturn', + 'ReservationToReturnForExchange', 'ResourceName', 'ScopeProperties', 'ServiceError', @@ -204,12 +273,15 @@ 'ReservationResponsePaged', 'ReservationOrderResponsePaged', 'OperationResponsePaged', + 'ReservedResourceType', + 'ReservationTerm', + 'ReservationBillingPlan', + 'AppliedScopeType', + 'InstanceFlexibility', 'ReservationStatusCode', 'ErrorResponseCode', - 'ReservationBillingPlan', - 'ReservationTerm', + 'CalculateExchangeOperationResultStatus', + 'ExchangeOperationResultStatus', + 'OperationStatus', '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 99f064c808c8..654df225d6d8 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,57 +132,34 @@ class ErrorResponseCode(str, Enum): calculate_price_failed = "CalculatePriceFailed" -class ReservationBillingPlan(str, Enum): - - upfront = "Upfront" - monthly = "Monthly" - - -class ReservationTerm(str, Enum): - - p1_y = "P1Y" - p3_y = "P3Y" - - -class PaymentStatus(str, Enum): +class CalculateExchangeOperationResultStatus(str, Enum): succeeded = "Succeeded" failed = "Failed" - scheduled = "Scheduled" cancelled = "Cancelled" + pending = "Pending" -class ReservedResourceType(str, Enum): +class ExchangeOperationResultStatus(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" + succeeded = "Succeeded" + failed = "Failed" + cancelled = "Cancelled" + pending_refunds = "PendingRefunds" + pending_purchases = "PendingPurchases" -class InstanceFlexibility(str, Enum): +class OperationStatus(str, Enum): - on = "On" - off = "Off" + succeeded = "Succeeded" + failed = "Failed" + cancelled = "Cancelled" + pending = "Pending" -class AppliedScopeType(str, Enum): +class PaymentStatus(str, Enum): - single = "Single" - shared = "Shared" + succeeded = "Succeeded" + failed = "Failed" + scheduled = "Scheduled" + cancelled = "Cancelled" 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 f94dbebbfb05..bd492b4d6ab0 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.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(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. @@ -315,6 +513,74 @@ def __init__(self, **kwargs): self.restrictions = None +class ChangeDirectoryRequest(Model): + """ChangeDirectoryRequest. + + :param destination_tenant_id: Tenant id GUID that reservation order is to + be transferred to + :type destination_tenant_id: str + """ + + _attribute_map = { + 'destination_tenant_id': {'key': 'destinationTenantId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ChangeDirectoryRequest, self).__init__(**kwargs) + self.destination_tenant_id = kwargs.get('destination_tenant_id', None) + + +class ChangeDirectoryResponse(Model): + """Change directory response. + + :param reservation_order: + :type reservation_order: + ~azure.mgmt.reservations.models.ChangeDirectoryResult + :param reservations: + :type reservations: + list[~azure.mgmt.reservations.models.ChangeDirectoryResult] + """ + + _attribute_map = { + 'reservation_order': {'key': 'reservationOrder', 'type': 'ChangeDirectoryResult'}, + 'reservations': {'key': 'reservations', 'type': '[ChangeDirectoryResult]'}, + } + + def __init__(self, **kwargs): + super(ChangeDirectoryResponse, self).__init__(**kwargs) + self.reservation_order = kwargs.get('reservation_order', None) + self.reservations = kwargs.get('reservations', None) + + +class ChangeDirectoryResult(Model): + """Change directory result for reservation order or reservation. + + :param id: Identifier of the reservation order or reservation + :type id: str + :param name: Name of the reservation order or reservation + :type name: str + :param is_succeeded: True if change directory operation succeeded on this + reservation order or reservation + :type is_succeeded: bool + :param error: Error reason if operation failed. Null otherwise + :type 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, **kwargs): + super(ChangeDirectoryResult, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.is_succeeded = kwargs.get('is_succeeded', None) + self.error = kwargs.get('error', None) + + class CloudError(Model): """CloudError. """ @@ -475,6 +741,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.ReservationToReturnForExchange] + :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': '[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(Model): """ExtendedErrorInfo. @@ -613,6 +1029,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 +1195,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 +1992,134 @@ 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 + :param status: 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'}, + '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.billing_currency_total = kwargs.get('billing_currency_total', None) + self.status = kwargs.get('status', None) + + +class ReservationToReturn(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(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 + :param status: 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(Model): """Name of the resource provide by the resource Provider. Please use this name property for quotaRequests. 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 bcb0c049c4ec..2239236bc7c7 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.ReservationToReturn] + """ + + _attribute_map = { + 'reservations_to_purchase': {'key': 'reservationsToPurchase', 'type': '[PurchaseRequest]'}, + 'reservations_to_exchange': {'key': 'reservationsToExchange', 'type': '[ReservationToReturn]'}, + } + + 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. @@ -315,6 +513,74 @@ def __init__(self, *, billing_plans=None, **kwargs) -> None: self.restrictions = None +class ChangeDirectoryRequest(Model): + """ChangeDirectoryRequest. + + :param destination_tenant_id: Tenant id GUID that reservation order is to + be transferred to + :type destination_tenant_id: str + """ + + _attribute_map = { + 'destination_tenant_id': {'key': 'destinationTenantId', 'type': 'str'}, + } + + def __init__(self, *, destination_tenant_id: str=None, **kwargs) -> None: + super(ChangeDirectoryRequest, self).__init__(**kwargs) + self.destination_tenant_id = destination_tenant_id + + +class ChangeDirectoryResponse(Model): + """Change directory response. + + :param reservation_order: + :type reservation_order: + ~azure.mgmt.reservations.models.ChangeDirectoryResult + :param reservations: + :type 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=None, reservations=None, **kwargs) -> None: + super(ChangeDirectoryResponse, self).__init__(**kwargs) + self.reservation_order = reservation_order + self.reservations = reservations + + +class ChangeDirectoryResult(Model): + """Change directory result for reservation order or reservation. + + :param id: Identifier of the reservation order or reservation + :type id: str + :param name: Name of the reservation order or reservation + :type name: str + :param is_succeeded: True if change directory operation succeeded on this + reservation order or reservation + :type is_succeeded: bool + :param error: Error reason if operation failed. Null otherwise + :type 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: str=None, name: str=None, is_succeeded: bool=None, error: str=None, **kwargs) -> None: + super(ChangeDirectoryResult, self).__init__(**kwargs) + self.id = id + self.name = name + self.is_succeeded = is_succeeded + self.error = error + + class CloudError(Model): """CloudError. """ @@ -475,6 +741,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.ReservationToReturnForExchange] + :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': '[ReservationToReturnForExchange]'}, + '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 +1029,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 +1195,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 +1992,134 @@ 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 + :param status: 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'}, + 'billing_currency_total': {'key': 'billingCurrencyTotal', 'type': 'Price'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, *, reservation_order_id: str=None, billing_currency_total=None, status=None, **kwargs) -> None: + super(ReservationToPurchaseExchange, self).__init__(**kwargs) + self.reservation_order_id = reservation_order_id + self.billing_currency_total = billing_currency_total + self.status = status + + +class ReservationToReturn(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, *, reservation_id: str=None, quantity: int=None, **kwargs) -> None: + super(ReservationToReturn, self).__init__(**kwargs) + self.reservation_id = reservation_id + self.quantity = quantity + + +class ReservationToReturnForExchange(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 + :param status: 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, *, reservation_id: str=None, quantity: int=None, billing_refund_amount=None, billing_information=None, status=None, **kwargs) -> None: + super(ReservationToReturnForExchange, self).__init__(**kwargs) + self.reservation_id = reservation_id + self.quantity = quantity + self.billing_refund_amount = billing_refund_amount + self.billing_information = billing_information + self.status = status + + class ResourceName(Model): """Name of the resource provide by the resource Provider. Please use this name property for quotaRequests. 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 4d18278cf6da..8c987319da0d 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 c2efa8517972..19d68f996382 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 000000000000..716012a358da --- /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 000000000000..b4abccc85217 --- /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 ef16719e8372..b997ad9249f3 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 b36986777efc..6d9f9c7c6139 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 27c9f60ca544..673b70f3cd61 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,6 @@ 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". """ models = models @@ -36,7 +35,6 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-01" self.config = config @@ -59,12 +57,14 @@ def calculate( :raises: :class:`ErrorException` """ + api_version = "2020-10-01-preview" + # Construct URL url = self.calculate.metadata['url'] # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -116,6 +116,8 @@ def list( :raises: :class:`ErrorException` """ + api_version = "2020-10-01-preview" + def prepare_request(next_link=None): if not next_link: # Construct URL @@ -123,7 +125,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') else: url = next_link @@ -165,6 +167,8 @@ def internal_paging(next_link=None): def _purchase_initial( self, reservation_order_id, body, custom_headers=None, raw=False, **operation_config): + api_version = "2020-10-01-preview" + # Construct URL url = self.purchase.metadata['url'] path_format_arguments = { @@ -174,7 +178,7 @@ def _purchase_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -283,6 +287,8 @@ def get( :raises: :class:`ErrorException` """ + api_version = "2020-10-01-preview" + # Construct URL url = self.get.metadata['url'] path_format_arguments = { @@ -292,7 +298,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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') @@ -323,3 +329,73 @@ def get( return deserialized get.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}'} + + def change_directory( + self, reservation_order_id, destination_tenant_id=None, custom_headers=None, raw=False, **operation_config): + """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 destination_tenant_id: Tenant id GUID that reservation order is + to be transferred to + :type destination_tenant_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ChangeDirectoryResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.reservations.models.ChangeDirectoryResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + body = models.ChangeDirectoryRequest(destination_tenant_id=destination_tenant_id) + + api_version = "2020-11-15-preview" + + # Construct URL + url = self.change_directory.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", 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, 'ChangeDirectoryRequest') + + # 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]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ChangeDirectoryResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + change_directory.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/changeDirectory'}