From 3eb163d665b422ae6e28b7a9f2ebb75da59b9a51 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 3 Jun 2019 21:26:42 +0000 Subject: [PATCH] Generated from 385f978904ef94d58bd1c7c880f987cb6f1d2c3a Microsoft.Billing: Add APIs for validation of subscription transfer and product transfer across invoice sections --- .../azure/mgmt/billing/models/__init__.py | 16 ++++ .../models/billing_management_client_enums.py | 25 ++++++ .../transfer_billing_subscription_request.py | 4 + ...billing_subscription_request_properties.py | 4 + ...ing_subscription_request_properties_py3.py | 6 +- ...ansfer_billing_subscription_request_py3.py | 6 +- .../transfer_product_request_properties.py | 6 +- ...transfer_product_request_properties_py3.py | 8 +- ...date_product_transfer_eligibility_error.py | 42 +++++++++ ..._product_transfer_eligibility_error_py3.py | 42 +++++++++ ...ate_product_transfer_eligibility_result.py | 41 +++++++++ ...product_transfer_eligibility_result_py3.py | 41 +++++++++ ...subscription_transfer_eligibility_error.py | 41 +++++++++ ...cription_transfer_eligibility_error_py3.py | 41 +++++++++ ...ubscription_transfer_eligibility_result.py | 41 +++++++++ ...ription_transfer_eligibility_result_py3.py | 41 +++++++++ .../billing_subscriptions_operations.py | 87 ++++++++++++++++++- .../billing/operations/products_operations.py | 86 +++++++++++++++++- 18 files changed, 567 insertions(+), 11 deletions(-) create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_error.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_error_py3.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_result.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_result_py3.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_error.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_error_py3.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_result.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_result_py3.py diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py index 8317da93adbf..daffd6c1eaa7 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py @@ -23,6 +23,8 @@ from .transfer_billing_subscription_result_py3 import TransferBillingSubscriptionResult from .transfer_billing_subscription_request_properties_py3 import TransferBillingSubscriptionRequestProperties from .transfer_billing_subscription_request_py3 import TransferBillingSubscriptionRequest + from .validate_subscription_transfer_eligibility_error_py3 import ValidateSubscriptionTransferEligibilityError + from .validate_subscription_transfer_eligibility_result_py3 import ValidateSubscriptionTransferEligibilityResult from .update_auto_renew_operation_summary_py3 import UpdateAutoRenewOperationSummary from .enabled_azure_sk_us_py3 import EnabledAzureSKUs from .billing_profile_py3 import BillingProfile @@ -52,6 +54,8 @@ from .invoice_list_result_py3 import InvoiceListResult from .product_summary_py3 import ProductSummary from .products_list_result_py3 import ProductsListResult + from .validate_product_transfer_eligibility_error_py3 import ValidateProductTransferEligibilityError + from .validate_product_transfer_eligibility_result_py3 import ValidateProductTransferEligibilityResult from .billing_subscription_summary_py3 import BillingSubscriptionSummary from .billing_subscriptions_list_result_py3 import BillingSubscriptionsListResult from .enrollment_account_context_py3 import EnrollmentAccountContext @@ -88,6 +92,8 @@ from .transfer_billing_subscription_result import TransferBillingSubscriptionResult from .transfer_billing_subscription_request_properties import TransferBillingSubscriptionRequestProperties from .transfer_billing_subscription_request import TransferBillingSubscriptionRequest + from .validate_subscription_transfer_eligibility_error import ValidateSubscriptionTransferEligibilityError + from .validate_subscription_transfer_eligibility_result import ValidateSubscriptionTransferEligibilityResult from .update_auto_renew_operation_summary import UpdateAutoRenewOperationSummary from .enabled_azure_sk_us import EnabledAzureSKUs from .billing_profile import BillingProfile @@ -117,6 +123,8 @@ from .invoice_list_result import InvoiceListResult from .product_summary import ProductSummary from .products_list_result import ProductsListResult + from .validate_product_transfer_eligibility_error import ValidateProductTransferEligibilityError + from .validate_product_transfer_eligibility_result import ValidateProductTransferEligibilityResult from .billing_subscription_summary import BillingSubscriptionSummary from .billing_subscriptions_list_result import BillingSubscriptionsListResult from .enrollment_account_context import EnrollmentAccountContext @@ -152,8 +160,10 @@ TransferStatus, ProductTransferStatus, EligibleProductType, + SubscriptionTransferValidationErrorCode, ProductStatusType, BillingFrequency, + ProductTransferValidationErrorCode, BillingSubscriptionStatusType, TransactionTypeKind, ReservationType, @@ -176,6 +186,8 @@ 'TransferBillingSubscriptionResult', 'TransferBillingSubscriptionRequestProperties', 'TransferBillingSubscriptionRequest', + 'ValidateSubscriptionTransferEligibilityError', + 'ValidateSubscriptionTransferEligibilityResult', 'UpdateAutoRenewOperationSummary', 'EnabledAzureSKUs', 'BillingProfile', @@ -205,6 +217,8 @@ 'InvoiceListResult', 'ProductSummary', 'ProductsListResult', + 'ValidateProductTransferEligibilityError', + 'ValidateProductTransferEligibilityResult', 'BillingSubscriptionSummary', 'BillingSubscriptionsListResult', 'EnrollmentAccountContext', @@ -239,8 +253,10 @@ 'TransferStatus', 'ProductTransferStatus', 'EligibleProductType', + 'SubscriptionTransferValidationErrorCode', 'ProductStatusType', 'BillingFrequency', + 'ProductTransferValidationErrorCode', 'BillingSubscriptionStatusType', 'TransactionTypeKind', 'ReservationType', diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_management_client_enums.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_management_client_enums.py index 99813d1714b1..0a6d8f324cc9 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_management_client_enums.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_management_client_enums.py @@ -50,6 +50,18 @@ class EligibleProductType(str, Enum): azure_reservation = "AzureReservation" +class SubscriptionTransferValidationErrorCode(str, Enum): + + invalid_source = "InvalidSource" + subscription_not_active = "SubscriptionNotActive" + insufficient_permission_on_source = "InsufficientPermissionOnSource" + insufficient_permission_on_destination = "InsufficientPermissionOnDestination" + destination_billing_profile_past_due = "DestinationBillingProfilePastDue" + subscription_type_not_supported = "SubscriptionTypeNotSupported" + cross_billing_account_not_allowed = "CrossBillingAccountNotAllowed" + not_available_for_destination_market = "NotAvailableForDestinationMarket" + + class ProductStatusType(str, Enum): active = "Active" @@ -69,6 +81,19 @@ class BillingFrequency(str, Enum): usage_based = "UsageBased" +class ProductTransferValidationErrorCode(str, Enum): + + invalid_source = "InvalidSource" + product_not_active = "ProductNotActive" + insufficient_permission_on_source = "InsufficientPermissionOnSource" + insufficient_permission_on_destination = "InsufficientPermissionOnDestination" + destination_billing_profile_past_due = "DestinationBillingProfilePastDue" + product_type_not_supported = "ProductTypeNotSupported" + cross_billing_account_not_allowed = "CrossBillingAccountNotAllowed" + not_available_for_destination_market = "NotAvailableForDestinationMarket" + one_time_purchase_product_transfer_not_allowed = "OneTimePurchaseProductTransferNotAllowed" + + class BillingSubscriptionStatusType(str, Enum): active = "Active" diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request.py index db0e4281ef8c..3100b66a0a12 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request.py @@ -17,12 +17,16 @@ class TransferBillingSubscriptionRequest(Model): :param destination_invoice_section_id: The destination invoice section id. :type destination_invoice_section_id: str + :param destination_billing_profile_id: The destination billing profile id. + :type destination_billing_profile_id: str """ _attribute_map = { 'destination_invoice_section_id': {'key': 'properties.destinationInvoiceSectionId', 'type': 'str'}, + 'destination_billing_profile_id': {'key': 'properties.destinationBillingProfileId', 'type': 'str'}, } def __init__(self, **kwargs): super(TransferBillingSubscriptionRequest, self).__init__(**kwargs) self.destination_invoice_section_id = kwargs.get('destination_invoice_section_id', None) + self.destination_billing_profile_id = kwargs.get('destination_billing_profile_id', None) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_properties.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_properties.py index 0f9174df2be3..9d103278db5d 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_properties.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_properties.py @@ -17,12 +17,16 @@ class TransferBillingSubscriptionRequestProperties(Model): :param destination_invoice_section_id: The destination invoice section id. :type destination_invoice_section_id: str + :param destination_billing_profile_id: The destination billing profile id. + :type destination_billing_profile_id: str """ _attribute_map = { 'destination_invoice_section_id': {'key': 'destinationInvoiceSectionId', 'type': 'str'}, + 'destination_billing_profile_id': {'key': 'destinationBillingProfileId', 'type': 'str'}, } def __init__(self, **kwargs): super(TransferBillingSubscriptionRequestProperties, self).__init__(**kwargs) self.destination_invoice_section_id = kwargs.get('destination_invoice_section_id', None) + self.destination_billing_profile_id = kwargs.get('destination_billing_profile_id', None) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_properties_py3.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_properties_py3.py index ceb12cf89262..d364d1d807be 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_properties_py3.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_properties_py3.py @@ -17,12 +17,16 @@ class TransferBillingSubscriptionRequestProperties(Model): :param destination_invoice_section_id: The destination invoice section id. :type destination_invoice_section_id: str + :param destination_billing_profile_id: The destination billing profile id. + :type destination_billing_profile_id: str """ _attribute_map = { 'destination_invoice_section_id': {'key': 'destinationInvoiceSectionId', 'type': 'str'}, + 'destination_billing_profile_id': {'key': 'destinationBillingProfileId', 'type': 'str'}, } - def __init__(self, *, destination_invoice_section_id: str=None, **kwargs) -> None: + def __init__(self, *, destination_invoice_section_id: str=None, destination_billing_profile_id: str=None, **kwargs) -> None: super(TransferBillingSubscriptionRequestProperties, self).__init__(**kwargs) self.destination_invoice_section_id = destination_invoice_section_id + self.destination_billing_profile_id = destination_billing_profile_id diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_py3.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_py3.py index 707b9e89ef01..77edcf3ac1aa 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_py3.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_billing_subscription_request_py3.py @@ -17,12 +17,16 @@ class TransferBillingSubscriptionRequest(Model): :param destination_invoice_section_id: The destination invoice section id. :type destination_invoice_section_id: str + :param destination_billing_profile_id: The destination billing profile id. + :type destination_billing_profile_id: str """ _attribute_map = { 'destination_invoice_section_id': {'key': 'properties.destinationInvoiceSectionId', 'type': 'str'}, + 'destination_billing_profile_id': {'key': 'properties.destinationBillingProfileId', 'type': 'str'}, } - def __init__(self, *, destination_invoice_section_id: str=None, **kwargs) -> None: + def __init__(self, *, destination_invoice_section_id: str=None, destination_billing_profile_id: str=None, **kwargs) -> None: super(TransferBillingSubscriptionRequest, self).__init__(**kwargs) self.destination_invoice_section_id = destination_invoice_section_id + self.destination_billing_profile_id = destination_billing_profile_id diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_request_properties.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_request_properties.py index 9feaa795f8f8..c697a28aee13 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_request_properties.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_request_properties.py @@ -15,14 +15,18 @@ class TransferProductRequestProperties(Model): """The properties of the product to initiate a transfer. - :param destination_invoice_section_id: Destination invoice section id. + :param destination_invoice_section_id: The destination invoice section id. :type destination_invoice_section_id: str + :param destination_billing_profile_id: The destination billing profile id. + :type destination_billing_profile_id: str """ _attribute_map = { 'destination_invoice_section_id': {'key': 'destinationInvoiceSectionId', 'type': 'str'}, + 'destination_billing_profile_id': {'key': 'destinationBillingProfileId', 'type': 'str'}, } def __init__(self, **kwargs): super(TransferProductRequestProperties, self).__init__(**kwargs) self.destination_invoice_section_id = kwargs.get('destination_invoice_section_id', None) + self.destination_billing_profile_id = kwargs.get('destination_billing_profile_id', None) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_request_properties_py3.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_request_properties_py3.py index 029af2856f0e..f819e622f7e0 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_request_properties_py3.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_request_properties_py3.py @@ -15,14 +15,18 @@ class TransferProductRequestProperties(Model): """The properties of the product to initiate a transfer. - :param destination_invoice_section_id: Destination invoice section id. + :param destination_invoice_section_id: The destination invoice section id. :type destination_invoice_section_id: str + :param destination_billing_profile_id: The destination billing profile id. + :type destination_billing_profile_id: str """ _attribute_map = { 'destination_invoice_section_id': {'key': 'destinationInvoiceSectionId', 'type': 'str'}, + 'destination_billing_profile_id': {'key': 'destinationBillingProfileId', 'type': 'str'}, } - def __init__(self, *, destination_invoice_section_id: str=None, **kwargs) -> None: + def __init__(self, *, destination_invoice_section_id: str=None, destination_billing_profile_id: str=None, **kwargs) -> None: super(TransferProductRequestProperties, self).__init__(**kwargs) self.destination_invoice_section_id = destination_invoice_section_id + self.destination_billing_profile_id = destination_billing_profile_id diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_error.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_error.py new file mode 100644 index 000000000000..020f0bb1b2a2 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_error.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ValidateProductTransferEligibilityError(Model): + """Error details of the product transfer eligibility validation. + + :param code: Error code for the product transfer validation. Possible + values include: 'InvalidSource', 'ProductNotActive', + 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', + 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', + 'OneTimePurchaseProductTransferNotAllowed' + :type code: str or + ~azure.mgmt.billing.models.ProductTransferValidationErrorCode + :param message: The error message. + :type message: str + :param details: Detailed error message explaining the error. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ValidateProductTransferEligibilityError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = kwargs.get('details', None) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_error_py3.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_error_py3.py new file mode 100644 index 000000000000..d30e8ee13908 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_error_py3.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ValidateProductTransferEligibilityError(Model): + """Error details of the product transfer eligibility validation. + + :param code: Error code for the product transfer validation. Possible + values include: 'InvalidSource', 'ProductNotActive', + 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', + 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', + 'OneTimePurchaseProductTransferNotAllowed' + :type code: str or + ~azure.mgmt.billing.models.ProductTransferValidationErrorCode + :param message: The error message. + :type message: str + :param details: Detailed error message explaining the error. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__(self, *, code=None, message: str=None, details: str=None, **kwargs) -> None: + super(ValidateProductTransferEligibilityError, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = details diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_result.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_result.py new file mode 100644 index 000000000000..9523d690342c --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_result.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ValidateProductTransferEligibilityResult(Model): + """Result of the product transfer eligibility validation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar is_transfer_eligible: Specifies whether the transfer is eligible or + not. + :vartype is_transfer_eligible: bool + :param error_details: Validation error details. + :type error_details: + ~azure.mgmt.billing.models.ValidateProductTransferEligibilityError + """ + + _validation = { + 'is_transfer_eligible': {'readonly': True}, + } + + _attribute_map = { + 'is_transfer_eligible': {'key': 'isTransferEligible', 'type': 'bool'}, + 'error_details': {'key': 'errorDetails', 'type': 'ValidateProductTransferEligibilityError'}, + } + + def __init__(self, **kwargs): + super(ValidateProductTransferEligibilityResult, self).__init__(**kwargs) + self.is_transfer_eligible = None + self.error_details = kwargs.get('error_details', None) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_result_py3.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_result_py3.py new file mode 100644 index 000000000000..c369e6170046 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_product_transfer_eligibility_result_py3.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ValidateProductTransferEligibilityResult(Model): + """Result of the product transfer eligibility validation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar is_transfer_eligible: Specifies whether the transfer is eligible or + not. + :vartype is_transfer_eligible: bool + :param error_details: Validation error details. + :type error_details: + ~azure.mgmt.billing.models.ValidateProductTransferEligibilityError + """ + + _validation = { + 'is_transfer_eligible': {'readonly': True}, + } + + _attribute_map = { + 'is_transfer_eligible': {'key': 'isTransferEligible', 'type': 'bool'}, + 'error_details': {'key': 'errorDetails', 'type': 'ValidateProductTransferEligibilityError'}, + } + + def __init__(self, *, error_details=None, **kwargs) -> None: + super(ValidateProductTransferEligibilityResult, self).__init__(**kwargs) + self.is_transfer_eligible = None + self.error_details = error_details diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_error.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_error.py new file mode 100644 index 000000000000..c1f1645580e0 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_error.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ValidateSubscriptionTransferEligibilityError(Model): + """Error details of the transfer eligibility validation. + + :param code: Error code for the product transfer validation. Possible + values include: 'InvalidSource', 'SubscriptionNotActive', + 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', + 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket' + :type code: str or + ~azure.mgmt.billing.models.SubscriptionTransferValidationErrorCode + :param message: The error message. + :type message: str + :param details: Detailed error message explaining the error. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ValidateSubscriptionTransferEligibilityError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = kwargs.get('details', None) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_error_py3.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_error_py3.py new file mode 100644 index 000000000000..c866f4bba0c0 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_error_py3.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ValidateSubscriptionTransferEligibilityError(Model): + """Error details of the transfer eligibility validation. + + :param code: Error code for the product transfer validation. Possible + values include: 'InvalidSource', 'SubscriptionNotActive', + 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', + 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket' + :type code: str or + ~azure.mgmt.billing.models.SubscriptionTransferValidationErrorCode + :param message: The error message. + :type message: str + :param details: Detailed error message explaining the error. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__(self, *, code=None, message: str=None, details: str=None, **kwargs) -> None: + super(ValidateSubscriptionTransferEligibilityError, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = details diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_result.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_result.py new file mode 100644 index 000000000000..6e2cec88f059 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_result.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ValidateSubscriptionTransferEligibilityResult(Model): + """Result of the transfer eligibility validation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar is_transfer_eligible: Specifies whether the transfer is eligible or + not. + :vartype is_transfer_eligible: bool + :param error_details: Validation error details. + :type error_details: + ~azure.mgmt.billing.models.ValidateSubscriptionTransferEligibilityError + """ + + _validation = { + 'is_transfer_eligible': {'readonly': True}, + } + + _attribute_map = { + 'is_transfer_eligible': {'key': 'isTransferEligible', 'type': 'bool'}, + 'error_details': {'key': 'errorDetails', 'type': 'ValidateSubscriptionTransferEligibilityError'}, + } + + def __init__(self, **kwargs): + super(ValidateSubscriptionTransferEligibilityResult, self).__init__(**kwargs) + self.is_transfer_eligible = None + self.error_details = kwargs.get('error_details', None) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_result_py3.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_result_py3.py new file mode 100644 index 000000000000..c45765e323b6 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/validate_subscription_transfer_eligibility_result_py3.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ValidateSubscriptionTransferEligibilityResult(Model): + """Result of the transfer eligibility validation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar is_transfer_eligible: Specifies whether the transfer is eligible or + not. + :vartype is_transfer_eligible: bool + :param error_details: Validation error details. + :type error_details: + ~azure.mgmt.billing.models.ValidateSubscriptionTransferEligibilityError + """ + + _validation = { + 'is_transfer_eligible': {'readonly': True}, + } + + _attribute_map = { + 'is_transfer_eligible': {'key': 'isTransferEligible', 'type': 'bool'}, + 'error_details': {'key': 'errorDetails', 'type': 'ValidateSubscriptionTransferEligibilityError'}, + } + + def __init__(self, *, error_details=None, **kwargs) -> None: + super(ValidateSubscriptionTransferEligibilityResult, self).__init__(**kwargs) + self.is_transfer_eligible = None + self.error_details = error_details diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py index c713b7e251c4..26d11b6b070d 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py @@ -290,8 +290,8 @@ def get( def _transfer_initial( - self, billing_account_name, invoice_section_name, billing_subscription_name, destination_invoice_section_id=None, custom_headers=None, raw=False, **operation_config): - parameters = models.TransferBillingSubscriptionRequestProperties(destination_invoice_section_id=destination_invoice_section_id) + self, billing_account_name, invoice_section_name, billing_subscription_name, destination_invoice_section_id=None, destination_billing_profile_id=None, custom_headers=None, raw=False, **operation_config): + parameters = models.TransferBillingSubscriptionRequestProperties(destination_invoice_section_id=destination_invoice_section_id, destination_billing_profile_id=destination_billing_profile_id) # Construct URL url = self.transfer.metadata['url'] @@ -345,7 +345,7 @@ def _transfer_initial( return deserialized def transfer( - self, billing_account_name, invoice_section_name, billing_subscription_name, destination_invoice_section_id=None, custom_headers=None, raw=False, polling=True, **operation_config): + self, billing_account_name, invoice_section_name, billing_subscription_name, destination_invoice_section_id=None, destination_billing_profile_id=None, custom_headers=None, raw=False, polling=True, **operation_config): """Transfers the subscription from one invoice section to another within a billing account. @@ -358,6 +358,9 @@ def transfer( :param destination_invoice_section_id: The destination invoice section id. :type destination_invoice_section_id: str + :param destination_billing_profile_id: The destination billing profile + id. + :type destination_billing_profile_id: str :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 @@ -378,6 +381,7 @@ def transfer( invoice_section_name=invoice_section_name, billing_subscription_name=billing_subscription_name, destination_invoice_section_id=destination_invoice_section_id, + destination_billing_profile_id=destination_billing_profile_id, custom_headers=custom_headers, raw=True, **operation_config @@ -406,3 +410,80 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) transfer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer'} + + def validate_transfer( + self, billing_account_name, invoice_section_name, billing_subscription_name, destination_invoice_section_id=None, destination_billing_profile_id=None, custom_headers=None, raw=False, **operation_config): + """Validates the transfer of billing subscriptions across invoice + sections. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param billing_subscription_name: Billing Subscription Id. + :type billing_subscription_name: str + :param destination_invoice_section_id: The destination invoice section + id. + :type destination_invoice_section_id: str + :param destination_billing_profile_id: The destination billing profile + id. + :type destination_billing_profile_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: ValidateSubscriptionTransferEligibilityResult or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.billing.models.ValidateSubscriptionTransferEligibilityResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.TransferBillingSubscriptionRequestProperties(destination_invoice_section_id=destination_invoice_section_id, destination_billing_profile_id=destination_billing_profile_id) + + # Construct URL + url = self.validate_transfer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'billingSubscriptionName': self._serialize.url("billing_subscription_name", billing_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # 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(parameters, 'TransferBillingSubscriptionRequestProperties') + + # 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.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ValidateSubscriptionTransferEligibilityResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + validate_transfer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/validateTransferEligibility'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py index 94d18ee0f768..90592416de49 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py @@ -239,7 +239,7 @@ def get( get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}'} def transfer( - self, billing_account_name, invoice_section_name, product_name, destination_invoice_section_id=None, custom_headers=None, raw=False, **operation_config): + self, billing_account_name, invoice_section_name, product_name, destination_invoice_section_id=None, destination_billing_profile_id=None, custom_headers=None, raw=False, **operation_config): """The operation to transfer a Product to another invoice section. :param billing_account_name: billing Account Id. @@ -248,8 +248,12 @@ def transfer( :type invoice_section_name: str :param product_name: Invoice Id. :type product_name: str - :param destination_invoice_section_id: Destination invoice section id. + :param destination_invoice_section_id: The destination invoice section + id. :type destination_invoice_section_id: str + :param destination_billing_profile_id: The destination billing profile + id. + :type destination_billing_profile_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 @@ -261,7 +265,7 @@ def transfer( :raises: :class:`ErrorResponseException` """ - parameters = models.TransferProductRequestProperties(destination_invoice_section_id=destination_invoice_section_id) + parameters = models.TransferProductRequestProperties(destination_invoice_section_id=destination_invoice_section_id, destination_billing_profile_id=destination_billing_profile_id) # Construct URL url = self.transfer.metadata['url'] @@ -316,6 +320,82 @@ def transfer( return deserialized transfer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/transfer'} + def validate_transfer( + self, billing_account_name, invoice_section_name, product_name, destination_invoice_section_id=None, destination_billing_profile_id=None, custom_headers=None, raw=False, **operation_config): + """Validates the transfer of products across invoice sections. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param product_name: Invoice Id. + :type product_name: str + :param destination_invoice_section_id: The destination invoice section + id. + :type destination_invoice_section_id: str + :param destination_billing_profile_id: The destination billing profile + id. + :type destination_billing_profile_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: ValidateProductTransferEligibilityResult or ClientRawResponse + if raw=true + :rtype: + ~azure.mgmt.billing.models.ValidateProductTransferEligibilityResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.TransferProductRequestProperties(destination_invoice_section_id=destination_invoice_section_id, destination_billing_profile_id=destination_billing_profile_id) + + # Construct URL + url = self.validate_transfer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'productName': self._serialize.url("product_name", product_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # 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(parameters, 'TransferProductRequestProperties') + + # 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.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ValidateProductTransferEligibilityResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + validate_transfer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/validateTransferEligibility'} + def update_auto_renew_by_billing_account_name( self, billing_account_name, product_name, auto_renew=None, custom_headers=None, raw=False, **operation_config): """Cancel auto renew for product by product id and billing account name.