From 3a2a1b245f30aa2c2eaf05d75df074123c64de22 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Tue, 31 Mar 2020 03:30:36 +0000 Subject: [PATCH] Generated from b5f29b3ac83ba893f7f891aa0b25971fcd6cdcb6 Updated description for instructions api path --- .../azure/mgmt/billing/__init__.py | 7 +- .../billing/_billing_management_client.py | 170 + .../azure/mgmt/billing/_configuration.py | 49 + .../mgmt/billing/billing_management_client.py | 96 - .../azure/mgmt/billing/models/__init__.py | 325 +- .../_billing_management_client_enums.py | 251 ++ .../azure/mgmt/billing/models/_models.py | 3351 +++++++++++++++++ .../azure/mgmt/billing/models/_models_py3.py | 3351 +++++++++++++++++ .../mgmt/billing/models/_paged_models.py | 157 + .../mgmt/billing/models/billing_period.py | 59 - .../billing/models/billing_period_paged.py | 27 - .../azure/mgmt/billing/models/download_url.py | 41 - .../mgmt/billing/models/enrollment_account.py | 47 - .../models/enrollment_account_paged.py | 27 - .../mgmt/billing/models/error_details.py | 45 - .../mgmt/billing/models/error_response.py | 42 - .../azure/mgmt/billing/models/invoice.py | 65 - .../mgmt/billing/models/invoice_paged.py | 27 - .../azure/mgmt/billing/models/operation.py | 39 - .../mgmt/billing/models/operation_display.py | 46 - .../mgmt/billing/models/operation_paged.py | 27 - .../azure/mgmt/billing/models/resource.py | 45 - .../azure/mgmt/billing/operations/__init__.py | 52 +- .../billing/operations/_address_operations.py | 96 + .../operations/_agreements_operations.py | 164 + .../_available_balances_operations.py | 103 + .../_billing_accounts_operations.py | 328 ++ .../_billing_permissions_operations.py | 282 ++ .../_billing_profiles_operations.py | 401 ++ .../_billing_property_operations.py | 95 + .../_billing_role_assignments_operations.py | 856 +++++ .../_billing_role_definitions_operations.py | 432 +++ .../_billing_subscriptions_operations.py | 667 ++++ .../operations/_customers_operations.py | 270 ++ .../operations/_departments_operations.py | 181 + .../_enrollment_accounts_operations.py | 182 + ...rations.py => _instructions_operations.py} | 176 +- .../_invoice_sections_operations.py | 467 +++ .../operations/_invoices_operations.py | 385 ++ .../{operations.py => _operations.py} | 29 +- .../_partner_transfers_operations.py | 328 ++ .../operations/_payment_methods_operations.py | 183 + .../operations/_policies_operations.py | 304 ++ .../operations/_price_sheet_operations.py | 261 ++ .../operations/_products_operations.py | 644 ++++ .../_recipient_transfers_operations.py | 340 ++ .../operations/_transactions_operations.py | 531 +++ .../operations/_transfers_operations.py | 332 ++ .../operations/billing_periods_operations.py | 184 - .../enrollment_accounts_operations.py | 154 - 50 files changed, 15620 insertions(+), 1101 deletions(-) create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_billing_management_client.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_configuration.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_billing_management_client_enums.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models_py3.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_paged_models.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_period.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_period_paged.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/download_url.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/enrollment_account.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/enrollment_account_paged.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/error_details.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/error_response.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/invoice.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/invoice_paged.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation_display.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation_paged.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/resource.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_address_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_agreements_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_available_balances_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_accounts_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_permissions_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_profiles_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_property_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_assignments_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_definitions_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_subscriptions_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_customers_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_departments_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_enrollment_accounts_operations.py rename sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/{invoices_operations.py => _instructions_operations.py} (51%) create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoice_sections_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoices_operations.py rename sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/{operations.py => _operations.py} (77%) create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_partner_transfers_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_payment_methods_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_policies_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_price_sheet_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_products_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_recipient_transfers_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transactions_operations.py create mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transfers_operations.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py delete mode 100644 sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_operations.py diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/__init__.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/__init__.py index e66d83da6d0e..7d7730d3f261 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/__init__.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .billing_management_client import BillingManagementClient -from .version import VERSION +from ._configuration import BillingManagementClientConfiguration +from ._billing_management_client import BillingManagementClient +__all__ = ['BillingManagementClient', 'BillingManagementClientConfiguration'] -__all__ = ['BillingManagementClient'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_billing_management_client.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_billing_management_client.py new file mode 100644 index 000000000000..3570d1b88616 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_billing_management_client.py @@ -0,0 +1,170 @@ +# 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.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import BillingManagementClientConfiguration +from .operations import BillingAccountsOperations +from .operations import PaymentMethodsOperations +from .operations import AddressOperations +from .operations import AvailableBalancesOperations +from .operations import InstructionsOperations +from .operations import BillingProfilesOperations +from .operations import CustomersOperations +from .operations import InvoiceSectionsOperations +from .operations import BillingPermissionsOperations +from .operations import BillingSubscriptionsOperations +from .operations import ProductsOperations +from .operations import TransactionsOperations +from .operations import DepartmentsOperations +from .operations import EnrollmentAccountsOperations +from .operations import InvoicesOperations +from .operations import PriceSheetOperations +from .operations import PoliciesOperations +from .operations import BillingPropertyOperations +from .operations import TransfersOperations +from .operations import PartnerTransfersOperations +from .operations import RecipientTransfersOperations +from .operations import Operations +from .operations import BillingRoleDefinitionsOperations +from .operations import BillingRoleAssignmentsOperations +from .operations import AgreementsOperations +from . import models + + +class BillingManagementClient(SDKClient): + """Billing client provides access to billing resources for Azure subscriptions. + + :ivar config: Configuration for client. + :vartype config: BillingManagementClientConfiguration + + :ivar billing_accounts: BillingAccounts operations + :vartype billing_accounts: azure.mgmt.billing.operations.BillingAccountsOperations + :ivar payment_methods: PaymentMethods operations + :vartype payment_methods: azure.mgmt.billing.operations.PaymentMethodsOperations + :ivar address: Address operations + :vartype address: azure.mgmt.billing.operations.AddressOperations + :ivar available_balances: AvailableBalances operations + :vartype available_balances: azure.mgmt.billing.operations.AvailableBalancesOperations + :ivar instructions: Instructions operations + :vartype instructions: azure.mgmt.billing.operations.InstructionsOperations + :ivar billing_profiles: BillingProfiles operations + :vartype billing_profiles: azure.mgmt.billing.operations.BillingProfilesOperations + :ivar customers: Customers operations + :vartype customers: azure.mgmt.billing.operations.CustomersOperations + :ivar invoice_sections: InvoiceSections operations + :vartype invoice_sections: azure.mgmt.billing.operations.InvoiceSectionsOperations + :ivar billing_permissions: BillingPermissions operations + :vartype billing_permissions: azure.mgmt.billing.operations.BillingPermissionsOperations + :ivar billing_subscriptions: BillingSubscriptions operations + :vartype billing_subscriptions: azure.mgmt.billing.operations.BillingSubscriptionsOperations + :ivar products: Products operations + :vartype products: azure.mgmt.billing.operations.ProductsOperations + :ivar transactions: Transactions operations + :vartype transactions: azure.mgmt.billing.operations.TransactionsOperations + :ivar departments: Departments operations + :vartype departments: azure.mgmt.billing.operations.DepartmentsOperations + :ivar enrollment_accounts: EnrollmentAccounts operations + :vartype enrollment_accounts: azure.mgmt.billing.operations.EnrollmentAccountsOperations + :ivar invoices: Invoices operations + :vartype invoices: azure.mgmt.billing.operations.InvoicesOperations + :ivar price_sheet: PriceSheet operations + :vartype price_sheet: azure.mgmt.billing.operations.PriceSheetOperations + :ivar policies: Policies operations + :vartype policies: azure.mgmt.billing.operations.PoliciesOperations + :ivar billing_property: BillingProperty operations + :vartype billing_property: azure.mgmt.billing.operations.BillingPropertyOperations + :ivar transfers: Transfers operations + :vartype transfers: azure.mgmt.billing.operations.TransfersOperations + :ivar partner_transfers: PartnerTransfers operations + :vartype partner_transfers: azure.mgmt.billing.operations.PartnerTransfersOperations + :ivar recipient_transfers: RecipientTransfers operations + :vartype recipient_transfers: azure.mgmt.billing.operations.RecipientTransfersOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.billing.operations.Operations + :ivar billing_role_definitions: BillingRoleDefinitions operations + :vartype billing_role_definitions: azure.mgmt.billing.operations.BillingRoleDefinitionsOperations + :ivar billing_role_assignments: BillingRoleAssignments operations + :vartype billing_role_assignments: azure.mgmt.billing.operations.BillingRoleAssignmentsOperations + :ivar agreements: Agreements operations + :vartype agreements: azure.mgmt.billing.operations.AgreementsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID that uniquely identifies an Azure + subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = BillingManagementClientConfiguration(credentials, subscription_id, base_url) + super(BillingManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-10-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.billing_accounts = BillingAccountsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.payment_methods = PaymentMethodsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.address = AddressOperations( + self._client, self.config, self._serialize, self._deserialize) + self.available_balances = AvailableBalancesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.instructions = InstructionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.billing_profiles = BillingProfilesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.customers = CustomersOperations( + self._client, self.config, self._serialize, self._deserialize) + self.invoice_sections = InvoiceSectionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.billing_permissions = BillingPermissionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.billing_subscriptions = BillingSubscriptionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.products = ProductsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.transactions = TransactionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.departments = DepartmentsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.enrollment_accounts = EnrollmentAccountsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.invoices = InvoicesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.price_sheet = PriceSheetOperations( + self._client, self.config, self._serialize, self._deserialize) + self.policies = PoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.billing_property = BillingPropertyOperations( + self._client, self.config, self._serialize, self._deserialize) + self.transfers = TransfersOperations( + self._client, self.config, self._serialize, self._deserialize) + self.partner_transfers = PartnerTransfersOperations( + self._client, self.config, self._serialize, self._deserialize) + self.recipient_transfers = RecipientTransfersOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.billing_role_definitions = BillingRoleDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.billing_role_assignments = BillingRoleAssignmentsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.agreements = AgreementsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_configuration.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_configuration.py new file mode 100644 index 000000000000..3f493e942fb3 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_configuration.py @@ -0,0 +1,49 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class BillingManagementClientConfiguration(AzureConfiguration): + """Configuration for BillingManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID that uniquely identifies an Azure + subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(BillingManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-billing/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py deleted file mode 100644 index 7806b688963f..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.service_client import ServiceClient -from msrest import Serializer, Deserializer -from msrestazure import AzureConfiguration -from .version import VERSION -from .operations.enrollment_accounts_operations import EnrollmentAccountsOperations -from .operations.billing_periods_operations import BillingPeriodsOperations -from .operations.invoices_operations import InvoicesOperations -from .operations.operations import Operations -from . import models - - -class BillingManagementClientConfiguration(AzureConfiguration): - """Configuration for BillingManagementClient - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Azure Subscription ID. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(BillingManagementClientConfiguration, self).__init__(base_url) - - self.add_user_agent('azure-mgmt-billing/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials - self.subscription_id = subscription_id - - -class BillingManagementClient(object): - """Billing client provides access to billing resources for Azure subscriptions. - - :ivar config: Configuration for client. - :vartype config: BillingManagementClientConfiguration - - :ivar enrollment_accounts: EnrollmentAccounts operations - :vartype enrollment_accounts: azure.mgmt.billing.operations.EnrollmentAccountsOperations - :ivar billing_periods: BillingPeriods operations - :vartype billing_periods: azure.mgmt.billing.operations.BillingPeriodsOperations - :ivar invoices: Invoices operations - :vartype invoices: azure.mgmt.billing.operations.InvoicesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.billing.operations.Operations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Azure Subscription ID. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = BillingManagementClientConfiguration(credentials, subscription_id, base_url) - self._client = ServiceClient(self.config.credentials, self.config) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2018-03-01-preview' - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.enrollment_accounts = EnrollmentAccountsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.billing_periods = BillingPeriodsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.invoices = InvoicesOperations( - self._client, self.config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) 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 b49fd4a67883..15fd773ddd34 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 @@ -9,32 +9,321 @@ # regenerated. # -------------------------------------------------------------------------- -from .enrollment_account import EnrollmentAccount -from .billing_period import BillingPeriod -from .download_url import DownloadUrl -from .error_details import ErrorDetails -from .error_response import ErrorResponse, ErrorResponseException -from .invoice import Invoice -from .operation_display import OperationDisplay -from .operation import Operation -from .resource import Resource -from .enrollment_account_paged import EnrollmentAccountPaged -from .billing_period_paged import BillingPeriodPaged -from .invoice_paged import InvoicePaged -from .operation_paged import OperationPaged +try: + from ._models_py3 import AcceptTransferRequest + from ._models_py3 import AddressDetails + from ._models_py3 import Agreement + from ._models_py3 import AgreementListResult + from ._models_py3 import Amount + from ._models_py3 import AvailableBalance + from ._models_py3 import AzurePlan + from ._models_py3 import BillingAccount + from ._models_py3 import BillingAccountListResult + from ._models_py3 import BillingAccountUpdateRequest + from ._models_py3 import BillingPermissionsListResult + from ._models_py3 import BillingPermissionsProperties + from ._models_py3 import BillingProfile + from ._models_py3 import BillingProfileCreationRequest + from ._models_py3 import BillingProfileListResult + from ._models_py3 import BillingProperty + from ._models_py3 import BillingRoleAssignment + from ._models_py3 import BillingRoleAssignmentListResult + from ._models_py3 import BillingRoleAssignmentPayload + from ._models_py3 import BillingRoleDefinition + from ._models_py3 import BillingRoleDefinitionListResult + from ._models_py3 import BillingSubscription + from ._models_py3 import BillingSubscriptionsListResult + from ._models_py3 import Customer + from ._models_py3 import CustomerPolicy + from ._models_py3 import Department + from ._models_py3 import DepartmentListResult + from ._models_py3 import DetailedTransferStatus + from ._models_py3 import Document + from ._models_py3 import DownloadUrl + from ._models_py3 import Enrollment + from ._models_py3 import EnrollmentAccount + from ._models_py3 import EnrollmentAccountContext + from ._models_py3 import EnrollmentAccountListResult + from ._models_py3 import EnrollmentPolicies + from ._models_py3 import Error + from ._models_py3 import ErrorDetails + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import InitiateTransferRequest + from ._models_py3 import Instruction + from ._models_py3 import Invoice + from ._models_py3 import InvoiceListResult + from ._models_py3 import InvoiceSection + from ._models_py3 import InvoiceSectionCreationRequest + from ._models_py3 import InvoiceSectionListResult + from ._models_py3 import InvoiceSectionWithCreateSubPermission + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import Participants + from ._models_py3 import PaymentMethod + from ._models_py3 import PaymentProperties + from ._models_py3 import Policy + from ._models_py3 import Product + from ._models_py3 import ProductDetails + from ._models_py3 import ProductsListResult + from ._models_py3 import RecipientTransferDetails + from ._models_py3 import Reseller + from ._models_py3 import Resource + from ._models_py3 import Transaction + from ._models_py3 import TransactionListResult + from ._models_py3 import TransferBillingSubscriptionRequest + from ._models_py3 import TransferBillingSubscriptionRequestProperties + from ._models_py3 import TransferBillingSubscriptionResult + from ._models_py3 import TransferDetails + from ._models_py3 import TransferProductRequestProperties + from ._models_py3 import UpdateAutoRenewOperation + from ._models_py3 import UpdateAutoRenewRequest + from ._models_py3 import ValidateAddressResponse + from ._models_py3 import ValidateProductTransferEligibilityError + from ._models_py3 import ValidateProductTransferEligibilityResult + from ._models_py3 import ValidateSubscriptionTransferEligibilityError + from ._models_py3 import ValidateSubscriptionTransferEligibilityResult + from ._models_py3 import ValidateTransferListResponse + from ._models_py3 import ValidateTransferResponse + from ._models_py3 import ValidationResultProperties +except (SyntaxError, ImportError): + from ._models import AcceptTransferRequest + from ._models import AddressDetails + from ._models import Agreement + from ._models import AgreementListResult + from ._models import Amount + from ._models import AvailableBalance + from ._models import AzurePlan + from ._models import BillingAccount + from ._models import BillingAccountListResult + from ._models import BillingAccountUpdateRequest + from ._models import BillingPermissionsListResult + from ._models import BillingPermissionsProperties + from ._models import BillingProfile + from ._models import BillingProfileCreationRequest + from ._models import BillingProfileListResult + from ._models import BillingProperty + from ._models import BillingRoleAssignment + from ._models import BillingRoleAssignmentListResult + from ._models import BillingRoleAssignmentPayload + from ._models import BillingRoleDefinition + from ._models import BillingRoleDefinitionListResult + from ._models import BillingSubscription + from ._models import BillingSubscriptionsListResult + from ._models import Customer + from ._models import CustomerPolicy + from ._models import Department + from ._models import DepartmentListResult + from ._models import DetailedTransferStatus + from ._models import Document + from ._models import DownloadUrl + from ._models import Enrollment + from ._models import EnrollmentAccount + from ._models import EnrollmentAccountContext + from ._models import EnrollmentAccountListResult + from ._models import EnrollmentPolicies + from ._models import Error + from ._models import ErrorDetails + from ._models import ErrorResponse, ErrorResponseException + from ._models import InitiateTransferRequest + from ._models import Instruction + from ._models import Invoice + from ._models import InvoiceListResult + from ._models import InvoiceSection + from ._models import InvoiceSectionCreationRequest + from ._models import InvoiceSectionListResult + from ._models import InvoiceSectionWithCreateSubPermission + from ._models import Operation + from ._models import OperationDisplay + from ._models import Participants + from ._models import PaymentMethod + from ._models import PaymentProperties + from ._models import Policy + from ._models import Product + from ._models import ProductDetails + from ._models import ProductsListResult + from ._models import RecipientTransferDetails + from ._models import Reseller + from ._models import Resource + from ._models import Transaction + from ._models import TransactionListResult + from ._models import TransferBillingSubscriptionRequest + from ._models import TransferBillingSubscriptionRequestProperties + from ._models import TransferBillingSubscriptionResult + from ._models import TransferDetails + from ._models import TransferProductRequestProperties + from ._models import UpdateAutoRenewOperation + from ._models import UpdateAutoRenewRequest + from ._models import ValidateAddressResponse + from ._models import ValidateProductTransferEligibilityError + from ._models import ValidateProductTransferEligibilityResult + from ._models import ValidateSubscriptionTransferEligibilityError + from ._models import ValidateSubscriptionTransferEligibilityResult + from ._models import ValidateTransferListResponse + from ._models import ValidateTransferResponse + from ._models import ValidationResultProperties +from ._paged_models import BillingSubscriptionPaged +from ._paged_models import CustomerPaged +from ._paged_models import InstructionPaged +from ._paged_models import InvoicePaged +from ._paged_models import InvoiceSectionWithCreateSubPermissionPaged +from ._paged_models import OperationPaged +from ._paged_models import PaymentMethodPaged +from ._paged_models import ProductPaged +from ._paged_models import RecipientTransferDetailsPaged +from ._paged_models import TransactionPaged +from ._paged_models import TransferDetailsPaged +from ._billing_management_client_enums import ( + AddressValidationStatus, + ProductType, + TransferStatus, + ProductTransferStatus, + EligibleProductType, + SubscriptionTransferValidationErrorCode, + AgreementType, + CustomerType, + AccountType, + StatusReasonCode, + SpendingLimit, + BillingProfileStatus, + BillingProfileStatusReasonCode, + BillingProfileSpendingLimit, + InvoiceStatus, + InvoiceType, + DocumentType, + PaymentMethodFamily, + ProductStatusType, + BillingFrequency, + ProductTransferValidationErrorCode, + BillingSubscriptionStatusType, + TransactionTypeKind, + ReservationType, + MarketplacePurchasesPolicy, + ReservationPurchasesPolicy, + ViewChargesPolicy, + ViewCharges, + PaymentMethodType, + UpdateAutoRenew, + Category, + AcceptanceMode, +) __all__ = [ - 'EnrollmentAccount', - 'BillingPeriod', + 'AcceptTransferRequest', + 'AddressDetails', + 'Agreement', + 'AgreementListResult', + 'Amount', + 'AvailableBalance', + 'AzurePlan', + 'BillingAccount', + 'BillingAccountListResult', + 'BillingAccountUpdateRequest', + 'BillingPermissionsListResult', + 'BillingPermissionsProperties', + 'BillingProfile', + 'BillingProfileCreationRequest', + 'BillingProfileListResult', + 'BillingProperty', + 'BillingRoleAssignment', + 'BillingRoleAssignmentListResult', + 'BillingRoleAssignmentPayload', + 'BillingRoleDefinition', + 'BillingRoleDefinitionListResult', + 'BillingSubscription', + 'BillingSubscriptionsListResult', + 'Customer', + 'CustomerPolicy', + 'Department', + 'DepartmentListResult', + 'DetailedTransferStatus', + 'Document', 'DownloadUrl', + 'Enrollment', + 'EnrollmentAccount', + 'EnrollmentAccountContext', + 'EnrollmentAccountListResult', + 'EnrollmentPolicies', + 'Error', 'ErrorDetails', 'ErrorResponse', 'ErrorResponseException', + 'InitiateTransferRequest', + 'Instruction', 'Invoice', - 'OperationDisplay', + 'InvoiceListResult', + 'InvoiceSection', + 'InvoiceSectionCreationRequest', + 'InvoiceSectionListResult', + 'InvoiceSectionWithCreateSubPermission', 'Operation', + 'OperationDisplay', + 'Participants', + 'PaymentMethod', + 'PaymentProperties', + 'Policy', + 'Product', + 'ProductDetails', + 'ProductsListResult', + 'RecipientTransferDetails', + 'Reseller', 'Resource', - 'EnrollmentAccountPaged', - 'BillingPeriodPaged', + 'Transaction', + 'TransactionListResult', + 'TransferBillingSubscriptionRequest', + 'TransferBillingSubscriptionRequestProperties', + 'TransferBillingSubscriptionResult', + 'TransferDetails', + 'TransferProductRequestProperties', + 'UpdateAutoRenewOperation', + 'UpdateAutoRenewRequest', + 'ValidateAddressResponse', + 'ValidateProductTransferEligibilityError', + 'ValidateProductTransferEligibilityResult', + 'ValidateSubscriptionTransferEligibilityError', + 'ValidateSubscriptionTransferEligibilityResult', + 'ValidateTransferListResponse', + 'ValidateTransferResponse', + 'ValidationResultProperties', + 'InvoiceSectionWithCreateSubPermissionPaged', + 'PaymentMethodPaged', + 'InstructionPaged', + 'CustomerPaged', + 'BillingSubscriptionPaged', + 'ProductPaged', + 'TransactionPaged', 'InvoicePaged', + 'TransferDetailsPaged', + 'RecipientTransferDetailsPaged', 'OperationPaged', + 'AddressValidationStatus', + 'ProductType', + 'TransferStatus', + 'ProductTransferStatus', + 'EligibleProductType', + 'SubscriptionTransferValidationErrorCode', + 'AgreementType', + 'CustomerType', + 'AccountType', + 'StatusReasonCode', + 'SpendingLimit', + 'BillingProfileStatus', + 'BillingProfileStatusReasonCode', + 'BillingProfileSpendingLimit', + 'InvoiceStatus', + 'InvoiceType', + 'DocumentType', + 'PaymentMethodFamily', + 'ProductStatusType', + 'BillingFrequency', + 'ProductTransferValidationErrorCode', + 'BillingSubscriptionStatusType', + 'TransactionTypeKind', + 'ReservationType', + 'MarketplacePurchasesPolicy', + 'ReservationPurchasesPolicy', + 'ViewChargesPolicy', + 'ViewCharges', + 'PaymentMethodType', + 'UpdateAutoRenew', + 'Category', + 'AcceptanceMode', ] 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 new file mode 100644 index 000000000000..f364435db5a3 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_billing_management_client_enums.py @@ -0,0 +1,251 @@ +# 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 enum import Enum + + +class AddressValidationStatus(str, Enum): + + valid = "Valid" + invalid = "Invalid" + + +class ProductType(str, Enum): + + azure_subscription = "AzureSubscription" + azure_reservation = "AzureReservation" + + +class TransferStatus(str, Enum): + + pending = "Pending" + in_progress = "InProgress" + completed = "Completed" + completed_with_errors = "CompletedWithErrors" + failed = "Failed" + canceled = "Canceled" + declined = "Declined" + + +class ProductTransferStatus(str, Enum): + + not_started = "NotStarted" + in_progress = "InProgress" + completed = "Completed" + failed = "Failed" + + +class EligibleProductType(str, Enum): + + dev_test_azure_subscription = "DevTestAzureSubscription" + standard_azure_subscription = "StandardAzureSubscription" + 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 AgreementType(str, Enum): + + microsoft_customer_agreement = "MicrosoftCustomerAgreement" + enterprise_agreement = "EnterpriseAgreement" + microsoft_online_services_program = "MicrosoftOnlineServicesProgram" + microsoft_partner_agreement = "MicrosoftPartnerAgreement" + + +class CustomerType(str, Enum): + + enterprise = "Enterprise" + individual = "Individual" + partner = "Partner" + + +class AccountType(str, Enum): + + enterprise = "Enterprise" + individual = "Individual" + partner = "Partner" + + +class StatusReasonCode(str, Enum): + + past_due = "PastDue" + spending_limit_reached = "SpendingLimitReached" + spending_limit_expired = "SpendingLimitExpired" + + +class SpendingLimit(str, Enum): + + off = "Off" + on = "On" + + +class BillingProfileStatus(str, Enum): + + active = "Active" + disabled = "Disabled" + warned = "Warned" + + +class BillingProfileStatusReasonCode(str, Enum): + + past_due = "PastDue" + spending_limit_reached = "SpendingLimitReached" + spending_limit_expired = "SpendingLimitExpired" + + +class BillingProfileSpendingLimit(str, Enum): + + off = "Off" + on = "On" + + +class InvoiceStatus(str, Enum): + + due = "Due" + over_due = "OverDue" + paid = "Paid" + + +class InvoiceType(str, Enum): + + azure_service = "AzureService" + azure_marketplace = "AzureMarketplace" + azure_support = "AzureSupport" + + +class DocumentType(str, Enum): + + invoice = "Invoice" + void_note = "VoidNote" + tax_receipt = "TaxReceipt" + credit_note = "CreditNote" + + +class PaymentMethodFamily(str, Enum): + + credits = "Credits" + check_wire = "CheckWire" + credit_card = "CreditCard" + none = "None" + + +class ProductStatusType(str, Enum): + + active = "Active" + inactive = "Inactive" + past_due = "PastDue" + expiring = "Expiring" + expired = "Expired" + disabled = "Disabled" + cancelled = "Cancelled" + auto_renew = "AutoRenew" + + +class BillingFrequency(str, Enum): + + one_time = "OneTime" + monthly = "Monthly" + 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" + inactive = "Inactive" + abandoned = "Abandoned" + deleted = "Deleted" + warning = "Warning" + + +class TransactionTypeKind(str, Enum): + + all = "all" + reservation = "reservation" + + +class ReservationType(str, Enum): + + purchase = "Purchase" + usage_charge = "Usage Charge" + + +class MarketplacePurchasesPolicy(str, Enum): + + all_allowed = "AllAllowed" + only_free_allowed = "OnlyFreeAllowed" + not_allowed = "NotAllowed" + + +class ReservationPurchasesPolicy(str, Enum): + + allowed = "Allowed" + not_allowed = "NotAllowed" + + +class ViewChargesPolicy(str, Enum): + + allowed = "Allowed" + not_allowed = "NotAllowed" + + +class ViewCharges(str, Enum): + + allowed = "Allowed" + not_allowed = "NotAllowed" + + +class PaymentMethodType(str, Enum): + + credits = "Credits" + cheque_wire = "ChequeWire" + + +class UpdateAutoRenew(str, Enum): + + true = "true" + false = "false" + + +class Category(str, Enum): + + microsoft_customer_agreement = "MicrosoftCustomerAgreement" + affiliate_purchase_terms = "AffiliatePurchaseTerms" + other = "Other" + + +class AcceptanceMode(str, Enum): + + click_to_accept = "ClickToAccept" + esign_embedded = "ESignEmbedded" + esign_offline = "ESignOffline" diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models.py new file mode 100644 index 000000000000..1b5b2b30ccea --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models.py @@ -0,0 +1,3351 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class AcceptTransferRequest(Model): + """Request parameters to accept transfer. + + :param product_details: Request parameters to accept transfer. + :type product_details: list[~azure.mgmt.billing.models.ProductDetails] + """ + + _attribute_map = { + 'product_details': {'key': 'properties.productDetails', 'type': '[ProductDetails]'}, + } + + def __init__(self, **kwargs): + super(AcceptTransferRequest, self).__init__(**kwargs) + self.product_details = kwargs.get('product_details', None) + + +class AddressDetails(Model): + """Address details. + + :param first_name: First name. + :type first_name: str + :param last_name: Last name. + :type last_name: str + :param company_name: Company name. + :type company_name: str + :param address_line1: Address line 1. + :type address_line1: str + :param address_line2: Address line 2. + :type address_line2: str + :param address_line3: Address line 3. + :type address_line3: str + :param city: Address city. + :type city: str + :param region: Address region. + :type region: str + :param country: Country code uses ISO2, 2-digit format. + :type country: str + :param postal_code: Postal code. + :type postal_code: str + """ + + _attribute_map = { + 'first_name': {'key': 'firstName', 'type': 'str'}, + 'last_name': {'key': 'lastName', 'type': 'str'}, + 'company_name': {'key': 'companyName', 'type': 'str'}, + 'address_line1': {'key': 'addressLine1', 'type': 'str'}, + 'address_line2': {'key': 'addressLine2', 'type': 'str'}, + 'address_line3': {'key': 'addressLine3', 'type': 'str'}, + 'city': {'key': 'city', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + 'country': {'key': 'country', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AddressDetails, self).__init__(**kwargs) + self.first_name = kwargs.get('first_name', None) + self.last_name = kwargs.get('last_name', None) + self.company_name = kwargs.get('company_name', None) + self.address_line1 = kwargs.get('address_line1', None) + self.address_line2 = kwargs.get('address_line2', None) + self.address_line3 = kwargs.get('address_line3', None) + self.city = kwargs.get('city', None) + self.region = kwargs.get('region', None) + self.country = kwargs.get('country', None) + self.postal_code = kwargs.get('postal_code', None) + + +class Resource(Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class Agreement(Resource): + """An agreement. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar agreement_link: The URL to download the agreement. + :vartype agreement_link: str + :ivar category: The category of the agreement signed by a customer. + Possible values include: 'MicrosoftCustomerAgreement', + 'AffiliatePurchaseTerms', 'Other' + :vartype category: str or ~azure.mgmt.billing.models.Category + :ivar acceptance_mode: The mode of acceptance for an agreement. Possible + values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + :vartype acceptance_mode: str or ~azure.mgmt.billing.models.AcceptanceMode + :ivar effective_date: The date from which the agreement is effective. + :vartype effective_date: datetime + :ivar expiration_date: The date when the agreement expires. + :vartype expiration_date: datetime + :param participants: The list of participants that participates in + acceptance of an agreement. + :type participants: list[~azure.mgmt.billing.models.Participants] + :ivar status: The current status of the agreement. + :vartype status: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'agreement_link': {'readonly': True}, + 'category': {'readonly': True}, + 'acceptance_mode': {'readonly': True}, + 'effective_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'agreement_link': {'key': 'properties.agreementLink', 'type': 'str'}, + 'category': {'key': 'properties.category', 'type': 'str'}, + 'acceptance_mode': {'key': 'properties.acceptanceMode', 'type': 'str'}, + 'effective_date': {'key': 'properties.effectiveDate', 'type': 'iso-8601'}, + 'expiration_date': {'key': 'properties.expirationDate', 'type': 'iso-8601'}, + 'participants': {'key': 'properties.participants', 'type': '[Participants]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Agreement, self).__init__(**kwargs) + self.agreement_link = None + self.category = None + self.acceptance_mode = None + self.effective_date = None + self.expiration_date = None + self.participants = kwargs.get('participants', None) + self.status = None + + +class AgreementListResult(Model): + """Result of listing agreements. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of agreements. + :vartype value: list[~azure.mgmt.billing.models.Agreement] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Agreement]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AgreementListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Amount(Model): + """The amount. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar currency: The currency for the amount value. + :vartype currency: str + :param value: Amount value. + :type value: float + """ + + _validation = { + 'currency': {'readonly': True}, + } + + _attribute_map = { + 'currency': {'key': 'currency', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(Amount, self).__init__(**kwargs) + self.currency = None + self.value = kwargs.get('value', None) + + +class AvailableBalance(Resource): + """The latest Azure credit balance. This is the balance available for pay now. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar amount: Balance amount. + :vartype amount: ~azure.mgmt.billing.models.Amount + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'amount': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'amount': {'key': 'properties.amount', 'type': 'Amount'}, + } + + def __init__(self, **kwargs): + super(AvailableBalance, self).__init__(**kwargs) + self.amount = None + + +class AzurePlan(Model): + """Details of the Azure plan. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param sku_id: The sku id. + :type sku_id: str + :ivar sku_description: The sku description. + :vartype sku_description: str + """ + + _validation = { + 'sku_description': {'readonly': True}, + } + + _attribute_map = { + 'sku_id': {'key': 'skuId', 'type': 'str'}, + 'sku_description': {'key': 'skuDescription', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzurePlan, self).__init__(**kwargs) + self.sku_id = kwargs.get('sku_id', None) + self.sku_description = None + + +class BillingAccount(Resource): + """A billing account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar display_name: The billing account name. + :vartype display_name: str + :param address: The address associated with the billing account. + :type address: ~azure.mgmt.billing.models.AddressDetails + :ivar agreement_type: The type of agreement. Possible values include: + 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + :vartype agreement_type: str or ~azure.mgmt.billing.models.AgreementType + :ivar customer_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype customer_type: str or ~azure.mgmt.billing.models.CustomerType + :ivar account_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype account_type: str or ~azure.mgmt.billing.models.AccountType + :param billing_profiles: The billing profiles associated with the billing + account. By default this is not populated, unless it's specified in + $expand. + :type billing_profiles: list[~azure.mgmt.billing.models.BillingProfile] + :ivar enrollment_details: The details about the associated legacy + enrollment. By default this is not populated, unless it's specified in + $expand. + :vartype enrollment_details: ~azure.mgmt.billing.models.Enrollment + :param departments: The departments associated to the enrollment. + :type departments: list[~azure.mgmt.billing.models.Department] + :param enrollment_accounts: The accounts associated to the enrollment. + :type enrollment_accounts: + list[~azure.mgmt.billing.models.EnrollmentAccount] + :ivar organization_id: Organization id. + :vartype organization_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'agreement_type': {'readonly': True}, + 'customer_type': {'readonly': True}, + 'account_type': {'readonly': True}, + 'enrollment_details': {'readonly': True}, + 'organization_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'address': {'key': 'properties.address', 'type': 'AddressDetails'}, + 'agreement_type': {'key': 'properties.agreementType', 'type': 'str'}, + 'customer_type': {'key': 'properties.customerType', 'type': 'str'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'billing_profiles': {'key': 'properties.billingProfiles', 'type': '[BillingProfile]'}, + 'enrollment_details': {'key': 'properties.enrollmentDetails', 'type': 'Enrollment'}, + 'departments': {'key': 'properties.departments', 'type': '[Department]'}, + 'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'}, + 'organization_id': {'key': 'properties.organizationId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingAccount, self).__init__(**kwargs) + self.display_name = None + self.address = kwargs.get('address', None) + self.agreement_type = None + self.customer_type = None + self.account_type = None + self.billing_profiles = kwargs.get('billing_profiles', None) + self.enrollment_details = None + self.departments = kwargs.get('departments', None) + self.enrollment_accounts = kwargs.get('enrollment_accounts', None) + self.organization_id = None + + +class BillingAccountListResult(Model): + """The list of billing accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of billing accounts. + :vartype value: list[~azure.mgmt.billing.models.BillingAccount] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingAccount]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingAccountListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class BillingAccountUpdateRequest(Model): + """The request properties of the billing account that can be updated. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar display_name: The billing account name. + :vartype display_name: str + :param address: The address associated with the billing account. + :type address: ~azure.mgmt.billing.models.AddressDetails + :ivar agreement_type: The type of agreement. Possible values include: + 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + :vartype agreement_type: str or ~azure.mgmt.billing.models.AgreementType + :ivar customer_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype customer_type: str or ~azure.mgmt.billing.models.CustomerType + :ivar account_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype account_type: str or ~azure.mgmt.billing.models.AccountType + :param billing_profiles: The billing profiles associated with the billing + account. By default this is not populated, unless it's specified in + $expand. + :type billing_profiles: list[~azure.mgmt.billing.models.BillingProfile] + :ivar enrollment_details: The details about the associated legacy + enrollment. By default this is not populated, unless it's specified in + $expand. + :vartype enrollment_details: ~azure.mgmt.billing.models.Enrollment + :param departments: The departments associated to the enrollment. + :type departments: list[~azure.mgmt.billing.models.Department] + :param enrollment_accounts: The accounts associated to the enrollment. + :type enrollment_accounts: + list[~azure.mgmt.billing.models.EnrollmentAccount] + :ivar organization_id: Organization id. + :vartype organization_id: str + """ + + _validation = { + 'display_name': {'readonly': True}, + 'agreement_type': {'readonly': True}, + 'customer_type': {'readonly': True}, + 'account_type': {'readonly': True}, + 'enrollment_details': {'readonly': True}, + 'organization_id': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'address': {'key': 'properties.address', 'type': 'AddressDetails'}, + 'agreement_type': {'key': 'properties.agreementType', 'type': 'str'}, + 'customer_type': {'key': 'properties.customerType', 'type': 'str'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'billing_profiles': {'key': 'properties.billingProfiles', 'type': '[BillingProfile]'}, + 'enrollment_details': {'key': 'properties.enrollmentDetails', 'type': 'Enrollment'}, + 'departments': {'key': 'properties.departments', 'type': '[Department]'}, + 'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'}, + 'organization_id': {'key': 'properties.organizationId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingAccountUpdateRequest, self).__init__(**kwargs) + self.display_name = None + self.address = kwargs.get('address', None) + self.agreement_type = None + self.customer_type = None + self.account_type = None + self.billing_profiles = kwargs.get('billing_profiles', None) + self.enrollment_details = None + self.departments = kwargs.get('departments', None) + self.enrollment_accounts = kwargs.get('enrollment_accounts', None) + self.organization_id = None + + +class BillingPermissionsListResult(Model): + """Result of list billingPermissions a caller has on a billing account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of billingPermissions a caller has on a billing + account. + :vartype value: + list[~azure.mgmt.billing.models.BillingPermissionsProperties] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingPermissionsProperties]'}, + } + + def __init__(self, **kwargs): + super(BillingPermissionsListResult, self).__init__(**kwargs) + self.value = None + + +class BillingPermissionsProperties(Model): + """The set of allowed action and not allowed actions a caller has on a billing + account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar actions: The set of actions that the caller is allowed to perform. + :vartype actions: list[str] + :ivar not_actions: The set of actions that the caller is not allowed to + perform. + :vartype not_actions: list[str] + """ + + _validation = { + 'actions': {'readonly': True}, + 'not_actions': {'readonly': True}, + } + + _attribute_map = { + 'actions': {'key': 'actions', 'type': '[str]'}, + 'not_actions': {'key': 'notActions', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(BillingPermissionsProperties, self).__init__(**kwargs) + self.actions = None + self.not_actions = None + + +class BillingProfile(Resource): + """A billing profile. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: The name of the billing profile. + :type display_name: str + :param po_number: The purchase order name that will appear on the invoices + generated for the billing profile. + :type po_number: str + :param address: Billing address. + :type address: ~azure.mgmt.billing.models.AddressDetails + :param invoice_email_opt_in: Flag controlling whether the invoices for the + billing profile are sent through email. + :type invoice_email_opt_in: bool + :ivar invoice_day: The day of the month when the invoice for the billing + profile is generated. + :vartype invoice_day: int + :ivar currency: The currency in which the charges for the billing profile + are billed. + :vartype currency: str + :param enabled_azure_plans: Information about the enabled azure plans. + :type enabled_azure_plans: list[~azure.mgmt.billing.models.AzurePlan] + :param invoice_sections: The invoice sections associated to the billing + profile. + :type invoice_sections: list[~azure.mgmt.billing.models.InvoiceSection] + :ivar status: The status of the billing profile. + :vartype status: object + :ivar status_reason_code: Reason for the specified billing profile status. + Possible values include: 'PastDue', 'SpendingLimitReached', + 'SpendingLimitExpired' + :vartype status_reason_code: str or + ~azure.mgmt.billing.models.StatusReasonCode + :ivar spending_limit: The billing profile spending limit. Possible values + include: 'Off', 'On' + :vartype spending_limit: str or ~azure.mgmt.billing.models.SpendingLimit + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'invoice_day': {'readonly': True}, + 'currency': {'readonly': True}, + 'status': {'readonly': True}, + 'status_reason_code': {'readonly': True}, + 'spending_limit': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'po_number': {'key': 'properties.poNumber', 'type': 'str'}, + 'address': {'key': 'properties.address', 'type': 'AddressDetails'}, + 'invoice_email_opt_in': {'key': 'properties.invoiceEmailOptIn', 'type': 'bool'}, + 'invoice_day': {'key': 'properties.invoiceDay', 'type': 'int'}, + 'currency': {'key': 'properties.currency', 'type': 'str'}, + 'enabled_azure_plans': {'key': 'properties.enabledAzurePlans', 'type': '[AzurePlan]'}, + 'invoice_sections': {'key': 'properties.invoiceSections', 'type': '[InvoiceSection]'}, + 'status': {'key': 'properties.status', 'type': 'object'}, + 'status_reason_code': {'key': 'properties.statusReasonCode', 'type': 'str'}, + 'spending_limit': {'key': 'properties.spendingLimit', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingProfile, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.po_number = kwargs.get('po_number', None) + self.address = kwargs.get('address', None) + self.invoice_email_opt_in = kwargs.get('invoice_email_opt_in', None) + self.invoice_day = None + self.currency = None + self.enabled_azure_plans = kwargs.get('enabled_azure_plans', None) + self.invoice_sections = kwargs.get('invoice_sections', None) + self.status = None + self.status_reason_code = None + self.spending_limit = None + + +class BillingProfileCreationRequest(Model): + """The request parameters for creating a new billing profile. + + :param display_name: The name of the billing profile. + :type display_name: str + :param po_number: The purchase order name that will appear on the invoices + generated for the billing profile. + :type po_number: str + :param address: Billing address. + :type address: ~azure.mgmt.billing.models.AddressDetails + :param invoice_email_opt_in: Flag controlling whether the invoices for the + billing profile are sent through email. + :type invoice_email_opt_in: bool + :param enabled_azure_plans: Enabled azure plans for the billing profile. + :type enabled_azure_plans: list[~azure.mgmt.billing.models.AzurePlan] + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'po_number': {'key': 'poNumber', 'type': 'str'}, + 'address': {'key': 'address', 'type': 'AddressDetails'}, + 'invoice_email_opt_in': {'key': 'invoiceEmailOptIn', 'type': 'bool'}, + 'enabled_azure_plans': {'key': 'enabledAzurePlans', 'type': '[AzurePlan]'}, + } + + def __init__(self, **kwargs): + super(BillingProfileCreationRequest, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.po_number = kwargs.get('po_number', None) + self.address = kwargs.get('address', None) + self.invoice_email_opt_in = kwargs.get('invoice_email_opt_in', None) + self.enabled_azure_plans = kwargs.get('enabled_azure_plans', None) + + +class BillingProfileListResult(Model): + """The list of billing profiles. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of billing profiles. + :vartype value: list[~azure.mgmt.billing.models.BillingProfile] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingProfile]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingProfileListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class BillingProperty(Resource): + """A billing property. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar billing_tenant_id: The Azure AD tenant ID of the billing account for + the subscription. + :vartype billing_tenant_id: str + :ivar billing_account_id: The ID of the billing account to which the + subscription is billed. + :vartype billing_account_id: str + :ivar billing_account_display_name: The name of the billing account to + which the subscription is billed. + :vartype billing_account_display_name: str + :ivar billing_profile_id: The ID of the billing profile to which the + subscription is billed. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile to + which the subscription is billed. + :vartype billing_profile_display_name: str + :ivar billing_profile_status: The status of the billing profile. Possible + values include: 'Active', 'Disabled', 'Warned' + :vartype billing_profile_status: str or + ~azure.mgmt.billing.models.BillingProfileStatus + :ivar billing_profile_status_reason_code: Reason for the specified billing + profile status. + :vartype billing_profile_status_reason_code: object + :ivar billing_profile_spending_limit: The billing profile spending limit. + :vartype billing_profile_spending_limit: object + :ivar cost_center: The cost center applied to the subscription. + :vartype cost_center: str + :ivar invoice_section_id: The ID of the invoice section to which the + subscription is billed. + :vartype invoice_section_id: str + :ivar invoice_section_display_name: The name of the invoice section to + which the subscription is billed. + :vartype invoice_section_display_name: str + :ivar product_id: The product ID of the Azure plan. + :vartype product_id: str + :ivar product_name: The product name of the Azure plan. + :vartype product_name: str + :ivar sku_id: The sku ID of the Azure plan for the subscription. + :vartype sku_id: str + :ivar sku_description: The sku description of the Azure plan for the + subscription. + :vartype sku_description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'billing_tenant_id': {'readonly': True}, + 'billing_account_id': {'readonly': True}, + 'billing_account_display_name': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'billing_profile_status': {'readonly': True}, + 'billing_profile_status_reason_code': {'readonly': True}, + 'billing_profile_spending_limit': {'readonly': True}, + 'cost_center': {'readonly': True}, + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'product_id': {'readonly': True}, + 'product_name': {'readonly': True}, + 'sku_id': {'readonly': True}, + 'sku_description': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'billing_tenant_id': {'key': 'properties.billingTenantId', 'type': 'str'}, + 'billing_account_id': {'key': 'properties.billingAccountId', 'type': 'str'}, + 'billing_account_display_name': {'key': 'properties.billingAccountDisplayName', 'type': 'str'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', 'type': 'str'}, + 'billing_profile_status': {'key': 'properties.billingProfileStatus', 'type': 'str'}, + 'billing_profile_status_reason_code': {'key': 'properties.billingProfileStatusReasonCode', 'type': 'object'}, + 'billing_profile_spending_limit': {'key': 'properties.billingProfileSpendingLimit', 'type': 'object'}, + 'cost_center': {'key': 'properties.costCenter', 'type': 'str'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'properties.invoiceSectionDisplayName', 'type': 'str'}, + 'product_id': {'key': 'properties.productId', 'type': 'str'}, + 'product_name': {'key': 'properties.productName', 'type': 'str'}, + 'sku_id': {'key': 'properties.skuId', 'type': 'str'}, + 'sku_description': {'key': 'properties.skuDescription', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingProperty, self).__init__(**kwargs) + self.billing_tenant_id = None + self.billing_account_id = None + self.billing_account_display_name = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.billing_profile_status = None + self.billing_profile_status_reason_code = None + self.billing_profile_spending_limit = None + self.cost_center = None + self.invoice_section_id = None + self.invoice_section_display_name = None + self.product_id = None + self.product_name = None + self.sku_id = None + self.sku_description = None + + +class BillingRoleAssignment(Resource): + """The role assignment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar created_on: The date the role assignment was created. + :vartype created_on: str + :ivar created_by_principal_tenant_id: The tenant Id of the user who + created the role assignment. + :vartype created_by_principal_tenant_id: str + :ivar created_by_principal_id: The principal Id of the user who created + the role assignment. + :vartype created_by_principal_id: str + :ivar billing_role_assignment_name: The name of the role assignment. + :vartype billing_role_assignment_name: str + :ivar principal_id: The principal id of the user to whom the role was + assigned. + :vartype principal_id: str + :ivar role_definition_name: The ID of the role definition. + :vartype role_definition_name: str + :ivar scope: The scope at which the role was assigned. + :vartype scope: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_on': {'readonly': True}, + 'created_by_principal_tenant_id': {'readonly': True}, + 'created_by_principal_id': {'readonly': True}, + 'billing_role_assignment_name': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'role_definition_name': {'readonly': True}, + 'scope': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'str'}, + 'created_by_principal_tenant_id': {'key': 'properties.createdByPrincipalTenantId', 'type': 'str'}, + 'created_by_principal_id': {'key': 'properties.createdByPrincipalId', 'type': 'str'}, + 'billing_role_assignment_name': {'key': 'properties.name', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'role_definition_name': {'key': 'properties.roleDefinitionName', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingRoleAssignment, self).__init__(**kwargs) + self.created_on = None + self.created_by_principal_tenant_id = None + self.created_by_principal_id = None + self.billing_role_assignment_name = None + self.principal_id = None + self.role_definition_name = None + self.scope = None + + +class BillingRoleAssignmentListResult(Model): + """The list of role assignments. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of role assignments. + :vartype value: list[~azure.mgmt.billing.models.BillingRoleAssignment] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingRoleAssignment]'}, + } + + def __init__(self, **kwargs): + super(BillingRoleAssignmentListResult, self).__init__(**kwargs) + self.value = None + + +class BillingRoleAssignmentPayload(Model): + """The payload use to update role assignment on a scope. + + :param principal_id: The user's principal id that the role gets assigned + to + :type principal_id: str + :param billing_role_definition_id: The role definition id + :type billing_role_definition_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'billing_role_definition_id': {'key': 'billingRoleDefinitionId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingRoleAssignmentPayload, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.billing_role_definition_id = kwargs.get('billing_role_definition_id', None) + + +class BillingRoleDefinition(Resource): + """The properties of a role definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar description: The role description + :vartype description: str + :param permissions: The billingPermissions the role has + :type permissions: + list[~azure.mgmt.billing.models.BillingPermissionsProperties] + :ivar role_name: The name of the role + :vartype role_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'role_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'permissions': {'key': 'properties.permissions', 'type': '[BillingPermissionsProperties]'}, + 'role_name': {'key': 'properties.roleName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingRoleDefinition, self).__init__(**kwargs) + self.description = None + self.permissions = kwargs.get('permissions', None) + self.role_name = None + + +class BillingRoleDefinitionListResult(Model): + """The list of role definitions. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The role definitions. + :vartype value: list[~azure.mgmt.billing.models.BillingRoleDefinition] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingRoleDefinition]'}, + } + + def __init__(self, **kwargs): + super(BillingRoleDefinitionListResult, self).__init__(**kwargs) + self.value = None + + +class BillingSubscription(Resource): + """A billing subscription. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar display_name: The name of the subscription. + :vartype display_name: str + :ivar subscription_id: The ID of the subscription. + :vartype subscription_id: str + :param subscription_billing_status: The current billing status of the + subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', + 'Deleted', 'Warning' + :type subscription_billing_status: str or + ~azure.mgmt.billing.models.BillingSubscriptionStatusType + :ivar last_month_charges: The last month charges. + :vartype last_month_charges: ~azure.mgmt.billing.models.Amount + :ivar month_to_date_charges: The current month to date charges. + :vartype month_to_date_charges: ~azure.mgmt.billing.models.Amount + :ivar billing_profile_id: The ID of the billing profile to which the + subscription is billed. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile to + which the subscription is billed. + :vartype billing_profile_display_name: str + :ivar customer_id: The ID of the customer for whom the subscription was + created. The field is applicable only for Microsoft Partner Agreement + billing account. + :vartype customer_id: str + :ivar customer_display_name: The name of the customer for whom the + subscription was created. The field is applicable only for Microsoft + Partner Agreement billing account. + :vartype customer_display_name: str + :ivar invoice_section_id: The ID of the invoice section to which the + subscription is billed. + :vartype invoice_section_id: str + :ivar invoice_section_display_name: The name of the invoice section to + which the subscription is billed. + :vartype invoice_section_display_name: str + :ivar reseller: Reseller for this subscription. + :vartype reseller: ~azure.mgmt.billing.models.Reseller + :param sku_id: The sku ID of the Azure plan for the subscription. + :type sku_id: str + :ivar sku_description: The sku description of the Azure plan for the + subscription. + :vartype sku_description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'subscription_id': {'readonly': True}, + 'last_month_charges': {'readonly': True}, + 'month_to_date_charges': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'customer_id': {'readonly': True}, + 'customer_display_name': {'readonly': True}, + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'reseller': {'readonly': True}, + 'sku_description': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + 'subscription_billing_status': {'key': 'properties.subscriptionBillingStatus', 'type': 'str'}, + 'last_month_charges': {'key': 'properties.lastMonthCharges', 'type': 'Amount'}, + 'month_to_date_charges': {'key': 'properties.monthToDateCharges', 'type': 'Amount'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', 'type': 'str'}, + 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, + 'customer_display_name': {'key': 'properties.customerDisplayName', 'type': 'str'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'properties.invoiceSectionDisplayName', 'type': 'str'}, + 'reseller': {'key': 'properties.reseller', 'type': 'Reseller'}, + 'sku_id': {'key': 'properties.skuId', 'type': 'str'}, + 'sku_description': {'key': 'properties.skuDescription', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingSubscription, self).__init__(**kwargs) + self.display_name = None + self.subscription_id = None + self.subscription_billing_status = kwargs.get('subscription_billing_status', None) + self.last_month_charges = None + self.month_to_date_charges = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.customer_id = None + self.customer_display_name = None + self.invoice_section_id = None + self.invoice_section_display_name = None + self.reseller = None + self.sku_id = kwargs.get('sku_id', None) + self.sku_description = None + + +class BillingSubscriptionsListResult(Model): + """The list of billing subscriptions. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of billing subscriptions. + :vartype value: list[~azure.mgmt.billing.models.BillingSubscription] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BillingSubscriptionsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Customer(Resource): + """A partner's customer. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: The name of the customer. + :type display_name: str + :param enabled_azure_plans: Azure plans enabled for the customer. + :type enabled_azure_plans: list[~azure.mgmt.billing.models.AzurePlan] + :param resellers: The list of resellers for which an Azure plan is enabled + for the customer. + :type resellers: list[~azure.mgmt.billing.models.Reseller] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'enabled_azure_plans': {'key': 'properties.enabledAzurePlans', 'type': '[AzurePlan]'}, + 'resellers': {'key': 'properties.resellers', 'type': '[Reseller]'}, + } + + def __init__(self, **kwargs): + super(Customer, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.enabled_azure_plans = kwargs.get('enabled_azure_plans', None) + self.resellers = kwargs.get('resellers', None) + + +class CustomerPolicy(Resource): + """The customer's Policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param view_charges: The policy that controls whether the users in + customer's organization can view charges at pay-as-you-go prices. Possible + values include: 'Allowed', 'NotAllowed' + :type view_charges: str or ~azure.mgmt.billing.models.ViewCharges + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'view_charges': {'key': 'properties.viewCharges', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CustomerPolicy, self).__init__(**kwargs) + self.view_charges = kwargs.get('view_charges', None) + + +class Department(Resource): + """A department. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param department_name: The name of the department. + :type department_name: str + :param cost_center: The cost center associated with the department. + :type cost_center: str + :param status: The status of the department. + :type status: str + :param enrollment_accounts: Associated enrollment accounts. By default + this is not populated, unless it's specified in $expand. + :type enrollment_accounts: + list[~azure.mgmt.billing.models.EnrollmentAccount] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'department_name': {'key': 'properties.departmentName', 'type': 'str'}, + 'cost_center': {'key': 'properties.costCenter', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'}, + } + + def __init__(self, **kwargs): + super(Department, self).__init__(**kwargs) + self.department_name = kwargs.get('department_name', None) + self.cost_center = kwargs.get('cost_center', None) + self.status = kwargs.get('status', None) + self.enrollment_accounts = kwargs.get('enrollment_accounts', None) + + +class DepartmentListResult(Model): + """The list of departments. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of departments. + :vartype value: list[~azure.mgmt.billing.models.Department] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Department]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DepartmentListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class DetailedTransferStatus(Model): + """Detailed transfer status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar product_type: Type of product that is transferred. Possible values + include: 'AzureSubscription', 'AzureReservation' + :vartype product_type: str or ~azure.mgmt.billing.models.ProductType + :ivar product_id: The ID of the product that is transferred. + :vartype product_id: str + :ivar transfer_status: Transfer status. Possible values include: + 'NotStarted', 'InProgress', 'Completed', 'Failed' + :vartype transfer_status: str or + ~azure.mgmt.billing.models.ProductTransferStatus + :param error_details: Error details for transfer execution. + :type error_details: ~azure.mgmt.billing.models.Error + """ + + _validation = { + 'product_type': {'readonly': True}, + 'product_id': {'readonly': True}, + 'transfer_status': {'readonly': True}, + } + + _attribute_map = { + 'product_type': {'key': 'productType', 'type': 'str'}, + 'product_id': {'key': 'productId', 'type': 'str'}, + 'transfer_status': {'key': 'transferStatus', 'type': 'str'}, + 'error_details': {'key': 'errorDetails', 'type': 'Error'}, + } + + def __init__(self, **kwargs): + super(DetailedTransferStatus, self).__init__(**kwargs) + self.product_type = None + self.product_id = None + self.transfer_status = None + self.error_details = kwargs.get('error_details', None) + + +class Document(Model): + """The properties of a document. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar kind: The type of the document. Possible values include: 'Invoice', + 'VoidNote', 'TaxReceipt', 'CreditNote' + :vartype kind: str or ~azure.mgmt.billing.models.DocumentType + :ivar url: Document URL. + :vartype url: str + """ + + _validation = { + 'kind': {'readonly': True}, + 'url': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Document, self).__init__(**kwargs) + self.kind = None + self.url = None + + +class DownloadUrl(Model): + """A secure URL that can be used to download a an entity until the URL + expires. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar expiry_time: The time in UTC when the download URL will expire. + :vartype expiry_time: datetime + :ivar url: The URL to the PDF file. + :vartype url: str + """ + + _validation = { + 'expiry_time': {'readonly': True}, + 'url': {'readonly': True}, + } + + _attribute_map = { + 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DownloadUrl, self).__init__(**kwargs) + self.expiry_time = None + self.url = None + + +class Enrollment(Model): + """The properties of an enrollment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param start_date: The start date of the enrollment. + :type start_date: datetime + :param end_date: The end date of the enrollment. + :type end_date: datetime + :ivar currency: The billing currency for the enrollment. + :vartype currency: str + :ivar channel: The channel type of the enrollment. + :vartype channel: str + :ivar policies: The policies for Enterprise Agreement enrollments. + :vartype policies: ~azure.mgmt.billing.models.EnrollmentPolicies + :ivar language: The language for the enrollment. + :vartype language: str + :ivar country_code: The country code of the enrollment. + :vartype country_code: str + :ivar status: The current status of the enrollment. + :vartype status: str + :ivar billing_cycle: The billing cycle for the enrollment. + :vartype billing_cycle: str + """ + + _validation = { + 'currency': {'readonly': True}, + 'channel': {'readonly': True}, + 'policies': {'readonly': True}, + 'language': {'readonly': True}, + 'country_code': {'readonly': True}, + 'status': {'readonly': True}, + 'billing_cycle': {'readonly': True}, + } + + _attribute_map = { + 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, + 'currency': {'key': 'currency', 'type': 'str'}, + 'channel': {'key': 'channel', 'type': 'str'}, + 'policies': {'key': 'policies', 'type': 'EnrollmentPolicies'}, + 'language': {'key': 'language', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'billing_cycle': {'key': 'billingCycle', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Enrollment, self).__init__(**kwargs) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.currency = None + self.channel = None + self.policies = None + self.language = None + self.country_code = None + self.status = None + self.billing_cycle = None + + +class EnrollmentAccount(Resource): + """An enrollment account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param account_name: The name of the enrollment account. + :type account_name: str + :param cost_center: The cost center associated with the enrollment + account. + :type cost_center: str + :param account_owner: The owner of the enrollment account. + :type account_owner: str + :param status: The status of the enrollment account. + :type status: str + :param start_date: The start date of the enrollment account. + :type start_date: datetime + :param end_date: The end date of the enrollment account. + :type end_date: datetime + :param department: Associated department. By default this is not + populated, unless it's specified in $expand. + :type department: ~azure.mgmt.billing.models.Department + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'account_name': {'key': 'properties.accountName', 'type': 'str'}, + 'cost_center': {'key': 'properties.costCenter', 'type': 'str'}, + 'account_owner': {'key': 'properties.accountOwner', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'start_date': {'key': 'properties.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.endDate', 'type': 'iso-8601'}, + 'department': {'key': 'properties.department', 'type': 'Department'}, + } + + def __init__(self, **kwargs): + super(EnrollmentAccount, self).__init__(**kwargs) + self.account_name = kwargs.get('account_name', None) + self.cost_center = kwargs.get('cost_center', None) + self.account_owner = kwargs.get('account_owner', None) + self.status = kwargs.get('status', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.department = kwargs.get('department', None) + + +class EnrollmentAccountContext(Model): + """The enrollment account context. + + :param cost_center: The cost center associated with the enrollment + account. + :type cost_center: str + :param start_date: The start date of the enrollment account. + :type start_date: datetime + :param end_date: The end date of the enrollment account. + :type end_date: datetime + :param enrollment_account_name: The ID of the enrollment account. + :type enrollment_account_name: str + """ + + _attribute_map = { + 'cost_center': {'key': 'costCenter', 'type': 'str'}, + 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, + 'enrollment_account_name': {'key': 'enrollmentAccountName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EnrollmentAccountContext, self).__init__(**kwargs) + self.cost_center = kwargs.get('cost_center', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.enrollment_account_name = kwargs.get('enrollment_account_name', None) + + +class EnrollmentAccountListResult(Model): + """The list of enrollment accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of enrollment accounts. + :vartype value: list[~azure.mgmt.billing.models.EnrollmentAccount] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EnrollmentAccount]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EnrollmentAccountListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class EnrollmentPolicies(Model): + """The policies for Enterprise Agreement enrollments. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar account_owner_view_charges: The policy that controls whether Account + Owners can view charges. + :vartype account_owner_view_charges: bool + :ivar department_admin_view_charges: The policy that controls whether + Department Administrators can view charges. + :vartype department_admin_view_charges: bool + :ivar marketplaces_enabled: The policy that controls whether Azure + marketplace purchases are allowed in the enrollment. + :vartype marketplaces_enabled: bool + :ivar reserved_instances_enabled: The policy that controls whether Azure + reservation purchases are allowed in the enrollment. + :vartype reserved_instances_enabled: bool + """ + + _validation = { + 'account_owner_view_charges': {'readonly': True}, + 'department_admin_view_charges': {'readonly': True}, + 'marketplaces_enabled': {'readonly': True}, + 'reserved_instances_enabled': {'readonly': True}, + } + + _attribute_map = { + 'account_owner_view_charges': {'key': 'accountOwnerViewCharges', 'type': 'bool'}, + 'department_admin_view_charges': {'key': 'departmentAdminViewCharges', 'type': 'bool'}, + 'marketplaces_enabled': {'key': 'marketplacesEnabled', 'type': 'bool'}, + 'reserved_instances_enabled': {'key': 'reservedInstancesEnabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(EnrollmentPolicies, self).__init__(**kwargs) + self.account_owner_view_charges = None + self.department_admin_view_charges = None + self.marketplaces_enabled = None + self.reserved_instances_enabled = None + + +class Error(Model): + """Error details for transfer execution. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar error_code: Error code. + :vartype error_code: str + :ivar error_message: Error message. + :vartype error_message: str + """ + + _validation = { + 'error_code': {'readonly': True}, + 'error_message': {'readonly': True}, + } + + _attribute_map = { + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.error_code = None + self.error_message = None + + +class ErrorDetails(Model): + """The details of the error. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + + +class ErrorResponse(Model): + """Error response indicates that the service is not able to process the + incoming request. The reason is provided in the error message. + + :param error: The details of the error. + :type error: ~azure.mgmt.billing.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class InitiateTransferRequest(Model): + """Request parameters to initiate transfer. + + :param recipient_email_id: The email ID of the recipient to whom the + transfer request is sent. + :type recipient_email_id: str + :param reseller_id: Optional MPN ID of the reseller for transfer requests + that are sent from a Microsoft Partner Agreement billing account. + :type reseller_id: str + """ + + _attribute_map = { + 'recipient_email_id': {'key': 'properties.recipientEmailId', 'type': 'str'}, + 'reseller_id': {'key': 'properties.resellerId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(InitiateTransferRequest, self).__init__(**kwargs) + self.recipient_email_id = kwargs.get('recipient_email_id', None) + self.reseller_id = kwargs.get('reseller_id', None) + + +class Instruction(Resource): + """An instruction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param amount: Required. The amount budgeted for this billing instruction. + :type amount: float + :param start_date: Required. The date this billing instruction goes into + effect. + :type start_date: datetime + :param end_date: Required. The date this billing instruction is no longer + in effect. + :type end_date: datetime + :param creation_date: The date this billing instruction was created. + :type creation_date: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'amount': {'required': True}, + 'start_date': {'required': True}, + 'end_date': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'amount': {'key': 'properties.amount', 'type': 'float'}, + 'start_date': {'key': 'properties.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.endDate', 'type': 'iso-8601'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(Instruction, self).__init__(**kwargs) + self.amount = kwargs.get('amount', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.creation_date = kwargs.get('creation_date', None) + + +class Invoice(Resource): + """An invoice. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar due_date: The due date for the invoice. + :vartype due_date: datetime + :ivar invoice_date: The date when the invoice was generated. + :vartype invoice_date: datetime + :ivar status: The current status of the invoice. Possible values include: + 'Due', 'OverDue', 'Paid' + :vartype status: str or ~azure.mgmt.billing.models.InvoiceStatus + :ivar amount_due: The amount due as of now. + :vartype amount_due: ~azure.mgmt.billing.models.Amount + :ivar azure_prepayment_applied: The amount of Azure prepayment applied to + the charges. This field is applicable to billing accounts with agreement + type Microsoft Customer Agreement. + :vartype azure_prepayment_applied: ~azure.mgmt.billing.models.Amount + :ivar billed_amount: The total charges for the invoice billing period. + :vartype billed_amount: ~azure.mgmt.billing.models.Amount + :ivar credit_amount: The total refund for returns and cancellations during + the invoice billing period. This field is applicable to billing accounts + with agreement type Microsoft Customer Agreement. + :vartype credit_amount: ~azure.mgmt.billing.models.Amount + :ivar free_azure_credit_applied: The amount of free Azure credits applied + to the charges. This field is applicable to billing accounts with + agreement type Microsoft Customer Agreement. + :vartype free_azure_credit_applied: ~azure.mgmt.billing.models.Amount + :ivar sub_total: The pre-tax amount due. This field is applicable to + billing accounts with agreement type Microsoft Customer Agreement. + :vartype sub_total: ~azure.mgmt.billing.models.Amount + :ivar tax_amount: The amount of tax charged for the billing period. This + field is applicable to billing accounts with agreement type Microsoft + Customer Agreement. + :vartype tax_amount: ~azure.mgmt.billing.models.Amount + :ivar total_amount: The amount due when the invoice was generated. This + field is applicable to billing accounts with agreement type Microsoft + Customer Agreement. + :vartype total_amount: ~azure.mgmt.billing.models.Amount + :ivar invoice_period_start_date: The start date of the billing period for + which the invoice is generated. + :vartype invoice_period_start_date: datetime + :ivar invoice_period_end_date: The end date of the billing period for + which the invoice is generated. + :vartype invoice_period_end_date: datetime + :ivar invoice_type: Invoice type. Possible values include: 'AzureService', + 'AzureMarketplace', 'AzureSupport' + :vartype invoice_type: str or ~azure.mgmt.billing.models.InvoiceType + :ivar is_monthly_invoice: Specifies if the invoice is generated as part of + monthly invoicing cycle or not. This field is applicable to billing + accounts with agreement type Microsoft Customer Agreement. + :vartype is_monthly_invoice: bool + :ivar billing_profile_id: The ID of the billing profile for which the + invoice is generated. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile for + which the invoice is generated. + :vartype billing_profile_display_name: str + :ivar purchase_order_number: An optional purchase order number for the + invoice. + :vartype purchase_order_number: str + :ivar documents: List of documents available to download such as invoice + and tax receipt. + :vartype documents: list[~azure.mgmt.billing.models.Document] + :ivar payments: List of payments. + :vartype payments: list[~azure.mgmt.billing.models.PaymentProperties] + :ivar subscription_id: The ID of the subscription for which the invoice is + generated. + :vartype subscription_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'due_date': {'readonly': True}, + 'invoice_date': {'readonly': True}, + 'status': {'readonly': True}, + 'amount_due': {'readonly': True}, + 'azure_prepayment_applied': {'readonly': True}, + 'billed_amount': {'readonly': True}, + 'credit_amount': {'readonly': True}, + 'free_azure_credit_applied': {'readonly': True}, + 'sub_total': {'readonly': True}, + 'tax_amount': {'readonly': True}, + 'total_amount': {'readonly': True}, + 'invoice_period_start_date': {'readonly': True}, + 'invoice_period_end_date': {'readonly': True}, + 'invoice_type': {'readonly': True}, + 'is_monthly_invoice': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'purchase_order_number': {'readonly': True}, + 'documents': {'readonly': True}, + 'payments': {'readonly': True}, + 'subscription_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'due_date': {'key': 'properties.dueDate', 'type': 'iso-8601'}, + 'invoice_date': {'key': 'properties.invoiceDate', 'type': 'iso-8601'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'amount_due': {'key': 'properties.amountDue', 'type': 'Amount'}, + 'azure_prepayment_applied': {'key': 'properties.azurePrepaymentApplied', 'type': 'Amount'}, + 'billed_amount': {'key': 'properties.billedAmount', 'type': 'Amount'}, + 'credit_amount': {'key': 'properties.creditAmount', 'type': 'Amount'}, + 'free_azure_credit_applied': {'key': 'properties.freeAzureCreditApplied', 'type': 'Amount'}, + 'sub_total': {'key': 'properties.subTotal', 'type': 'Amount'}, + 'tax_amount': {'key': 'properties.taxAmount', 'type': 'Amount'}, + 'total_amount': {'key': 'properties.totalAmount', 'type': 'Amount'}, + 'invoice_period_start_date': {'key': 'properties.invoicePeriodStartDate', 'type': 'iso-8601'}, + 'invoice_period_end_date': {'key': 'properties.invoicePeriodEndDate', 'type': 'iso-8601'}, + 'invoice_type': {'key': 'properties.invoiceType', 'type': 'str'}, + 'is_monthly_invoice': {'key': 'properties.isMonthlyInvoice', 'type': 'bool'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', 'type': 'str'}, + 'purchase_order_number': {'key': 'properties.purchaseOrderNumber', 'type': 'str'}, + 'documents': {'key': 'properties.documents', 'type': '[Document]'}, + 'payments': {'key': 'properties.payments', 'type': '[PaymentProperties]'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Invoice, self).__init__(**kwargs) + self.due_date = None + self.invoice_date = None + self.status = None + self.amount_due = None + self.azure_prepayment_applied = None + self.billed_amount = None + self.credit_amount = None + self.free_azure_credit_applied = None + self.sub_total = None + self.tax_amount = None + self.total_amount = None + self.invoice_period_start_date = None + self.invoice_period_end_date = None + self.invoice_type = None + self.is_monthly_invoice = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.purchase_order_number = None + self.documents = None + self.payments = None + self.subscription_id = None + + +class InvoiceListResult(Model): + """The list of invoices. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of invoices. + :vartype value: list[~azure.mgmt.billing.models.Invoice] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Invoice]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(InvoiceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class InvoiceSection(Resource): + """An invoice section. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: The name of the invoice section. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(InvoiceSection, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + + +class InvoiceSectionCreationRequest(Model): + """The properties of the invoice section. + + :param display_name: The name of the invoice section. + :type display_name: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(InvoiceSectionCreationRequest, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + + +class InvoiceSectionListResult(Model): + """The list of invoice sections. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of invoice sections. + :vartype value: list[~azure.mgmt.billing.models.InvoiceSection] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InvoiceSection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(InvoiceSectionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class InvoiceSectionWithCreateSubPermission(Model): + """Invoice section properties with create subscription permission. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar invoice_section_id: The ID of the invoice section. + :vartype invoice_section_id: str + :ivar invoice_section_display_name: The name of the invoice section. + :vartype invoice_section_display_name: str + :ivar billing_profile_id: The ID of the billing profile for the invoice + section. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile for + the invoice section. + :vartype billing_profile_display_name: str + :ivar billing_profile_status: The status of the billing profile. + :vartype billing_profile_status: object + :ivar billing_profile_status_reason_code: Reason for the specified billing + profile status. Possible values include: 'PastDue', + 'SpendingLimitReached', 'SpendingLimitExpired' + :vartype billing_profile_status_reason_code: str or + ~azure.mgmt.billing.models.BillingProfileStatusReasonCode + :ivar billing_profile_spending_limit: The billing profile spending limit. + Possible values include: 'Off', 'On' + :vartype billing_profile_spending_limit: str or + ~azure.mgmt.billing.models.BillingProfileSpendingLimit + :param enabled_azure_plans: Enabled azure plans for the associated billing + profile. + :type enabled_azure_plans: list[~azure.mgmt.billing.models.AzurePlan] + """ + + _validation = { + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'billing_profile_status': {'readonly': True}, + 'billing_profile_status_reason_code': {'readonly': True}, + 'billing_profile_spending_limit': {'readonly': True}, + } + + _attribute_map = { + 'invoice_section_id': {'key': 'invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'invoiceSectionDisplayName', 'type': 'str'}, + 'billing_profile_id': {'key': 'billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'billingProfileDisplayName', 'type': 'str'}, + 'billing_profile_status': {'key': 'billingProfileStatus', 'type': 'object'}, + 'billing_profile_status_reason_code': {'key': 'billingProfileStatusReasonCode', 'type': 'str'}, + 'billing_profile_spending_limit': {'key': 'billingProfileSpendingLimit', 'type': 'str'}, + 'enabled_azure_plans': {'key': 'enabledAzurePlans', 'type': '[AzurePlan]'}, + } + + def __init__(self, **kwargs): + super(InvoiceSectionWithCreateSubPermission, self).__init__(**kwargs) + self.invoice_section_id = None + self.invoice_section_display_name = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.billing_profile_status = None + self.billing_profile_status_reason_code = None + self.billing_profile_spending_limit = None + self.enabled_azure_plans = kwargs.get('enabled_azure_plans', None) + + +class Operation(Model): + """A Billing REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.billing.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: Service provider: Microsoft.Billing. + :vartype provider: str + :ivar resource: Resource on which the operation is performed such as + invoice and billing subscription. + :vartype resource: str + :ivar operation: Operation type such as read, write and delete. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class Participants(Model): + """The details about a participant. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar status: The acceptance status of the participant. + :vartype status: str + :ivar status_date: The date when the status got changed. + :vartype status_date: datetime + :ivar email: The email address of the participant. + :vartype email: str + """ + + _validation = { + 'status': {'readonly': True}, + 'status_date': {'readonly': True}, + 'email': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'status_date': {'key': 'statusDate', 'type': 'iso-8601'}, + 'email': {'key': 'email', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Participants, self).__init__(**kwargs) + self.status = None + self.status_date = None + self.email = None + + +class PaymentMethod(Resource): + """A payment method. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param payment_method_type: The type of payment method. Possible values + include: 'Credits', 'ChequeWire' + :type payment_method_type: str or + ~azure.mgmt.billing.models.PaymentMethodType + :ivar details: Details about the payment method. + :vartype details: str + :ivar expiration: Expiration month and year. + :vartype expiration: str + :ivar currency: The currency associated with the payment method. + :vartype currency: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'details': {'readonly': True}, + 'expiration': {'readonly': True}, + 'currency': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'payment_method_type': {'key': 'properties.paymentMethodType', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'str'}, + 'expiration': {'key': 'properties.expiration', 'type': 'str'}, + 'currency': {'key': 'properties.currency', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PaymentMethod, self).__init__(**kwargs) + self.payment_method_type = kwargs.get('payment_method_type', None) + self.details = None + self.expiration = None + self.currency = None + + +class PaymentProperties(Model): + """The properties of a payment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar payment_type: The type of payment. + :vartype payment_type: str + :ivar amount: The paid amount. + :vartype amount: ~azure.mgmt.billing.models.Amount + :ivar date_property: The date when the payment was made. + :vartype date_property: datetime + :param payment_method_family: The family of payment method. Possible + values include: 'Credits', 'CheckWire', 'CreditCard', 'None' + :type payment_method_family: str or + ~azure.mgmt.billing.models.PaymentMethodFamily + :ivar payment_method_type: The type of payment method. + :vartype payment_method_type: str + """ + + _validation = { + 'payment_type': {'readonly': True}, + 'amount': {'readonly': True}, + 'date_property': {'readonly': True}, + 'payment_method_type': {'readonly': True}, + } + + _attribute_map = { + 'payment_type': {'key': 'paymentType', 'type': 'str'}, + 'amount': {'key': 'amount', 'type': 'Amount'}, + 'date_property': {'key': 'date', 'type': 'iso-8601'}, + 'payment_method_family': {'key': 'paymentMethodFamily', 'type': 'str'}, + 'payment_method_type': {'key': 'paymentMethodType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PaymentProperties, self).__init__(**kwargs) + self.payment_type = None + self.amount = None + self.date_property = None + self.payment_method_family = kwargs.get('payment_method_family', None) + self.payment_method_type = None + + +class Policy(Resource): + """A policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param marketplace_purchases: The policy that controls whether Azure + marketplace purchases are allowed for a billing profile. Possible values + include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + :type marketplace_purchases: str or + ~azure.mgmt.billing.models.MarketplacePurchasesPolicy + :param reservation_purchases: The policy that controls whether Azure + reservation purchases are allowed for a billing profile. Possible values + include: 'Allowed', 'NotAllowed' + :type reservation_purchases: str or + ~azure.mgmt.billing.models.ReservationPurchasesPolicy + :param view_charges: The policy that controls whether users with Azure + RBAC access to a subscription can view its charges. Possible values + include: 'Allowed', 'NotAllowed' + :type view_charges: str or ~azure.mgmt.billing.models.ViewChargesPolicy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'marketplace_purchases': {'key': 'properties.marketplacePurchases', 'type': 'str'}, + 'reservation_purchases': {'key': 'properties.reservationPurchases', 'type': 'str'}, + 'view_charges': {'key': 'properties.viewCharges', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Policy, self).__init__(**kwargs) + self.marketplace_purchases = kwargs.get('marketplace_purchases', None) + self.reservation_purchases = kwargs.get('reservation_purchases', None) + self.view_charges = kwargs.get('view_charges', None) + + +class Product(Resource): + """A product. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar display_name: The display name of the product. + :vartype display_name: str + :ivar purchase_date: The date when the product was purchased. + :vartype purchase_date: datetime + :ivar product_type_id: The ID of the type of product. + :vartype product_type_id: str + :ivar product_type: The description of the type of product. + :vartype product_type: str + :param status: The current status of the product. Possible values include: + 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', + 'Cancelled', 'AutoRenew' + :type status: str or ~azure.mgmt.billing.models.ProductStatusType + :ivar end_date: The date when the product will be renewed or canceled. + :vartype end_date: datetime + :param billing_frequency: The frequency at which the product will be + billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased' + :type billing_frequency: str or + ~azure.mgmt.billing.models.BillingFrequency + :ivar last_charge: The last month charges. + :vartype last_charge: ~azure.mgmt.billing.models.Amount + :ivar last_charge_date: The date of the last charge. + :vartype last_charge_date: datetime + :ivar quantity: The quantity purchased for the product. + :vartype quantity: float + :ivar sku_id: The sku ID of the product. + :vartype sku_id: str + :ivar sku_description: The sku description of the product. + :vartype sku_description: str + :ivar tenant_id: The id of the tenant in which the product is used. + :vartype tenant_id: str + :ivar availability_id: The availability of the product. + :vartype availability_id: str + :ivar parent_product_id: Parent product Id. + :vartype parent_product_id: str + :ivar invoice_section_id: The ID of the invoice section to which the + product is billed. + :vartype invoice_section_id: str + :ivar invoice_section_display_name: The name of the invoice section to + which the product is billed. + :vartype invoice_section_display_name: str + :ivar billing_profile_id: The ID of the billing profile to which the + product is billed. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile to + which the product is billed. + :vartype billing_profile_display_name: str + :ivar customer_id: The ID of the customer for whom the product was + purchased. The field is applicable only for Microsoft Partner Agreement + billing account. + :vartype customer_id: str + :ivar customer_display_name: The name of the customer for whom the product + was purchased. The field is applicable only for Microsoft Partner + Agreement billing account. + :vartype customer_display_name: str + :ivar reseller: Reseller for this product. + :vartype reseller: ~azure.mgmt.billing.models.Reseller + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'purchase_date': {'readonly': True}, + 'product_type_id': {'readonly': True}, + 'product_type': {'readonly': True}, + 'end_date': {'readonly': True}, + 'last_charge': {'readonly': True}, + 'last_charge_date': {'readonly': True}, + 'quantity': {'readonly': True}, + 'sku_id': {'readonly': True}, + 'sku_description': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'availability_id': {'readonly': True}, + 'parent_product_id': {'readonly': True}, + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'customer_id': {'readonly': True}, + 'customer_display_name': {'readonly': True}, + 'reseller': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'purchase_date': {'key': 'properties.purchaseDate', 'type': 'iso-8601'}, + 'product_type_id': {'key': 'properties.productTypeId', 'type': 'str'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'end_date': {'key': 'properties.endDate', 'type': 'iso-8601'}, + 'billing_frequency': {'key': 'properties.billingFrequency', 'type': 'str'}, + 'last_charge': {'key': 'properties.lastCharge', 'type': 'Amount'}, + 'last_charge_date': {'key': 'properties.lastChargeDate', 'type': 'iso-8601'}, + 'quantity': {'key': 'properties.quantity', 'type': 'float'}, + 'sku_id': {'key': 'properties.skuId', 'type': 'str'}, + 'sku_description': {'key': 'properties.skuDescription', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'availability_id': {'key': 'properties.availabilityId', 'type': 'str'}, + 'parent_product_id': {'key': 'properties.parentProductId', 'type': 'str'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'properties.invoiceSectionDisplayName', 'type': 'str'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', 'type': 'str'}, + 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, + 'customer_display_name': {'key': 'properties.customerDisplayName', 'type': 'str'}, + 'reseller': {'key': 'properties.reseller', 'type': 'Reseller'}, + } + + def __init__(self, **kwargs): + super(Product, self).__init__(**kwargs) + self.display_name = None + self.purchase_date = None + self.product_type_id = None + self.product_type = None + self.status = kwargs.get('status', None) + self.end_date = None + self.billing_frequency = kwargs.get('billing_frequency', None) + self.last_charge = None + self.last_charge_date = None + self.quantity = None + self.sku_id = None + self.sku_description = None + self.tenant_id = None + self.availability_id = None + self.parent_product_id = None + self.invoice_section_id = None + self.invoice_section_display_name = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.customer_id = None + self.customer_display_name = None + self.reseller = None + + +class ProductDetails(Model): + """Details of the product that is transferred. + + :param product_type: Type of the product that is transferred. Possible + values include: 'AzureSubscription', 'AzureReservation' + :type product_type: str or ~azure.mgmt.billing.models.ProductType + :param product_id: The ID of the product that is transferred. + :type product_id: str + """ + + _attribute_map = { + 'product_type': {'key': 'productType', 'type': 'str'}, + 'product_id': {'key': 'productId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProductDetails, self).__init__(**kwargs) + self.product_type = kwargs.get('product_type', None) + self.product_id = kwargs.get('product_id', None) + + +class ProductsListResult(Model): + """The list of products. It contains a list of available product summaries in + reverse chronological order by purchase date. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of products. + :vartype value: list[~azure.mgmt.billing.models.Product] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Product]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProductsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class RecipientTransferDetails(Model): + """Details of the transfer. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar creation_time: The time at which the transfer request was created. + :vartype creation_time: datetime + :ivar expiration_time: The time at which the transfer request expires. + :vartype expiration_time: datetime + :ivar allowed_product_type: Type of subscriptions that can be transferred. + :vartype allowed_product_type: list[str or + ~azure.mgmt.billing.models.EligibleProductType] + :ivar transfer_status: Overall transfer status. Possible values include: + 'Pending', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', + 'Canceled', 'Declined' + :vartype transfer_status: str or ~azure.mgmt.billing.models.TransferStatus + :ivar recipient_email_id: The email ID of the user to whom the transfer + request was sent. + :vartype recipient_email_id: str + :ivar initiator_email_id: The email ID of the user who sent the transfer + request. + :vartype initiator_email_id: str + :ivar reseller_id: Optional MPN ID of the reseller for transfer requests + that are sent from a Microsoft Partner Agreement billing account. + :vartype reseller_id: str + :ivar reseller_name: Optional name of the reseller for transfer requests + that are sent from Microsoft Partner Agreement billing account. + :vartype reseller_name: str + :ivar initiator_customer_type: The type of customer who sent the transfer + request. + :vartype initiator_customer_type: str + :ivar canceled_by: The email ID of the user who canceled the transfer + request. + :vartype canceled_by: str + :ivar last_modified_time: The time at which the transfer request was last + modified. + :vartype last_modified_time: datetime + :ivar detailed_transfer_status: Detailed transfer status. + :vartype detailed_transfer_status: + list[~azure.mgmt.billing.models.DetailedTransferStatus] + """ + + _validation = { + 'creation_time': {'readonly': True}, + 'expiration_time': {'readonly': True}, + 'allowed_product_type': {'readonly': True}, + 'transfer_status': {'readonly': True}, + 'recipient_email_id': {'readonly': True}, + 'initiator_email_id': {'readonly': True}, + 'reseller_id': {'readonly': True}, + 'reseller_name': {'readonly': True}, + 'initiator_customer_type': {'readonly': True}, + 'canceled_by': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'detailed_transfer_status': {'readonly': True}, + } + + _attribute_map = { + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'expiration_time': {'key': 'properties.expirationTime', 'type': 'iso-8601'}, + 'allowed_product_type': {'key': 'properties.allowedProductType', 'type': '[str]'}, + 'transfer_status': {'key': 'properties.transferStatus', 'type': 'str'}, + 'recipient_email_id': {'key': 'properties.recipientEmailId', 'type': 'str'}, + 'initiator_email_id': {'key': 'properties.initiatorEmailId', 'type': 'str'}, + 'reseller_id': {'key': 'properties.resellerId', 'type': 'str'}, + 'reseller_name': {'key': 'properties.resellerName', 'type': 'str'}, + 'initiator_customer_type': {'key': 'properties.initiatorCustomerType', 'type': 'str'}, + 'canceled_by': {'key': 'properties.canceledBy', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'detailed_transfer_status': {'key': 'properties.detailedTransferStatus', 'type': '[DetailedTransferStatus]'}, + } + + def __init__(self, **kwargs): + super(RecipientTransferDetails, self).__init__(**kwargs) + self.creation_time = None + self.expiration_time = None + self.allowed_product_type = None + self.transfer_status = None + self.recipient_email_id = None + self.initiator_email_id = None + self.reseller_id = None + self.reseller_name = None + self.initiator_customer_type = None + self.canceled_by = None + self.last_modified_time = None + self.detailed_transfer_status = None + + +class Reseller(Model): + """Details of the reseller. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar reseller_id: The MPN ID of the reseller. + :vartype reseller_id: str + :ivar description: The name of the reseller. + :vartype description: str + """ + + _validation = { + 'reseller_id': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'reseller_id': {'key': 'resellerId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Reseller, self).__init__(**kwargs) + self.reseller_id = None + self.description = None + + +class Transaction(Resource): + """A transaction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param kind: The kind of transaction. Options are all or reservation. + Possible values include: 'all', 'reservation' + :type kind: str or ~azure.mgmt.billing.models.TransactionTypeKind + :ivar date_property: The date of transaction. + :vartype date_property: datetime + :ivar invoice: Invoice on which the transaction was billed or 'pending' if + the transaction is not billed. + :vartype invoice: str + :ivar order_id: The order ID of the reservation. The field is only + applicable for transaction of kind reservation. + :vartype order_id: str + :ivar order_name: The name of the reservation order. The field is only + applicable for transactions of kind reservation. + :vartype order_name: str + :ivar product_family: The family of the product for which the transaction + took place. + :vartype product_family: str + :ivar product_type_id: The ID of the product type for which the + transaction took place. + :vartype product_type_id: str + :ivar product_type: The type of the product for which the transaction took + place. + :vartype product_type: str + :ivar product_description: The description of the product for which the + transaction took place. + :vartype product_description: str + :param transaction_type: The type of transaction. Possible values include: + 'Purchase', 'Usage Charge' + :type transaction_type: str or ~azure.mgmt.billing.models.ReservationType + :ivar transaction_amount: The charge associated with the transaction. + :vartype transaction_amount: ~azure.mgmt.billing.models.Amount + :ivar quantity: The quantity purchased in the transaction. + :vartype quantity: int + :ivar invoice_section_id: The ID of the invoice section which will be + billed for the transaction. + :vartype invoice_section_id: str + :ivar invoice_section_display_name: The name of the invoice section which + will be billed for the transaction. + :vartype invoice_section_display_name: str + :ivar billing_profile_id: The ID of the billing profile which will be + billed for the transaction. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile which + will be billed for the transaction. + :vartype billing_profile_display_name: str + :ivar customer_id: The ID of the customer for which the transaction took + place. The field is applicable only for Microsoft Partner Agreement + billing account. + :vartype customer_id: str + :ivar customer_display_name: The name of the customer for which the + transaction took place. The field is applicable only for Microsoft Partner + Agreement billing account. + :vartype customer_display_name: str + :ivar subscription_id: The ID of the subscription that was used for the + transaction. The field is only applicable for transaction of kind + reservation. + :vartype subscription_id: str + :ivar subscription_name: The name of the subscription that was used for + the transaction. The field is only applicable for transaction of kind + reservation. + :vartype subscription_name: str + :ivar azure_credit_applied: The amount of any Azure credits automatically + applied to this transaction. + :vartype azure_credit_applied: ~azure.mgmt.billing.models.Amount + :ivar billing_currency: The ISO 4217 code for the currency in which this + transaction is billed. + :vartype billing_currency: str + :ivar discount: The percentage discount, if any, applied to this + transaction. + :vartype discount: float + :ivar effective_price: The price of the product after applying any + discounts. + :vartype effective_price: ~azure.mgmt.billing.models.Amount + :ivar exchange_rate: The exchange rate used to convert charged amount to + billing currency, if applicable. + :vartype exchange_rate: float + :ivar market_price: The retail price of the product. + :vartype market_price: ~azure.mgmt.billing.models.Amount + :ivar pricing_currency: The ISO 4217 code for the currency in which the + product is priced. + :vartype pricing_currency: str + :ivar service_period_start_date: The date of the purchase of the product, + or the start date of the month in which usage started. + :vartype service_period_start_date: datetime + :ivar service_period_end_date: The end date of the product term, or the + end date of the month in which usage ended. + :vartype service_period_end_date: datetime + :ivar sub_total: The pre-tax charged amount for the transaction. + :vartype sub_total: ~azure.mgmt.billing.models.Amount + :ivar tax: The tax amount applied to the transaction. + :vartype tax: ~azure.mgmt.billing.models.Amount + :ivar unit_of_measure: The unit of measure used to bill for the product. + For example, compute services are billed per hour. + :vartype unit_of_measure: str + :ivar units: The number of units used for a given product. + :vartype units: float + :ivar unit_type: The description for the unit of measure for a given + product. + :vartype unit_type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'date_property': {'readonly': True}, + 'invoice': {'readonly': True}, + 'order_id': {'readonly': True}, + 'order_name': {'readonly': True}, + 'product_family': {'readonly': True}, + 'product_type_id': {'readonly': True}, + 'product_type': {'readonly': True}, + 'product_description': {'readonly': True}, + 'transaction_amount': {'readonly': True}, + 'quantity': {'readonly': True}, + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'customer_id': {'readonly': True}, + 'customer_display_name': {'readonly': True}, + 'subscription_id': {'readonly': True}, + 'subscription_name': {'readonly': True}, + 'azure_credit_applied': {'readonly': True}, + 'billing_currency': {'readonly': True}, + 'discount': {'readonly': True}, + 'effective_price': {'readonly': True}, + 'exchange_rate': {'readonly': True}, + 'market_price': {'readonly': True}, + 'pricing_currency': {'readonly': True}, + 'service_period_start_date': {'readonly': True}, + 'service_period_end_date': {'readonly': True}, + 'sub_total': {'readonly': True}, + 'tax': {'readonly': True}, + 'unit_of_measure': {'readonly': True}, + 'units': {'readonly': True}, + 'unit_type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'properties.kind', 'type': 'str'}, + 'date_property': {'key': 'properties.date', 'type': 'iso-8601'}, + 'invoice': {'key': 'properties.invoice', 'type': 'str'}, + 'order_id': {'key': 'properties.orderId', 'type': 'str'}, + 'order_name': {'key': 'properties.orderName', 'type': 'str'}, + 'product_family': {'key': 'properties.productFamily', 'type': 'str'}, + 'product_type_id': {'key': 'properties.productTypeId', 'type': 'str'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, + 'product_description': {'key': 'properties.productDescription', 'type': 'str'}, + 'transaction_type': {'key': 'properties.transactionType', 'type': 'str'}, + 'transaction_amount': {'key': 'properties.transactionAmount', 'type': 'Amount'}, + 'quantity': {'key': 'properties.quantity', 'type': 'int'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'properties.invoiceSectionDisplayName', 'type': 'str'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', 'type': 'str'}, + 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, + 'customer_display_name': {'key': 'properties.customerDisplayName', 'type': 'str'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + 'subscription_name': {'key': 'properties.subscriptionName', 'type': 'str'}, + 'azure_credit_applied': {'key': 'properties.azureCreditApplied', 'type': 'Amount'}, + 'billing_currency': {'key': 'properties.billingCurrency', 'type': 'str'}, + 'discount': {'key': 'properties.discount', 'type': 'float'}, + 'effective_price': {'key': 'properties.effectivePrice', 'type': 'Amount'}, + 'exchange_rate': {'key': 'properties.exchangeRate', 'type': 'float'}, + 'market_price': {'key': 'properties.marketPrice', 'type': 'Amount'}, + 'pricing_currency': {'key': 'properties.pricingCurrency', 'type': 'str'}, + 'service_period_start_date': {'key': 'properties.servicePeriodStartDate', 'type': 'iso-8601'}, + 'service_period_end_date': {'key': 'properties.servicePeriodEndDate', 'type': 'iso-8601'}, + 'sub_total': {'key': 'properties.subTotal', 'type': 'Amount'}, + 'tax': {'key': 'properties.tax', 'type': 'Amount'}, + 'unit_of_measure': {'key': 'properties.unitOfMeasure', 'type': 'str'}, + 'units': {'key': 'properties.units', 'type': 'float'}, + 'unit_type': {'key': 'properties.unitType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Transaction, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) + self.date_property = None + self.invoice = None + self.order_id = None + self.order_name = None + self.product_family = None + self.product_type_id = None + self.product_type = None + self.product_description = None + self.transaction_type = kwargs.get('transaction_type', None) + self.transaction_amount = None + self.quantity = None + self.invoice_section_id = None + self.invoice_section_display_name = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.customer_id = None + self.customer_display_name = None + self.subscription_id = None + self.subscription_name = None + self.azure_credit_applied = None + self.billing_currency = None + self.discount = None + self.effective_price = None + self.exchange_rate = None + self.market_price = None + self.pricing_currency = None + self.service_period_start_date = None + self.service_period_end_date = None + self.sub_total = None + self.tax = None + self.unit_of_measure = None + self.units = None + self.unit_type = None + + +class TransactionListResult(Model): + """The list of transactions. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of transactions. + :vartype value: list[~azure.mgmt.billing.models.Transaction] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Transaction]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TransactionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class TransferBillingSubscriptionRequest(Model): + """Request parameters to transfer billing subscription. + + :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) + + +class TransferBillingSubscriptionRequestProperties(Model): + """Request parameters to transfer billing subscription. + + :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) + + +class TransferBillingSubscriptionResult(Model): + """Result of the transfer billing subscription operation. + + :param billing_subscription_name: The destination billing subscription id. + :type billing_subscription_name: str + """ + + _attribute_map = { + 'billing_subscription_name': {'key': 'properties.billingSubscriptionName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TransferBillingSubscriptionResult, self).__init__(**kwargs) + self.billing_subscription_name = kwargs.get('billing_subscription_name', None) + + +class TransferDetails(Model): + """Details of the transfer. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar creation_time: The time at which the transfer request was created. + :vartype creation_time: datetime + :ivar expiration_time: The time at which the transfer request expires. + :vartype expiration_time: datetime + :ivar invoice_section_id: The ID of the invoice section to which the + product is billed after the transfer request is completed. + :vartype invoice_section_id: str + :ivar billing_account_id: The ID of the billing account to which the + product is billed after the transfer request is completed. + :vartype billing_account_id: str + :ivar reseller_id: Optional MPN ID of the reseller for transfer requests + that are sent from a Microsoft Partner Agreement billing account. + :vartype reseller_id: str + :ivar reseller_name: Optional name of the reseller for transfer requests + that are sent from Microsoft Partner Agreement billing account. + :vartype reseller_name: str + :ivar initiator_customer_type: The type of customer who sent the transfer + request. + :vartype initiator_customer_type: str + :ivar billing_profile_id: The ID of the billing profile to which the + product will be billed after the transfer. + :vartype billing_profile_id: str + :ivar transfer_status: Overall transfer status. Possible values include: + 'Pending', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', + 'Canceled', 'Declined' + :vartype transfer_status: str or ~azure.mgmt.billing.models.TransferStatus + :ivar recipient_email_id: The email ID of the user to whom the transfer + request was sent. + :vartype recipient_email_id: str + :ivar initiator_email_id: The email ID of the user who sent the transfer + request. + :vartype initiator_email_id: str + :ivar canceled_by: The email ID of the user who canceled the transfer + request. + :vartype canceled_by: str + :ivar last_modified_time: The time at which the transfer request was last + modified. + :vartype last_modified_time: datetime + :ivar detailed_transfer_status: Detailed transfer status. + :vartype detailed_transfer_status: + list[~azure.mgmt.billing.models.DetailedTransferStatus] + """ + + _validation = { + 'creation_time': {'readonly': True}, + 'expiration_time': {'readonly': True}, + 'invoice_section_id': {'readonly': True}, + 'billing_account_id': {'readonly': True}, + 'reseller_id': {'readonly': True}, + 'reseller_name': {'readonly': True}, + 'initiator_customer_type': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'transfer_status': {'readonly': True}, + 'recipient_email_id': {'readonly': True}, + 'initiator_email_id': {'readonly': True}, + 'canceled_by': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'detailed_transfer_status': {'readonly': True}, + } + + _attribute_map = { + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'expiration_time': {'key': 'properties.expirationTime', 'type': 'iso-8601'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'billing_account_id': {'key': 'properties.billingAccountId', 'type': 'str'}, + 'reseller_id': {'key': 'properties.resellerId', 'type': 'str'}, + 'reseller_name': {'key': 'properties.resellerName', 'type': 'str'}, + 'initiator_customer_type': {'key': 'properties.initiatorCustomerType', 'type': 'str'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'transfer_status': {'key': 'properties.transferStatus', 'type': 'str'}, + 'recipient_email_id': {'key': 'properties.recipientEmailId', 'type': 'str'}, + 'initiator_email_id': {'key': 'properties.initiatorEmailId', 'type': 'str'}, + 'canceled_by': {'key': 'properties.canceledBy', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'detailed_transfer_status': {'key': 'properties.detailedTransferStatus', 'type': '[DetailedTransferStatus]'}, + } + + def __init__(self, **kwargs): + super(TransferDetails, self).__init__(**kwargs) + self.creation_time = None + self.expiration_time = None + self.invoice_section_id = None + self.billing_account_id = None + self.reseller_id = None + self.reseller_name = None + self.initiator_customer_type = None + self.billing_profile_id = None + self.transfer_status = None + self.recipient_email_id = None + self.initiator_email_id = None + self.canceled_by = None + self.last_modified_time = None + self.detailed_transfer_status = None + + +class TransferProductRequestProperties(Model): + """The properties of the product to initiate a 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 + """ + + _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) + + +class UpdateAutoRenewOperation(Model): + """Result of the update auto renew operation. + + :param end_date: The date at which the product will be canceled. + :type end_date: datetime + """ + + _attribute_map = { + 'end_date': {'key': 'properties.endDate', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(UpdateAutoRenewOperation, self).__init__(**kwargs) + self.end_date = kwargs.get('end_date', None) + + +class UpdateAutoRenewRequest(Model): + """Request parameters to update auto renew settings for a product. + + :param auto_renew: The flag that determines the auto-renew settings for a + product. Possible values include: 'true', 'false' + :type auto_renew: str or ~azure.mgmt.billing.models.UpdateAutoRenew + """ + + _attribute_map = { + 'auto_renew': {'key': 'autoRenew', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UpdateAutoRenewRequest, self).__init__(**kwargs) + self.auto_renew = kwargs.get('auto_renew', None) + + +class ValidateAddressResponse(Model): + """Result of the address validation. + + :param status: status of the address validation. Possible values include: + 'Valid', 'Invalid' + :type status: str or ~azure.mgmt.billing.models.AddressValidationStatus + :param suggested_addresses: The list of suggested addresses. + :type suggested_addresses: list[~azure.mgmt.billing.models.AddressDetails] + :param validation_message: Validation error message. + :type validation_message: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'suggested_addresses': {'key': 'suggestedAddresses', 'type': '[AddressDetails]'}, + 'validation_message': {'key': 'validationMessage', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ValidateAddressResponse, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.suggested_addresses = kwargs.get('suggested_addresses', None) + self.validation_message = kwargs.get('validation_message', None) + + +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) + + +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) + + +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) + + +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 subscription is eligible + to be transferred. + :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) + + +class ValidateTransferListResponse(Model): + """Result of transfer validation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of transfer validation results. + :vartype value: list[~azure.mgmt.billing.models.ValidateTransferResponse] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ValidateTransferResponse]'}, + } + + def __init__(self, **kwargs): + super(ValidateTransferListResponse, self).__init__(**kwargs) + self.value = None + + +class ValidateTransferResponse(Model): + """Transfer validation response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar status: The status of validation + :vartype status: str + :ivar product_id: The product id for which this result applies. + :vartype product_id: str + :param results: The array of validation results. + :type results: list[~azure.mgmt.billing.models.ValidationResultProperties] + """ + + _validation = { + 'status': {'readonly': True}, + 'product_id': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'properties.status', 'type': 'str'}, + 'product_id': {'key': 'properties.productId', 'type': 'str'}, + 'results': {'key': 'properties.results', 'type': '[ValidationResultProperties]'}, + } + + def __init__(self, **kwargs): + super(ValidateTransferResponse, self).__init__(**kwargs) + self.status = None + self.product_id = None + self.results = kwargs.get('results', None) + + +class ValidationResultProperties(Model): + """The properties of the validation result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar level: Result Level. + :vartype level: str + :ivar code: Result Code. + :vartype code: str + :ivar message: The validation message. + :vartype message: str + """ + + _validation = { + 'level': {'readonly': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'level': {'key': 'level', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ValidationResultProperties, self).__init__(**kwargs) + self.level = None + self.code = None + self.message = None diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models_py3.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models_py3.py new file mode 100644 index 000000000000..3fba1d840e88 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models_py3.py @@ -0,0 +1,3351 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class AcceptTransferRequest(Model): + """Request parameters to accept transfer. + + :param product_details: Request parameters to accept transfer. + :type product_details: list[~azure.mgmt.billing.models.ProductDetails] + """ + + _attribute_map = { + 'product_details': {'key': 'properties.productDetails', 'type': '[ProductDetails]'}, + } + + def __init__(self, *, product_details=None, **kwargs) -> None: + super(AcceptTransferRequest, self).__init__(**kwargs) + self.product_details = product_details + + +class AddressDetails(Model): + """Address details. + + :param first_name: First name. + :type first_name: str + :param last_name: Last name. + :type last_name: str + :param company_name: Company name. + :type company_name: str + :param address_line1: Address line 1. + :type address_line1: str + :param address_line2: Address line 2. + :type address_line2: str + :param address_line3: Address line 3. + :type address_line3: str + :param city: Address city. + :type city: str + :param region: Address region. + :type region: str + :param country: Country code uses ISO2, 2-digit format. + :type country: str + :param postal_code: Postal code. + :type postal_code: str + """ + + _attribute_map = { + 'first_name': {'key': 'firstName', 'type': 'str'}, + 'last_name': {'key': 'lastName', 'type': 'str'}, + 'company_name': {'key': 'companyName', 'type': 'str'}, + 'address_line1': {'key': 'addressLine1', 'type': 'str'}, + 'address_line2': {'key': 'addressLine2', 'type': 'str'}, + 'address_line3': {'key': 'addressLine3', 'type': 'str'}, + 'city': {'key': 'city', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + 'country': {'key': 'country', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + } + + def __init__(self, *, first_name: str=None, last_name: str=None, company_name: str=None, address_line1: str=None, address_line2: str=None, address_line3: str=None, city: str=None, region: str=None, country: str=None, postal_code: str=None, **kwargs) -> None: + super(AddressDetails, self).__init__(**kwargs) + self.first_name = first_name + self.last_name = last_name + self.company_name = company_name + self.address_line1 = address_line1 + self.address_line2 = address_line2 + self.address_line3 = address_line3 + self.city = city + self.region = region + self.country = country + self.postal_code = postal_code + + +class Resource(Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class Agreement(Resource): + """An agreement. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar agreement_link: The URL to download the agreement. + :vartype agreement_link: str + :ivar category: The category of the agreement signed by a customer. + Possible values include: 'MicrosoftCustomerAgreement', + 'AffiliatePurchaseTerms', 'Other' + :vartype category: str or ~azure.mgmt.billing.models.Category + :ivar acceptance_mode: The mode of acceptance for an agreement. Possible + values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + :vartype acceptance_mode: str or ~azure.mgmt.billing.models.AcceptanceMode + :ivar effective_date: The date from which the agreement is effective. + :vartype effective_date: datetime + :ivar expiration_date: The date when the agreement expires. + :vartype expiration_date: datetime + :param participants: The list of participants that participates in + acceptance of an agreement. + :type participants: list[~azure.mgmt.billing.models.Participants] + :ivar status: The current status of the agreement. + :vartype status: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'agreement_link': {'readonly': True}, + 'category': {'readonly': True}, + 'acceptance_mode': {'readonly': True}, + 'effective_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'agreement_link': {'key': 'properties.agreementLink', 'type': 'str'}, + 'category': {'key': 'properties.category', 'type': 'str'}, + 'acceptance_mode': {'key': 'properties.acceptanceMode', 'type': 'str'}, + 'effective_date': {'key': 'properties.effectiveDate', 'type': 'iso-8601'}, + 'expiration_date': {'key': 'properties.expirationDate', 'type': 'iso-8601'}, + 'participants': {'key': 'properties.participants', 'type': '[Participants]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__(self, *, participants=None, **kwargs) -> None: + super(Agreement, self).__init__(**kwargs) + self.agreement_link = None + self.category = None + self.acceptance_mode = None + self.effective_date = None + self.expiration_date = None + self.participants = participants + self.status = None + + +class AgreementListResult(Model): + """Result of listing agreements. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of agreements. + :vartype value: list[~azure.mgmt.billing.models.Agreement] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Agreement]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AgreementListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Amount(Model): + """The amount. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar currency: The currency for the amount value. + :vartype currency: str + :param value: Amount value. + :type value: float + """ + + _validation = { + 'currency': {'readonly': True}, + } + + _attribute_map = { + 'currency': {'key': 'currency', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'float'}, + } + + def __init__(self, *, value: float=None, **kwargs) -> None: + super(Amount, self).__init__(**kwargs) + self.currency = None + self.value = value + + +class AvailableBalance(Resource): + """The latest Azure credit balance. This is the balance available for pay now. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar amount: Balance amount. + :vartype amount: ~azure.mgmt.billing.models.Amount + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'amount': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'amount': {'key': 'properties.amount', 'type': 'Amount'}, + } + + def __init__(self, **kwargs) -> None: + super(AvailableBalance, self).__init__(**kwargs) + self.amount = None + + +class AzurePlan(Model): + """Details of the Azure plan. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param sku_id: The sku id. + :type sku_id: str + :ivar sku_description: The sku description. + :vartype sku_description: str + """ + + _validation = { + 'sku_description': {'readonly': True}, + } + + _attribute_map = { + 'sku_id': {'key': 'skuId', 'type': 'str'}, + 'sku_description': {'key': 'skuDescription', 'type': 'str'}, + } + + def __init__(self, *, sku_id: str=None, **kwargs) -> None: + super(AzurePlan, self).__init__(**kwargs) + self.sku_id = sku_id + self.sku_description = None + + +class BillingAccount(Resource): + """A billing account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar display_name: The billing account name. + :vartype display_name: str + :param address: The address associated with the billing account. + :type address: ~azure.mgmt.billing.models.AddressDetails + :ivar agreement_type: The type of agreement. Possible values include: + 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + :vartype agreement_type: str or ~azure.mgmt.billing.models.AgreementType + :ivar customer_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype customer_type: str or ~azure.mgmt.billing.models.CustomerType + :ivar account_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype account_type: str or ~azure.mgmt.billing.models.AccountType + :param billing_profiles: The billing profiles associated with the billing + account. By default this is not populated, unless it's specified in + $expand. + :type billing_profiles: list[~azure.mgmt.billing.models.BillingProfile] + :ivar enrollment_details: The details about the associated legacy + enrollment. By default this is not populated, unless it's specified in + $expand. + :vartype enrollment_details: ~azure.mgmt.billing.models.Enrollment + :param departments: The departments associated to the enrollment. + :type departments: list[~azure.mgmt.billing.models.Department] + :param enrollment_accounts: The accounts associated to the enrollment. + :type enrollment_accounts: + list[~azure.mgmt.billing.models.EnrollmentAccount] + :ivar organization_id: Organization id. + :vartype organization_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'agreement_type': {'readonly': True}, + 'customer_type': {'readonly': True}, + 'account_type': {'readonly': True}, + 'enrollment_details': {'readonly': True}, + 'organization_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'address': {'key': 'properties.address', 'type': 'AddressDetails'}, + 'agreement_type': {'key': 'properties.agreementType', 'type': 'str'}, + 'customer_type': {'key': 'properties.customerType', 'type': 'str'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'billing_profiles': {'key': 'properties.billingProfiles', 'type': '[BillingProfile]'}, + 'enrollment_details': {'key': 'properties.enrollmentDetails', 'type': 'Enrollment'}, + 'departments': {'key': 'properties.departments', 'type': '[Department]'}, + 'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'}, + 'organization_id': {'key': 'properties.organizationId', 'type': 'str'}, + } + + def __init__(self, *, address=None, billing_profiles=None, departments=None, enrollment_accounts=None, **kwargs) -> None: + super(BillingAccount, self).__init__(**kwargs) + self.display_name = None + self.address = address + self.agreement_type = None + self.customer_type = None + self.account_type = None + self.billing_profiles = billing_profiles + self.enrollment_details = None + self.departments = departments + self.enrollment_accounts = enrollment_accounts + self.organization_id = None + + +class BillingAccountListResult(Model): + """The list of billing accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of billing accounts. + :vartype value: list[~azure.mgmt.billing.models.BillingAccount] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingAccount]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(BillingAccountListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class BillingAccountUpdateRequest(Model): + """The request properties of the billing account that can be updated. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar display_name: The billing account name. + :vartype display_name: str + :param address: The address associated with the billing account. + :type address: ~azure.mgmt.billing.models.AddressDetails + :ivar agreement_type: The type of agreement. Possible values include: + 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + :vartype agreement_type: str or ~azure.mgmt.billing.models.AgreementType + :ivar customer_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype customer_type: str or ~azure.mgmt.billing.models.CustomerType + :ivar account_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype account_type: str or ~azure.mgmt.billing.models.AccountType + :param billing_profiles: The billing profiles associated with the billing + account. By default this is not populated, unless it's specified in + $expand. + :type billing_profiles: list[~azure.mgmt.billing.models.BillingProfile] + :ivar enrollment_details: The details about the associated legacy + enrollment. By default this is not populated, unless it's specified in + $expand. + :vartype enrollment_details: ~azure.mgmt.billing.models.Enrollment + :param departments: The departments associated to the enrollment. + :type departments: list[~azure.mgmt.billing.models.Department] + :param enrollment_accounts: The accounts associated to the enrollment. + :type enrollment_accounts: + list[~azure.mgmt.billing.models.EnrollmentAccount] + :ivar organization_id: Organization id. + :vartype organization_id: str + """ + + _validation = { + 'display_name': {'readonly': True}, + 'agreement_type': {'readonly': True}, + 'customer_type': {'readonly': True}, + 'account_type': {'readonly': True}, + 'enrollment_details': {'readonly': True}, + 'organization_id': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'address': {'key': 'properties.address', 'type': 'AddressDetails'}, + 'agreement_type': {'key': 'properties.agreementType', 'type': 'str'}, + 'customer_type': {'key': 'properties.customerType', 'type': 'str'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'billing_profiles': {'key': 'properties.billingProfiles', 'type': '[BillingProfile]'}, + 'enrollment_details': {'key': 'properties.enrollmentDetails', 'type': 'Enrollment'}, + 'departments': {'key': 'properties.departments', 'type': '[Department]'}, + 'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'}, + 'organization_id': {'key': 'properties.organizationId', 'type': 'str'}, + } + + def __init__(self, *, address=None, billing_profiles=None, departments=None, enrollment_accounts=None, **kwargs) -> None: + super(BillingAccountUpdateRequest, self).__init__(**kwargs) + self.display_name = None + self.address = address + self.agreement_type = None + self.customer_type = None + self.account_type = None + self.billing_profiles = billing_profiles + self.enrollment_details = None + self.departments = departments + self.enrollment_accounts = enrollment_accounts + self.organization_id = None + + +class BillingPermissionsListResult(Model): + """Result of list billingPermissions a caller has on a billing account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of billingPermissions a caller has on a billing + account. + :vartype value: + list[~azure.mgmt.billing.models.BillingPermissionsProperties] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingPermissionsProperties]'}, + } + + def __init__(self, **kwargs) -> None: + super(BillingPermissionsListResult, self).__init__(**kwargs) + self.value = None + + +class BillingPermissionsProperties(Model): + """The set of allowed action and not allowed actions a caller has on a billing + account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar actions: The set of actions that the caller is allowed to perform. + :vartype actions: list[str] + :ivar not_actions: The set of actions that the caller is not allowed to + perform. + :vartype not_actions: list[str] + """ + + _validation = { + 'actions': {'readonly': True}, + 'not_actions': {'readonly': True}, + } + + _attribute_map = { + 'actions': {'key': 'actions', 'type': '[str]'}, + 'not_actions': {'key': 'notActions', 'type': '[str]'}, + } + + def __init__(self, **kwargs) -> None: + super(BillingPermissionsProperties, self).__init__(**kwargs) + self.actions = None + self.not_actions = None + + +class BillingProfile(Resource): + """A billing profile. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: The name of the billing profile. + :type display_name: str + :param po_number: The purchase order name that will appear on the invoices + generated for the billing profile. + :type po_number: str + :param address: Billing address. + :type address: ~azure.mgmt.billing.models.AddressDetails + :param invoice_email_opt_in: Flag controlling whether the invoices for the + billing profile are sent through email. + :type invoice_email_opt_in: bool + :ivar invoice_day: The day of the month when the invoice for the billing + profile is generated. + :vartype invoice_day: int + :ivar currency: The currency in which the charges for the billing profile + are billed. + :vartype currency: str + :param enabled_azure_plans: Information about the enabled azure plans. + :type enabled_azure_plans: list[~azure.mgmt.billing.models.AzurePlan] + :param invoice_sections: The invoice sections associated to the billing + profile. + :type invoice_sections: list[~azure.mgmt.billing.models.InvoiceSection] + :ivar status: The status of the billing profile. + :vartype status: object + :ivar status_reason_code: Reason for the specified billing profile status. + Possible values include: 'PastDue', 'SpendingLimitReached', + 'SpendingLimitExpired' + :vartype status_reason_code: str or + ~azure.mgmt.billing.models.StatusReasonCode + :ivar spending_limit: The billing profile spending limit. Possible values + include: 'Off', 'On' + :vartype spending_limit: str or ~azure.mgmt.billing.models.SpendingLimit + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'invoice_day': {'readonly': True}, + 'currency': {'readonly': True}, + 'status': {'readonly': True}, + 'status_reason_code': {'readonly': True}, + 'spending_limit': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'po_number': {'key': 'properties.poNumber', 'type': 'str'}, + 'address': {'key': 'properties.address', 'type': 'AddressDetails'}, + 'invoice_email_opt_in': {'key': 'properties.invoiceEmailOptIn', 'type': 'bool'}, + 'invoice_day': {'key': 'properties.invoiceDay', 'type': 'int'}, + 'currency': {'key': 'properties.currency', 'type': 'str'}, + 'enabled_azure_plans': {'key': 'properties.enabledAzurePlans', 'type': '[AzurePlan]'}, + 'invoice_sections': {'key': 'properties.invoiceSections', 'type': '[InvoiceSection]'}, + 'status': {'key': 'properties.status', 'type': 'object'}, + 'status_reason_code': {'key': 'properties.statusReasonCode', 'type': 'str'}, + 'spending_limit': {'key': 'properties.spendingLimit', 'type': 'str'}, + } + + def __init__(self, *, display_name: str=None, po_number: str=None, address=None, invoice_email_opt_in: bool=None, enabled_azure_plans=None, invoice_sections=None, **kwargs) -> None: + super(BillingProfile, self).__init__(**kwargs) + self.display_name = display_name + self.po_number = po_number + self.address = address + self.invoice_email_opt_in = invoice_email_opt_in + self.invoice_day = None + self.currency = None + self.enabled_azure_plans = enabled_azure_plans + self.invoice_sections = invoice_sections + self.status = None + self.status_reason_code = None + self.spending_limit = None + + +class BillingProfileCreationRequest(Model): + """The request parameters for creating a new billing profile. + + :param display_name: The name of the billing profile. + :type display_name: str + :param po_number: The purchase order name that will appear on the invoices + generated for the billing profile. + :type po_number: str + :param address: Billing address. + :type address: ~azure.mgmt.billing.models.AddressDetails + :param invoice_email_opt_in: Flag controlling whether the invoices for the + billing profile are sent through email. + :type invoice_email_opt_in: bool + :param enabled_azure_plans: Enabled azure plans for the billing profile. + :type enabled_azure_plans: list[~azure.mgmt.billing.models.AzurePlan] + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'po_number': {'key': 'poNumber', 'type': 'str'}, + 'address': {'key': 'address', 'type': 'AddressDetails'}, + 'invoice_email_opt_in': {'key': 'invoiceEmailOptIn', 'type': 'bool'}, + 'enabled_azure_plans': {'key': 'enabledAzurePlans', 'type': '[AzurePlan]'}, + } + + def __init__(self, *, display_name: str=None, po_number: str=None, address=None, invoice_email_opt_in: bool=None, enabled_azure_plans=None, **kwargs) -> None: + super(BillingProfileCreationRequest, self).__init__(**kwargs) + self.display_name = display_name + self.po_number = po_number + self.address = address + self.invoice_email_opt_in = invoice_email_opt_in + self.enabled_azure_plans = enabled_azure_plans + + +class BillingProfileListResult(Model): + """The list of billing profiles. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of billing profiles. + :vartype value: list[~azure.mgmt.billing.models.BillingProfile] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingProfile]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(BillingProfileListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class BillingProperty(Resource): + """A billing property. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar billing_tenant_id: The Azure AD tenant ID of the billing account for + the subscription. + :vartype billing_tenant_id: str + :ivar billing_account_id: The ID of the billing account to which the + subscription is billed. + :vartype billing_account_id: str + :ivar billing_account_display_name: The name of the billing account to + which the subscription is billed. + :vartype billing_account_display_name: str + :ivar billing_profile_id: The ID of the billing profile to which the + subscription is billed. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile to + which the subscription is billed. + :vartype billing_profile_display_name: str + :ivar billing_profile_status: The status of the billing profile. Possible + values include: 'Active', 'Disabled', 'Warned' + :vartype billing_profile_status: str or + ~azure.mgmt.billing.models.BillingProfileStatus + :ivar billing_profile_status_reason_code: Reason for the specified billing + profile status. + :vartype billing_profile_status_reason_code: object + :ivar billing_profile_spending_limit: The billing profile spending limit. + :vartype billing_profile_spending_limit: object + :ivar cost_center: The cost center applied to the subscription. + :vartype cost_center: str + :ivar invoice_section_id: The ID of the invoice section to which the + subscription is billed. + :vartype invoice_section_id: str + :ivar invoice_section_display_name: The name of the invoice section to + which the subscription is billed. + :vartype invoice_section_display_name: str + :ivar product_id: The product ID of the Azure plan. + :vartype product_id: str + :ivar product_name: The product name of the Azure plan. + :vartype product_name: str + :ivar sku_id: The sku ID of the Azure plan for the subscription. + :vartype sku_id: str + :ivar sku_description: The sku description of the Azure plan for the + subscription. + :vartype sku_description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'billing_tenant_id': {'readonly': True}, + 'billing_account_id': {'readonly': True}, + 'billing_account_display_name': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'billing_profile_status': {'readonly': True}, + 'billing_profile_status_reason_code': {'readonly': True}, + 'billing_profile_spending_limit': {'readonly': True}, + 'cost_center': {'readonly': True}, + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'product_id': {'readonly': True}, + 'product_name': {'readonly': True}, + 'sku_id': {'readonly': True}, + 'sku_description': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'billing_tenant_id': {'key': 'properties.billingTenantId', 'type': 'str'}, + 'billing_account_id': {'key': 'properties.billingAccountId', 'type': 'str'}, + 'billing_account_display_name': {'key': 'properties.billingAccountDisplayName', 'type': 'str'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', 'type': 'str'}, + 'billing_profile_status': {'key': 'properties.billingProfileStatus', 'type': 'str'}, + 'billing_profile_status_reason_code': {'key': 'properties.billingProfileStatusReasonCode', 'type': 'object'}, + 'billing_profile_spending_limit': {'key': 'properties.billingProfileSpendingLimit', 'type': 'object'}, + 'cost_center': {'key': 'properties.costCenter', 'type': 'str'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'properties.invoiceSectionDisplayName', 'type': 'str'}, + 'product_id': {'key': 'properties.productId', 'type': 'str'}, + 'product_name': {'key': 'properties.productName', 'type': 'str'}, + 'sku_id': {'key': 'properties.skuId', 'type': 'str'}, + 'sku_description': {'key': 'properties.skuDescription', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(BillingProperty, self).__init__(**kwargs) + self.billing_tenant_id = None + self.billing_account_id = None + self.billing_account_display_name = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.billing_profile_status = None + self.billing_profile_status_reason_code = None + self.billing_profile_spending_limit = None + self.cost_center = None + self.invoice_section_id = None + self.invoice_section_display_name = None + self.product_id = None + self.product_name = None + self.sku_id = None + self.sku_description = None + + +class BillingRoleAssignment(Resource): + """The role assignment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar created_on: The date the role assignment was created. + :vartype created_on: str + :ivar created_by_principal_tenant_id: The tenant Id of the user who + created the role assignment. + :vartype created_by_principal_tenant_id: str + :ivar created_by_principal_id: The principal Id of the user who created + the role assignment. + :vartype created_by_principal_id: str + :ivar billing_role_assignment_name: The name of the role assignment. + :vartype billing_role_assignment_name: str + :ivar principal_id: The principal id of the user to whom the role was + assigned. + :vartype principal_id: str + :ivar role_definition_name: The ID of the role definition. + :vartype role_definition_name: str + :ivar scope: The scope at which the role was assigned. + :vartype scope: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_on': {'readonly': True}, + 'created_by_principal_tenant_id': {'readonly': True}, + 'created_by_principal_id': {'readonly': True}, + 'billing_role_assignment_name': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'role_definition_name': {'readonly': True}, + 'scope': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'str'}, + 'created_by_principal_tenant_id': {'key': 'properties.createdByPrincipalTenantId', 'type': 'str'}, + 'created_by_principal_id': {'key': 'properties.createdByPrincipalId', 'type': 'str'}, + 'billing_role_assignment_name': {'key': 'properties.name', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'role_definition_name': {'key': 'properties.roleDefinitionName', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(BillingRoleAssignment, self).__init__(**kwargs) + self.created_on = None + self.created_by_principal_tenant_id = None + self.created_by_principal_id = None + self.billing_role_assignment_name = None + self.principal_id = None + self.role_definition_name = None + self.scope = None + + +class BillingRoleAssignmentListResult(Model): + """The list of role assignments. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of role assignments. + :vartype value: list[~azure.mgmt.billing.models.BillingRoleAssignment] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingRoleAssignment]'}, + } + + def __init__(self, **kwargs) -> None: + super(BillingRoleAssignmentListResult, self).__init__(**kwargs) + self.value = None + + +class BillingRoleAssignmentPayload(Model): + """The payload use to update role assignment on a scope. + + :param principal_id: The user's principal id that the role gets assigned + to + :type principal_id: str + :param billing_role_definition_id: The role definition id + :type billing_role_definition_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'billing_role_definition_id': {'key': 'billingRoleDefinitionId', 'type': 'str'}, + } + + def __init__(self, *, principal_id: str=None, billing_role_definition_id: str=None, **kwargs) -> None: + super(BillingRoleAssignmentPayload, self).__init__(**kwargs) + self.principal_id = principal_id + self.billing_role_definition_id = billing_role_definition_id + + +class BillingRoleDefinition(Resource): + """The properties of a role definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar description: The role description + :vartype description: str + :param permissions: The billingPermissions the role has + :type permissions: + list[~azure.mgmt.billing.models.BillingPermissionsProperties] + :ivar role_name: The name of the role + :vartype role_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'role_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'permissions': {'key': 'properties.permissions', 'type': '[BillingPermissionsProperties]'}, + 'role_name': {'key': 'properties.roleName', 'type': 'str'}, + } + + def __init__(self, *, permissions=None, **kwargs) -> None: + super(BillingRoleDefinition, self).__init__(**kwargs) + self.description = None + self.permissions = permissions + self.role_name = None + + +class BillingRoleDefinitionListResult(Model): + """The list of role definitions. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The role definitions. + :vartype value: list[~azure.mgmt.billing.models.BillingRoleDefinition] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingRoleDefinition]'}, + } + + def __init__(self, **kwargs) -> None: + super(BillingRoleDefinitionListResult, self).__init__(**kwargs) + self.value = None + + +class BillingSubscription(Resource): + """A billing subscription. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar display_name: The name of the subscription. + :vartype display_name: str + :ivar subscription_id: The ID of the subscription. + :vartype subscription_id: str + :param subscription_billing_status: The current billing status of the + subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', + 'Deleted', 'Warning' + :type subscription_billing_status: str or + ~azure.mgmt.billing.models.BillingSubscriptionStatusType + :ivar last_month_charges: The last month charges. + :vartype last_month_charges: ~azure.mgmt.billing.models.Amount + :ivar month_to_date_charges: The current month to date charges. + :vartype month_to_date_charges: ~azure.mgmt.billing.models.Amount + :ivar billing_profile_id: The ID of the billing profile to which the + subscription is billed. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile to + which the subscription is billed. + :vartype billing_profile_display_name: str + :ivar customer_id: The ID of the customer for whom the subscription was + created. The field is applicable only for Microsoft Partner Agreement + billing account. + :vartype customer_id: str + :ivar customer_display_name: The name of the customer for whom the + subscription was created. The field is applicable only for Microsoft + Partner Agreement billing account. + :vartype customer_display_name: str + :ivar invoice_section_id: The ID of the invoice section to which the + subscription is billed. + :vartype invoice_section_id: str + :ivar invoice_section_display_name: The name of the invoice section to + which the subscription is billed. + :vartype invoice_section_display_name: str + :ivar reseller: Reseller for this subscription. + :vartype reseller: ~azure.mgmt.billing.models.Reseller + :param sku_id: The sku ID of the Azure plan for the subscription. + :type sku_id: str + :ivar sku_description: The sku description of the Azure plan for the + subscription. + :vartype sku_description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'subscription_id': {'readonly': True}, + 'last_month_charges': {'readonly': True}, + 'month_to_date_charges': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'customer_id': {'readonly': True}, + 'customer_display_name': {'readonly': True}, + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'reseller': {'readonly': True}, + 'sku_description': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + 'subscription_billing_status': {'key': 'properties.subscriptionBillingStatus', 'type': 'str'}, + 'last_month_charges': {'key': 'properties.lastMonthCharges', 'type': 'Amount'}, + 'month_to_date_charges': {'key': 'properties.monthToDateCharges', 'type': 'Amount'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', 'type': 'str'}, + 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, + 'customer_display_name': {'key': 'properties.customerDisplayName', 'type': 'str'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'properties.invoiceSectionDisplayName', 'type': 'str'}, + 'reseller': {'key': 'properties.reseller', 'type': 'Reseller'}, + 'sku_id': {'key': 'properties.skuId', 'type': 'str'}, + 'sku_description': {'key': 'properties.skuDescription', 'type': 'str'}, + } + + def __init__(self, *, subscription_billing_status=None, sku_id: str=None, **kwargs) -> None: + super(BillingSubscription, self).__init__(**kwargs) + self.display_name = None + self.subscription_id = None + self.subscription_billing_status = subscription_billing_status + self.last_month_charges = None + self.month_to_date_charges = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.customer_id = None + self.customer_display_name = None + self.invoice_section_id = None + self.invoice_section_display_name = None + self.reseller = None + self.sku_id = sku_id + self.sku_description = None + + +class BillingSubscriptionsListResult(Model): + """The list of billing subscriptions. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of billing subscriptions. + :vartype value: list[~azure.mgmt.billing.models.BillingSubscription] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(BillingSubscriptionsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Customer(Resource): + """A partner's customer. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: The name of the customer. + :type display_name: str + :param enabled_azure_plans: Azure plans enabled for the customer. + :type enabled_azure_plans: list[~azure.mgmt.billing.models.AzurePlan] + :param resellers: The list of resellers for which an Azure plan is enabled + for the customer. + :type resellers: list[~azure.mgmt.billing.models.Reseller] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'enabled_azure_plans': {'key': 'properties.enabledAzurePlans', 'type': '[AzurePlan]'}, + 'resellers': {'key': 'properties.resellers', 'type': '[Reseller]'}, + } + + def __init__(self, *, display_name: str=None, enabled_azure_plans=None, resellers=None, **kwargs) -> None: + super(Customer, self).__init__(**kwargs) + self.display_name = display_name + self.enabled_azure_plans = enabled_azure_plans + self.resellers = resellers + + +class CustomerPolicy(Resource): + """The customer's Policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param view_charges: The policy that controls whether the users in + customer's organization can view charges at pay-as-you-go prices. Possible + values include: 'Allowed', 'NotAllowed' + :type view_charges: str or ~azure.mgmt.billing.models.ViewCharges + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'view_charges': {'key': 'properties.viewCharges', 'type': 'str'}, + } + + def __init__(self, *, view_charges=None, **kwargs) -> None: + super(CustomerPolicy, self).__init__(**kwargs) + self.view_charges = view_charges + + +class Department(Resource): + """A department. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param department_name: The name of the department. + :type department_name: str + :param cost_center: The cost center associated with the department. + :type cost_center: str + :param status: The status of the department. + :type status: str + :param enrollment_accounts: Associated enrollment accounts. By default + this is not populated, unless it's specified in $expand. + :type enrollment_accounts: + list[~azure.mgmt.billing.models.EnrollmentAccount] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'department_name': {'key': 'properties.departmentName', 'type': 'str'}, + 'cost_center': {'key': 'properties.costCenter', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'}, + } + + def __init__(self, *, department_name: str=None, cost_center: str=None, status: str=None, enrollment_accounts=None, **kwargs) -> None: + super(Department, self).__init__(**kwargs) + self.department_name = department_name + self.cost_center = cost_center + self.status = status + self.enrollment_accounts = enrollment_accounts + + +class DepartmentListResult(Model): + """The list of departments. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of departments. + :vartype value: list[~azure.mgmt.billing.models.Department] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Department]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DepartmentListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class DetailedTransferStatus(Model): + """Detailed transfer status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar product_type: Type of product that is transferred. Possible values + include: 'AzureSubscription', 'AzureReservation' + :vartype product_type: str or ~azure.mgmt.billing.models.ProductType + :ivar product_id: The ID of the product that is transferred. + :vartype product_id: str + :ivar transfer_status: Transfer status. Possible values include: + 'NotStarted', 'InProgress', 'Completed', 'Failed' + :vartype transfer_status: str or + ~azure.mgmt.billing.models.ProductTransferStatus + :param error_details: Error details for transfer execution. + :type error_details: ~azure.mgmt.billing.models.Error + """ + + _validation = { + 'product_type': {'readonly': True}, + 'product_id': {'readonly': True}, + 'transfer_status': {'readonly': True}, + } + + _attribute_map = { + 'product_type': {'key': 'productType', 'type': 'str'}, + 'product_id': {'key': 'productId', 'type': 'str'}, + 'transfer_status': {'key': 'transferStatus', 'type': 'str'}, + 'error_details': {'key': 'errorDetails', 'type': 'Error'}, + } + + def __init__(self, *, error_details=None, **kwargs) -> None: + super(DetailedTransferStatus, self).__init__(**kwargs) + self.product_type = None + self.product_id = None + self.transfer_status = None + self.error_details = error_details + + +class Document(Model): + """The properties of a document. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar kind: The type of the document. Possible values include: 'Invoice', + 'VoidNote', 'TaxReceipt', 'CreditNote' + :vartype kind: str or ~azure.mgmt.billing.models.DocumentType + :ivar url: Document URL. + :vartype url: str + """ + + _validation = { + 'kind': {'readonly': True}, + 'url': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Document, self).__init__(**kwargs) + self.kind = None + self.url = None + + +class DownloadUrl(Model): + """A secure URL that can be used to download a an entity until the URL + expires. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar expiry_time: The time in UTC when the download URL will expire. + :vartype expiry_time: datetime + :ivar url: The URL to the PDF file. + :vartype url: str + """ + + _validation = { + 'expiry_time': {'readonly': True}, + 'url': {'readonly': True}, + } + + _attribute_map = { + 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DownloadUrl, self).__init__(**kwargs) + self.expiry_time = None + self.url = None + + +class Enrollment(Model): + """The properties of an enrollment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param start_date: The start date of the enrollment. + :type start_date: datetime + :param end_date: The end date of the enrollment. + :type end_date: datetime + :ivar currency: The billing currency for the enrollment. + :vartype currency: str + :ivar channel: The channel type of the enrollment. + :vartype channel: str + :ivar policies: The policies for Enterprise Agreement enrollments. + :vartype policies: ~azure.mgmt.billing.models.EnrollmentPolicies + :ivar language: The language for the enrollment. + :vartype language: str + :ivar country_code: The country code of the enrollment. + :vartype country_code: str + :ivar status: The current status of the enrollment. + :vartype status: str + :ivar billing_cycle: The billing cycle for the enrollment. + :vartype billing_cycle: str + """ + + _validation = { + 'currency': {'readonly': True}, + 'channel': {'readonly': True}, + 'policies': {'readonly': True}, + 'language': {'readonly': True}, + 'country_code': {'readonly': True}, + 'status': {'readonly': True}, + 'billing_cycle': {'readonly': True}, + } + + _attribute_map = { + 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, + 'currency': {'key': 'currency', 'type': 'str'}, + 'channel': {'key': 'channel', 'type': 'str'}, + 'policies': {'key': 'policies', 'type': 'EnrollmentPolicies'}, + 'language': {'key': 'language', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'billing_cycle': {'key': 'billingCycle', 'type': 'str'}, + } + + def __init__(self, *, start_date=None, end_date=None, **kwargs) -> None: + super(Enrollment, self).__init__(**kwargs) + self.start_date = start_date + self.end_date = end_date + self.currency = None + self.channel = None + self.policies = None + self.language = None + self.country_code = None + self.status = None + self.billing_cycle = None + + +class EnrollmentAccount(Resource): + """An enrollment account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param account_name: The name of the enrollment account. + :type account_name: str + :param cost_center: The cost center associated with the enrollment + account. + :type cost_center: str + :param account_owner: The owner of the enrollment account. + :type account_owner: str + :param status: The status of the enrollment account. + :type status: str + :param start_date: The start date of the enrollment account. + :type start_date: datetime + :param end_date: The end date of the enrollment account. + :type end_date: datetime + :param department: Associated department. By default this is not + populated, unless it's specified in $expand. + :type department: ~azure.mgmt.billing.models.Department + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'account_name': {'key': 'properties.accountName', 'type': 'str'}, + 'cost_center': {'key': 'properties.costCenter', 'type': 'str'}, + 'account_owner': {'key': 'properties.accountOwner', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'start_date': {'key': 'properties.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.endDate', 'type': 'iso-8601'}, + 'department': {'key': 'properties.department', 'type': 'Department'}, + } + + def __init__(self, *, account_name: str=None, cost_center: str=None, account_owner: str=None, status: str=None, start_date=None, end_date=None, department=None, **kwargs) -> None: + super(EnrollmentAccount, self).__init__(**kwargs) + self.account_name = account_name + self.cost_center = cost_center + self.account_owner = account_owner + self.status = status + self.start_date = start_date + self.end_date = end_date + self.department = department + + +class EnrollmentAccountContext(Model): + """The enrollment account context. + + :param cost_center: The cost center associated with the enrollment + account. + :type cost_center: str + :param start_date: The start date of the enrollment account. + :type start_date: datetime + :param end_date: The end date of the enrollment account. + :type end_date: datetime + :param enrollment_account_name: The ID of the enrollment account. + :type enrollment_account_name: str + """ + + _attribute_map = { + 'cost_center': {'key': 'costCenter', 'type': 'str'}, + 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, + 'enrollment_account_name': {'key': 'enrollmentAccountName', 'type': 'str'}, + } + + def __init__(self, *, cost_center: str=None, start_date=None, end_date=None, enrollment_account_name: str=None, **kwargs) -> None: + super(EnrollmentAccountContext, self).__init__(**kwargs) + self.cost_center = cost_center + self.start_date = start_date + self.end_date = end_date + self.enrollment_account_name = enrollment_account_name + + +class EnrollmentAccountListResult(Model): + """The list of enrollment accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of enrollment accounts. + :vartype value: list[~azure.mgmt.billing.models.EnrollmentAccount] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EnrollmentAccount]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(EnrollmentAccountListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class EnrollmentPolicies(Model): + """The policies for Enterprise Agreement enrollments. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar account_owner_view_charges: The policy that controls whether Account + Owners can view charges. + :vartype account_owner_view_charges: bool + :ivar department_admin_view_charges: The policy that controls whether + Department Administrators can view charges. + :vartype department_admin_view_charges: bool + :ivar marketplaces_enabled: The policy that controls whether Azure + marketplace purchases are allowed in the enrollment. + :vartype marketplaces_enabled: bool + :ivar reserved_instances_enabled: The policy that controls whether Azure + reservation purchases are allowed in the enrollment. + :vartype reserved_instances_enabled: bool + """ + + _validation = { + 'account_owner_view_charges': {'readonly': True}, + 'department_admin_view_charges': {'readonly': True}, + 'marketplaces_enabled': {'readonly': True}, + 'reserved_instances_enabled': {'readonly': True}, + } + + _attribute_map = { + 'account_owner_view_charges': {'key': 'accountOwnerViewCharges', 'type': 'bool'}, + 'department_admin_view_charges': {'key': 'departmentAdminViewCharges', 'type': 'bool'}, + 'marketplaces_enabled': {'key': 'marketplacesEnabled', 'type': 'bool'}, + 'reserved_instances_enabled': {'key': 'reservedInstancesEnabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs) -> None: + super(EnrollmentPolicies, self).__init__(**kwargs) + self.account_owner_view_charges = None + self.department_admin_view_charges = None + self.marketplaces_enabled = None + self.reserved_instances_enabled = None + + +class Error(Model): + """Error details for transfer execution. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar error_code: Error code. + :vartype error_code: str + :ivar error_message: Error message. + :vartype error_message: str + """ + + _validation = { + 'error_code': {'readonly': True}, + 'error_message': {'readonly': True}, + } + + _attribute_map = { + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Error, self).__init__(**kwargs) + self.error_code = None + self.error_message = None + + +class ErrorDetails(Model): + """The details of the error. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + + +class ErrorResponse(Model): + """Error response indicates that the service is not able to process the + incoming request. The reason is provided in the error message. + + :param error: The details of the error. + :type error: ~azure.mgmt.billing.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class InitiateTransferRequest(Model): + """Request parameters to initiate transfer. + + :param recipient_email_id: The email ID of the recipient to whom the + transfer request is sent. + :type recipient_email_id: str + :param reseller_id: Optional MPN ID of the reseller for transfer requests + that are sent from a Microsoft Partner Agreement billing account. + :type reseller_id: str + """ + + _attribute_map = { + 'recipient_email_id': {'key': 'properties.recipientEmailId', 'type': 'str'}, + 'reseller_id': {'key': 'properties.resellerId', 'type': 'str'}, + } + + def __init__(self, *, recipient_email_id: str=None, reseller_id: str=None, **kwargs) -> None: + super(InitiateTransferRequest, self).__init__(**kwargs) + self.recipient_email_id = recipient_email_id + self.reseller_id = reseller_id + + +class Instruction(Resource): + """An instruction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param amount: Required. The amount budgeted for this billing instruction. + :type amount: float + :param start_date: Required. The date this billing instruction goes into + effect. + :type start_date: datetime + :param end_date: Required. The date this billing instruction is no longer + in effect. + :type end_date: datetime + :param creation_date: The date this billing instruction was created. + :type creation_date: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'amount': {'required': True}, + 'start_date': {'required': True}, + 'end_date': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'amount': {'key': 'properties.amount', 'type': 'float'}, + 'start_date': {'key': 'properties.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.endDate', 'type': 'iso-8601'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + } + + def __init__(self, *, amount: float, start_date, end_date, creation_date=None, **kwargs) -> None: + super(Instruction, self).__init__(**kwargs) + self.amount = amount + self.start_date = start_date + self.end_date = end_date + self.creation_date = creation_date + + +class Invoice(Resource): + """An invoice. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar due_date: The due date for the invoice. + :vartype due_date: datetime + :ivar invoice_date: The date when the invoice was generated. + :vartype invoice_date: datetime + :ivar status: The current status of the invoice. Possible values include: + 'Due', 'OverDue', 'Paid' + :vartype status: str or ~azure.mgmt.billing.models.InvoiceStatus + :ivar amount_due: The amount due as of now. + :vartype amount_due: ~azure.mgmt.billing.models.Amount + :ivar azure_prepayment_applied: The amount of Azure prepayment applied to + the charges. This field is applicable to billing accounts with agreement + type Microsoft Customer Agreement. + :vartype azure_prepayment_applied: ~azure.mgmt.billing.models.Amount + :ivar billed_amount: The total charges for the invoice billing period. + :vartype billed_amount: ~azure.mgmt.billing.models.Amount + :ivar credit_amount: The total refund for returns and cancellations during + the invoice billing period. This field is applicable to billing accounts + with agreement type Microsoft Customer Agreement. + :vartype credit_amount: ~azure.mgmt.billing.models.Amount + :ivar free_azure_credit_applied: The amount of free Azure credits applied + to the charges. This field is applicable to billing accounts with + agreement type Microsoft Customer Agreement. + :vartype free_azure_credit_applied: ~azure.mgmt.billing.models.Amount + :ivar sub_total: The pre-tax amount due. This field is applicable to + billing accounts with agreement type Microsoft Customer Agreement. + :vartype sub_total: ~azure.mgmt.billing.models.Amount + :ivar tax_amount: The amount of tax charged for the billing period. This + field is applicable to billing accounts with agreement type Microsoft + Customer Agreement. + :vartype tax_amount: ~azure.mgmt.billing.models.Amount + :ivar total_amount: The amount due when the invoice was generated. This + field is applicable to billing accounts with agreement type Microsoft + Customer Agreement. + :vartype total_amount: ~azure.mgmt.billing.models.Amount + :ivar invoice_period_start_date: The start date of the billing period for + which the invoice is generated. + :vartype invoice_period_start_date: datetime + :ivar invoice_period_end_date: The end date of the billing period for + which the invoice is generated. + :vartype invoice_period_end_date: datetime + :ivar invoice_type: Invoice type. Possible values include: 'AzureService', + 'AzureMarketplace', 'AzureSupport' + :vartype invoice_type: str or ~azure.mgmt.billing.models.InvoiceType + :ivar is_monthly_invoice: Specifies if the invoice is generated as part of + monthly invoicing cycle or not. This field is applicable to billing + accounts with agreement type Microsoft Customer Agreement. + :vartype is_monthly_invoice: bool + :ivar billing_profile_id: The ID of the billing profile for which the + invoice is generated. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile for + which the invoice is generated. + :vartype billing_profile_display_name: str + :ivar purchase_order_number: An optional purchase order number for the + invoice. + :vartype purchase_order_number: str + :ivar documents: List of documents available to download such as invoice + and tax receipt. + :vartype documents: list[~azure.mgmt.billing.models.Document] + :ivar payments: List of payments. + :vartype payments: list[~azure.mgmt.billing.models.PaymentProperties] + :ivar subscription_id: The ID of the subscription for which the invoice is + generated. + :vartype subscription_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'due_date': {'readonly': True}, + 'invoice_date': {'readonly': True}, + 'status': {'readonly': True}, + 'amount_due': {'readonly': True}, + 'azure_prepayment_applied': {'readonly': True}, + 'billed_amount': {'readonly': True}, + 'credit_amount': {'readonly': True}, + 'free_azure_credit_applied': {'readonly': True}, + 'sub_total': {'readonly': True}, + 'tax_amount': {'readonly': True}, + 'total_amount': {'readonly': True}, + 'invoice_period_start_date': {'readonly': True}, + 'invoice_period_end_date': {'readonly': True}, + 'invoice_type': {'readonly': True}, + 'is_monthly_invoice': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'purchase_order_number': {'readonly': True}, + 'documents': {'readonly': True}, + 'payments': {'readonly': True}, + 'subscription_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'due_date': {'key': 'properties.dueDate', 'type': 'iso-8601'}, + 'invoice_date': {'key': 'properties.invoiceDate', 'type': 'iso-8601'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'amount_due': {'key': 'properties.amountDue', 'type': 'Amount'}, + 'azure_prepayment_applied': {'key': 'properties.azurePrepaymentApplied', 'type': 'Amount'}, + 'billed_amount': {'key': 'properties.billedAmount', 'type': 'Amount'}, + 'credit_amount': {'key': 'properties.creditAmount', 'type': 'Amount'}, + 'free_azure_credit_applied': {'key': 'properties.freeAzureCreditApplied', 'type': 'Amount'}, + 'sub_total': {'key': 'properties.subTotal', 'type': 'Amount'}, + 'tax_amount': {'key': 'properties.taxAmount', 'type': 'Amount'}, + 'total_amount': {'key': 'properties.totalAmount', 'type': 'Amount'}, + 'invoice_period_start_date': {'key': 'properties.invoicePeriodStartDate', 'type': 'iso-8601'}, + 'invoice_period_end_date': {'key': 'properties.invoicePeriodEndDate', 'type': 'iso-8601'}, + 'invoice_type': {'key': 'properties.invoiceType', 'type': 'str'}, + 'is_monthly_invoice': {'key': 'properties.isMonthlyInvoice', 'type': 'bool'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', 'type': 'str'}, + 'purchase_order_number': {'key': 'properties.purchaseOrderNumber', 'type': 'str'}, + 'documents': {'key': 'properties.documents', 'type': '[Document]'}, + 'payments': {'key': 'properties.payments', 'type': '[PaymentProperties]'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Invoice, self).__init__(**kwargs) + self.due_date = None + self.invoice_date = None + self.status = None + self.amount_due = None + self.azure_prepayment_applied = None + self.billed_amount = None + self.credit_amount = None + self.free_azure_credit_applied = None + self.sub_total = None + self.tax_amount = None + self.total_amount = None + self.invoice_period_start_date = None + self.invoice_period_end_date = None + self.invoice_type = None + self.is_monthly_invoice = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.purchase_order_number = None + self.documents = None + self.payments = None + self.subscription_id = None + + +class InvoiceListResult(Model): + """The list of invoices. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of invoices. + :vartype value: list[~azure.mgmt.billing.models.Invoice] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Invoice]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(InvoiceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class InvoiceSection(Resource): + """An invoice section. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param display_name: The name of the invoice section. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__(self, *, display_name: str=None, **kwargs) -> None: + super(InvoiceSection, self).__init__(**kwargs) + self.display_name = display_name + + +class InvoiceSectionCreationRequest(Model): + """The properties of the invoice section. + + :param display_name: The name of the invoice section. + :type display_name: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, *, display_name: str=None, **kwargs) -> None: + super(InvoiceSectionCreationRequest, self).__init__(**kwargs) + self.display_name = display_name + + +class InvoiceSectionListResult(Model): + """The list of invoice sections. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of invoice sections. + :vartype value: list[~azure.mgmt.billing.models.InvoiceSection] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InvoiceSection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(InvoiceSectionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class InvoiceSectionWithCreateSubPermission(Model): + """Invoice section properties with create subscription permission. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar invoice_section_id: The ID of the invoice section. + :vartype invoice_section_id: str + :ivar invoice_section_display_name: The name of the invoice section. + :vartype invoice_section_display_name: str + :ivar billing_profile_id: The ID of the billing profile for the invoice + section. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile for + the invoice section. + :vartype billing_profile_display_name: str + :ivar billing_profile_status: The status of the billing profile. + :vartype billing_profile_status: object + :ivar billing_profile_status_reason_code: Reason for the specified billing + profile status. Possible values include: 'PastDue', + 'SpendingLimitReached', 'SpendingLimitExpired' + :vartype billing_profile_status_reason_code: str or + ~azure.mgmt.billing.models.BillingProfileStatusReasonCode + :ivar billing_profile_spending_limit: The billing profile spending limit. + Possible values include: 'Off', 'On' + :vartype billing_profile_spending_limit: str or + ~azure.mgmt.billing.models.BillingProfileSpendingLimit + :param enabled_azure_plans: Enabled azure plans for the associated billing + profile. + :type enabled_azure_plans: list[~azure.mgmt.billing.models.AzurePlan] + """ + + _validation = { + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'billing_profile_status': {'readonly': True}, + 'billing_profile_status_reason_code': {'readonly': True}, + 'billing_profile_spending_limit': {'readonly': True}, + } + + _attribute_map = { + 'invoice_section_id': {'key': 'invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'invoiceSectionDisplayName', 'type': 'str'}, + 'billing_profile_id': {'key': 'billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'billingProfileDisplayName', 'type': 'str'}, + 'billing_profile_status': {'key': 'billingProfileStatus', 'type': 'object'}, + 'billing_profile_status_reason_code': {'key': 'billingProfileStatusReasonCode', 'type': 'str'}, + 'billing_profile_spending_limit': {'key': 'billingProfileSpendingLimit', 'type': 'str'}, + 'enabled_azure_plans': {'key': 'enabledAzurePlans', 'type': '[AzurePlan]'}, + } + + def __init__(self, *, enabled_azure_plans=None, **kwargs) -> None: + super(InvoiceSectionWithCreateSubPermission, self).__init__(**kwargs) + self.invoice_section_id = None + self.invoice_section_display_name = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.billing_profile_status = None + self.billing_profile_status_reason_code = None + self.billing_profile_spending_limit = None + self.enabled_azure_plans = enabled_azure_plans + + +class Operation(Model): + """A Billing REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.billing.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: Service provider: Microsoft.Billing. + :vartype provider: str + :ivar resource: Resource on which the operation is performed such as + invoice and billing subscription. + :vartype resource: str + :ivar operation: Operation type such as read, write and delete. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class Participants(Model): + """The details about a participant. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar status: The acceptance status of the participant. + :vartype status: str + :ivar status_date: The date when the status got changed. + :vartype status_date: datetime + :ivar email: The email address of the participant. + :vartype email: str + """ + + _validation = { + 'status': {'readonly': True}, + 'status_date': {'readonly': True}, + 'email': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'status_date': {'key': 'statusDate', 'type': 'iso-8601'}, + 'email': {'key': 'email', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Participants, self).__init__(**kwargs) + self.status = None + self.status_date = None + self.email = None + + +class PaymentMethod(Resource): + """A payment method. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param payment_method_type: The type of payment method. Possible values + include: 'Credits', 'ChequeWire' + :type payment_method_type: str or + ~azure.mgmt.billing.models.PaymentMethodType + :ivar details: Details about the payment method. + :vartype details: str + :ivar expiration: Expiration month and year. + :vartype expiration: str + :ivar currency: The currency associated with the payment method. + :vartype currency: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'details': {'readonly': True}, + 'expiration': {'readonly': True}, + 'currency': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'payment_method_type': {'key': 'properties.paymentMethodType', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'str'}, + 'expiration': {'key': 'properties.expiration', 'type': 'str'}, + 'currency': {'key': 'properties.currency', 'type': 'str'}, + } + + def __init__(self, *, payment_method_type=None, **kwargs) -> None: + super(PaymentMethod, self).__init__(**kwargs) + self.payment_method_type = payment_method_type + self.details = None + self.expiration = None + self.currency = None + + +class PaymentProperties(Model): + """The properties of a payment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar payment_type: The type of payment. + :vartype payment_type: str + :ivar amount: The paid amount. + :vartype amount: ~azure.mgmt.billing.models.Amount + :ivar date_property: The date when the payment was made. + :vartype date_property: datetime + :param payment_method_family: The family of payment method. Possible + values include: 'Credits', 'CheckWire', 'CreditCard', 'None' + :type payment_method_family: str or + ~azure.mgmt.billing.models.PaymentMethodFamily + :ivar payment_method_type: The type of payment method. + :vartype payment_method_type: str + """ + + _validation = { + 'payment_type': {'readonly': True}, + 'amount': {'readonly': True}, + 'date_property': {'readonly': True}, + 'payment_method_type': {'readonly': True}, + } + + _attribute_map = { + 'payment_type': {'key': 'paymentType', 'type': 'str'}, + 'amount': {'key': 'amount', 'type': 'Amount'}, + 'date_property': {'key': 'date', 'type': 'iso-8601'}, + 'payment_method_family': {'key': 'paymentMethodFamily', 'type': 'str'}, + 'payment_method_type': {'key': 'paymentMethodType', 'type': 'str'}, + } + + def __init__(self, *, payment_method_family=None, **kwargs) -> None: + super(PaymentProperties, self).__init__(**kwargs) + self.payment_type = None + self.amount = None + self.date_property = None + self.payment_method_family = payment_method_family + self.payment_method_type = None + + +class Policy(Resource): + """A policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param marketplace_purchases: The policy that controls whether Azure + marketplace purchases are allowed for a billing profile. Possible values + include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + :type marketplace_purchases: str or + ~azure.mgmt.billing.models.MarketplacePurchasesPolicy + :param reservation_purchases: The policy that controls whether Azure + reservation purchases are allowed for a billing profile. Possible values + include: 'Allowed', 'NotAllowed' + :type reservation_purchases: str or + ~azure.mgmt.billing.models.ReservationPurchasesPolicy + :param view_charges: The policy that controls whether users with Azure + RBAC access to a subscription can view its charges. Possible values + include: 'Allowed', 'NotAllowed' + :type view_charges: str or ~azure.mgmt.billing.models.ViewChargesPolicy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'marketplace_purchases': {'key': 'properties.marketplacePurchases', 'type': 'str'}, + 'reservation_purchases': {'key': 'properties.reservationPurchases', 'type': 'str'}, + 'view_charges': {'key': 'properties.viewCharges', 'type': 'str'}, + } + + def __init__(self, *, marketplace_purchases=None, reservation_purchases=None, view_charges=None, **kwargs) -> None: + super(Policy, self).__init__(**kwargs) + self.marketplace_purchases = marketplace_purchases + self.reservation_purchases = reservation_purchases + self.view_charges = view_charges + + +class Product(Resource): + """A product. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar display_name: The display name of the product. + :vartype display_name: str + :ivar purchase_date: The date when the product was purchased. + :vartype purchase_date: datetime + :ivar product_type_id: The ID of the type of product. + :vartype product_type_id: str + :ivar product_type: The description of the type of product. + :vartype product_type: str + :param status: The current status of the product. Possible values include: + 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', + 'Cancelled', 'AutoRenew' + :type status: str or ~azure.mgmt.billing.models.ProductStatusType + :ivar end_date: The date when the product will be renewed or canceled. + :vartype end_date: datetime + :param billing_frequency: The frequency at which the product will be + billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased' + :type billing_frequency: str or + ~azure.mgmt.billing.models.BillingFrequency + :ivar last_charge: The last month charges. + :vartype last_charge: ~azure.mgmt.billing.models.Amount + :ivar last_charge_date: The date of the last charge. + :vartype last_charge_date: datetime + :ivar quantity: The quantity purchased for the product. + :vartype quantity: float + :ivar sku_id: The sku ID of the product. + :vartype sku_id: str + :ivar sku_description: The sku description of the product. + :vartype sku_description: str + :ivar tenant_id: The id of the tenant in which the product is used. + :vartype tenant_id: str + :ivar availability_id: The availability of the product. + :vartype availability_id: str + :ivar parent_product_id: Parent product Id. + :vartype parent_product_id: str + :ivar invoice_section_id: The ID of the invoice section to which the + product is billed. + :vartype invoice_section_id: str + :ivar invoice_section_display_name: The name of the invoice section to + which the product is billed. + :vartype invoice_section_display_name: str + :ivar billing_profile_id: The ID of the billing profile to which the + product is billed. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile to + which the product is billed. + :vartype billing_profile_display_name: str + :ivar customer_id: The ID of the customer for whom the product was + purchased. The field is applicable only for Microsoft Partner Agreement + billing account. + :vartype customer_id: str + :ivar customer_display_name: The name of the customer for whom the product + was purchased. The field is applicable only for Microsoft Partner + Agreement billing account. + :vartype customer_display_name: str + :ivar reseller: Reseller for this product. + :vartype reseller: ~azure.mgmt.billing.models.Reseller + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'purchase_date': {'readonly': True}, + 'product_type_id': {'readonly': True}, + 'product_type': {'readonly': True}, + 'end_date': {'readonly': True}, + 'last_charge': {'readonly': True}, + 'last_charge_date': {'readonly': True}, + 'quantity': {'readonly': True}, + 'sku_id': {'readonly': True}, + 'sku_description': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'availability_id': {'readonly': True}, + 'parent_product_id': {'readonly': True}, + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'customer_id': {'readonly': True}, + 'customer_display_name': {'readonly': True}, + 'reseller': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'purchase_date': {'key': 'properties.purchaseDate', 'type': 'iso-8601'}, + 'product_type_id': {'key': 'properties.productTypeId', 'type': 'str'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'end_date': {'key': 'properties.endDate', 'type': 'iso-8601'}, + 'billing_frequency': {'key': 'properties.billingFrequency', 'type': 'str'}, + 'last_charge': {'key': 'properties.lastCharge', 'type': 'Amount'}, + 'last_charge_date': {'key': 'properties.lastChargeDate', 'type': 'iso-8601'}, + 'quantity': {'key': 'properties.quantity', 'type': 'float'}, + 'sku_id': {'key': 'properties.skuId', 'type': 'str'}, + 'sku_description': {'key': 'properties.skuDescription', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'availability_id': {'key': 'properties.availabilityId', 'type': 'str'}, + 'parent_product_id': {'key': 'properties.parentProductId', 'type': 'str'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'properties.invoiceSectionDisplayName', 'type': 'str'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', 'type': 'str'}, + 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, + 'customer_display_name': {'key': 'properties.customerDisplayName', 'type': 'str'}, + 'reseller': {'key': 'properties.reseller', 'type': 'Reseller'}, + } + + def __init__(self, *, status=None, billing_frequency=None, **kwargs) -> None: + super(Product, self).__init__(**kwargs) + self.display_name = None + self.purchase_date = None + self.product_type_id = None + self.product_type = None + self.status = status + self.end_date = None + self.billing_frequency = billing_frequency + self.last_charge = None + self.last_charge_date = None + self.quantity = None + self.sku_id = None + self.sku_description = None + self.tenant_id = None + self.availability_id = None + self.parent_product_id = None + self.invoice_section_id = None + self.invoice_section_display_name = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.customer_id = None + self.customer_display_name = None + self.reseller = None + + +class ProductDetails(Model): + """Details of the product that is transferred. + + :param product_type: Type of the product that is transferred. Possible + values include: 'AzureSubscription', 'AzureReservation' + :type product_type: str or ~azure.mgmt.billing.models.ProductType + :param product_id: The ID of the product that is transferred. + :type product_id: str + """ + + _attribute_map = { + 'product_type': {'key': 'productType', 'type': 'str'}, + 'product_id': {'key': 'productId', 'type': 'str'}, + } + + def __init__(self, *, product_type=None, product_id: str=None, **kwargs) -> None: + super(ProductDetails, self).__init__(**kwargs) + self.product_type = product_type + self.product_id = product_id + + +class ProductsListResult(Model): + """The list of products. It contains a list of available product summaries in + reverse chronological order by purchase date. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of products. + :vartype value: list[~azure.mgmt.billing.models.Product] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Product]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ProductsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class RecipientTransferDetails(Model): + """Details of the transfer. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar creation_time: The time at which the transfer request was created. + :vartype creation_time: datetime + :ivar expiration_time: The time at which the transfer request expires. + :vartype expiration_time: datetime + :ivar allowed_product_type: Type of subscriptions that can be transferred. + :vartype allowed_product_type: list[str or + ~azure.mgmt.billing.models.EligibleProductType] + :ivar transfer_status: Overall transfer status. Possible values include: + 'Pending', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', + 'Canceled', 'Declined' + :vartype transfer_status: str or ~azure.mgmt.billing.models.TransferStatus + :ivar recipient_email_id: The email ID of the user to whom the transfer + request was sent. + :vartype recipient_email_id: str + :ivar initiator_email_id: The email ID of the user who sent the transfer + request. + :vartype initiator_email_id: str + :ivar reseller_id: Optional MPN ID of the reseller for transfer requests + that are sent from a Microsoft Partner Agreement billing account. + :vartype reseller_id: str + :ivar reseller_name: Optional name of the reseller for transfer requests + that are sent from Microsoft Partner Agreement billing account. + :vartype reseller_name: str + :ivar initiator_customer_type: The type of customer who sent the transfer + request. + :vartype initiator_customer_type: str + :ivar canceled_by: The email ID of the user who canceled the transfer + request. + :vartype canceled_by: str + :ivar last_modified_time: The time at which the transfer request was last + modified. + :vartype last_modified_time: datetime + :ivar detailed_transfer_status: Detailed transfer status. + :vartype detailed_transfer_status: + list[~azure.mgmt.billing.models.DetailedTransferStatus] + """ + + _validation = { + 'creation_time': {'readonly': True}, + 'expiration_time': {'readonly': True}, + 'allowed_product_type': {'readonly': True}, + 'transfer_status': {'readonly': True}, + 'recipient_email_id': {'readonly': True}, + 'initiator_email_id': {'readonly': True}, + 'reseller_id': {'readonly': True}, + 'reseller_name': {'readonly': True}, + 'initiator_customer_type': {'readonly': True}, + 'canceled_by': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'detailed_transfer_status': {'readonly': True}, + } + + _attribute_map = { + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'expiration_time': {'key': 'properties.expirationTime', 'type': 'iso-8601'}, + 'allowed_product_type': {'key': 'properties.allowedProductType', 'type': '[str]'}, + 'transfer_status': {'key': 'properties.transferStatus', 'type': 'str'}, + 'recipient_email_id': {'key': 'properties.recipientEmailId', 'type': 'str'}, + 'initiator_email_id': {'key': 'properties.initiatorEmailId', 'type': 'str'}, + 'reseller_id': {'key': 'properties.resellerId', 'type': 'str'}, + 'reseller_name': {'key': 'properties.resellerName', 'type': 'str'}, + 'initiator_customer_type': {'key': 'properties.initiatorCustomerType', 'type': 'str'}, + 'canceled_by': {'key': 'properties.canceledBy', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'detailed_transfer_status': {'key': 'properties.detailedTransferStatus', 'type': '[DetailedTransferStatus]'}, + } + + def __init__(self, **kwargs) -> None: + super(RecipientTransferDetails, self).__init__(**kwargs) + self.creation_time = None + self.expiration_time = None + self.allowed_product_type = None + self.transfer_status = None + self.recipient_email_id = None + self.initiator_email_id = None + self.reseller_id = None + self.reseller_name = None + self.initiator_customer_type = None + self.canceled_by = None + self.last_modified_time = None + self.detailed_transfer_status = None + + +class Reseller(Model): + """Details of the reseller. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar reseller_id: The MPN ID of the reseller. + :vartype reseller_id: str + :ivar description: The name of the reseller. + :vartype description: str + """ + + _validation = { + 'reseller_id': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'reseller_id': {'key': 'resellerId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Reseller, self).__init__(**kwargs) + self.reseller_id = None + self.description = None + + +class Transaction(Resource): + """A transaction. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param kind: The kind of transaction. Options are all or reservation. + Possible values include: 'all', 'reservation' + :type kind: str or ~azure.mgmt.billing.models.TransactionTypeKind + :ivar date_property: The date of transaction. + :vartype date_property: datetime + :ivar invoice: Invoice on which the transaction was billed or 'pending' if + the transaction is not billed. + :vartype invoice: str + :ivar order_id: The order ID of the reservation. The field is only + applicable for transaction of kind reservation. + :vartype order_id: str + :ivar order_name: The name of the reservation order. The field is only + applicable for transactions of kind reservation. + :vartype order_name: str + :ivar product_family: The family of the product for which the transaction + took place. + :vartype product_family: str + :ivar product_type_id: The ID of the product type for which the + transaction took place. + :vartype product_type_id: str + :ivar product_type: The type of the product for which the transaction took + place. + :vartype product_type: str + :ivar product_description: The description of the product for which the + transaction took place. + :vartype product_description: str + :param transaction_type: The type of transaction. Possible values include: + 'Purchase', 'Usage Charge' + :type transaction_type: str or ~azure.mgmt.billing.models.ReservationType + :ivar transaction_amount: The charge associated with the transaction. + :vartype transaction_amount: ~azure.mgmt.billing.models.Amount + :ivar quantity: The quantity purchased in the transaction. + :vartype quantity: int + :ivar invoice_section_id: The ID of the invoice section which will be + billed for the transaction. + :vartype invoice_section_id: str + :ivar invoice_section_display_name: The name of the invoice section which + will be billed for the transaction. + :vartype invoice_section_display_name: str + :ivar billing_profile_id: The ID of the billing profile which will be + billed for the transaction. + :vartype billing_profile_id: str + :ivar billing_profile_display_name: The name of the billing profile which + will be billed for the transaction. + :vartype billing_profile_display_name: str + :ivar customer_id: The ID of the customer for which the transaction took + place. The field is applicable only for Microsoft Partner Agreement + billing account. + :vartype customer_id: str + :ivar customer_display_name: The name of the customer for which the + transaction took place. The field is applicable only for Microsoft Partner + Agreement billing account. + :vartype customer_display_name: str + :ivar subscription_id: The ID of the subscription that was used for the + transaction. The field is only applicable for transaction of kind + reservation. + :vartype subscription_id: str + :ivar subscription_name: The name of the subscription that was used for + the transaction. The field is only applicable for transaction of kind + reservation. + :vartype subscription_name: str + :ivar azure_credit_applied: The amount of any Azure credits automatically + applied to this transaction. + :vartype azure_credit_applied: ~azure.mgmt.billing.models.Amount + :ivar billing_currency: The ISO 4217 code for the currency in which this + transaction is billed. + :vartype billing_currency: str + :ivar discount: The percentage discount, if any, applied to this + transaction. + :vartype discount: float + :ivar effective_price: The price of the product after applying any + discounts. + :vartype effective_price: ~azure.mgmt.billing.models.Amount + :ivar exchange_rate: The exchange rate used to convert charged amount to + billing currency, if applicable. + :vartype exchange_rate: float + :ivar market_price: The retail price of the product. + :vartype market_price: ~azure.mgmt.billing.models.Amount + :ivar pricing_currency: The ISO 4217 code for the currency in which the + product is priced. + :vartype pricing_currency: str + :ivar service_period_start_date: The date of the purchase of the product, + or the start date of the month in which usage started. + :vartype service_period_start_date: datetime + :ivar service_period_end_date: The end date of the product term, or the + end date of the month in which usage ended. + :vartype service_period_end_date: datetime + :ivar sub_total: The pre-tax charged amount for the transaction. + :vartype sub_total: ~azure.mgmt.billing.models.Amount + :ivar tax: The tax amount applied to the transaction. + :vartype tax: ~azure.mgmt.billing.models.Amount + :ivar unit_of_measure: The unit of measure used to bill for the product. + For example, compute services are billed per hour. + :vartype unit_of_measure: str + :ivar units: The number of units used for a given product. + :vartype units: float + :ivar unit_type: The description for the unit of measure for a given + product. + :vartype unit_type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'date_property': {'readonly': True}, + 'invoice': {'readonly': True}, + 'order_id': {'readonly': True}, + 'order_name': {'readonly': True}, + 'product_family': {'readonly': True}, + 'product_type_id': {'readonly': True}, + 'product_type': {'readonly': True}, + 'product_description': {'readonly': True}, + 'transaction_amount': {'readonly': True}, + 'quantity': {'readonly': True}, + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + 'customer_id': {'readonly': True}, + 'customer_display_name': {'readonly': True}, + 'subscription_id': {'readonly': True}, + 'subscription_name': {'readonly': True}, + 'azure_credit_applied': {'readonly': True}, + 'billing_currency': {'readonly': True}, + 'discount': {'readonly': True}, + 'effective_price': {'readonly': True}, + 'exchange_rate': {'readonly': True}, + 'market_price': {'readonly': True}, + 'pricing_currency': {'readonly': True}, + 'service_period_start_date': {'readonly': True}, + 'service_period_end_date': {'readonly': True}, + 'sub_total': {'readonly': True}, + 'tax': {'readonly': True}, + 'unit_of_measure': {'readonly': True}, + 'units': {'readonly': True}, + 'unit_type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'properties.kind', 'type': 'str'}, + 'date_property': {'key': 'properties.date', 'type': 'iso-8601'}, + 'invoice': {'key': 'properties.invoice', 'type': 'str'}, + 'order_id': {'key': 'properties.orderId', 'type': 'str'}, + 'order_name': {'key': 'properties.orderName', 'type': 'str'}, + 'product_family': {'key': 'properties.productFamily', 'type': 'str'}, + 'product_type_id': {'key': 'properties.productTypeId', 'type': 'str'}, + 'product_type': {'key': 'properties.productType', 'type': 'str'}, + 'product_description': {'key': 'properties.productDescription', 'type': 'str'}, + 'transaction_type': {'key': 'properties.transactionType', 'type': 'str'}, + 'transaction_amount': {'key': 'properties.transactionAmount', 'type': 'Amount'}, + 'quantity': {'key': 'properties.quantity', 'type': 'int'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'properties.invoiceSectionDisplayName', 'type': 'str'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', 'type': 'str'}, + 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, + 'customer_display_name': {'key': 'properties.customerDisplayName', 'type': 'str'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + 'subscription_name': {'key': 'properties.subscriptionName', 'type': 'str'}, + 'azure_credit_applied': {'key': 'properties.azureCreditApplied', 'type': 'Amount'}, + 'billing_currency': {'key': 'properties.billingCurrency', 'type': 'str'}, + 'discount': {'key': 'properties.discount', 'type': 'float'}, + 'effective_price': {'key': 'properties.effectivePrice', 'type': 'Amount'}, + 'exchange_rate': {'key': 'properties.exchangeRate', 'type': 'float'}, + 'market_price': {'key': 'properties.marketPrice', 'type': 'Amount'}, + 'pricing_currency': {'key': 'properties.pricingCurrency', 'type': 'str'}, + 'service_period_start_date': {'key': 'properties.servicePeriodStartDate', 'type': 'iso-8601'}, + 'service_period_end_date': {'key': 'properties.servicePeriodEndDate', 'type': 'iso-8601'}, + 'sub_total': {'key': 'properties.subTotal', 'type': 'Amount'}, + 'tax': {'key': 'properties.tax', 'type': 'Amount'}, + 'unit_of_measure': {'key': 'properties.unitOfMeasure', 'type': 'str'}, + 'units': {'key': 'properties.units', 'type': 'float'}, + 'unit_type': {'key': 'properties.unitType', 'type': 'str'}, + } + + def __init__(self, *, kind=None, transaction_type=None, **kwargs) -> None: + super(Transaction, self).__init__(**kwargs) + self.kind = kind + self.date_property = None + self.invoice = None + self.order_id = None + self.order_name = None + self.product_family = None + self.product_type_id = None + self.product_type = None + self.product_description = None + self.transaction_type = transaction_type + self.transaction_amount = None + self.quantity = None + self.invoice_section_id = None + self.invoice_section_display_name = None + self.billing_profile_id = None + self.billing_profile_display_name = None + self.customer_id = None + self.customer_display_name = None + self.subscription_id = None + self.subscription_name = None + self.azure_credit_applied = None + self.billing_currency = None + self.discount = None + self.effective_price = None + self.exchange_rate = None + self.market_price = None + self.pricing_currency = None + self.service_period_start_date = None + self.service_period_end_date = None + self.sub_total = None + self.tax = None + self.unit_of_measure = None + self.units = None + self.unit_type = None + + +class TransactionListResult(Model): + """The list of transactions. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of transactions. + :vartype value: list[~azure.mgmt.billing.models.Transaction] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Transaction]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(TransactionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class TransferBillingSubscriptionRequest(Model): + """Request parameters to transfer billing subscription. + + :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, 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 + + +class TransferBillingSubscriptionRequestProperties(Model): + """Request parameters to transfer billing subscription. + + :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, 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 + + +class TransferBillingSubscriptionResult(Model): + """Result of the transfer billing subscription operation. + + :param billing_subscription_name: The destination billing subscription id. + :type billing_subscription_name: str + """ + + _attribute_map = { + 'billing_subscription_name': {'key': 'properties.billingSubscriptionName', 'type': 'str'}, + } + + def __init__(self, *, billing_subscription_name: str=None, **kwargs) -> None: + super(TransferBillingSubscriptionResult, self).__init__(**kwargs) + self.billing_subscription_name = billing_subscription_name + + +class TransferDetails(Model): + """Details of the transfer. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar creation_time: The time at which the transfer request was created. + :vartype creation_time: datetime + :ivar expiration_time: The time at which the transfer request expires. + :vartype expiration_time: datetime + :ivar invoice_section_id: The ID of the invoice section to which the + product is billed after the transfer request is completed. + :vartype invoice_section_id: str + :ivar billing_account_id: The ID of the billing account to which the + product is billed after the transfer request is completed. + :vartype billing_account_id: str + :ivar reseller_id: Optional MPN ID of the reseller for transfer requests + that are sent from a Microsoft Partner Agreement billing account. + :vartype reseller_id: str + :ivar reseller_name: Optional name of the reseller for transfer requests + that are sent from Microsoft Partner Agreement billing account. + :vartype reseller_name: str + :ivar initiator_customer_type: The type of customer who sent the transfer + request. + :vartype initiator_customer_type: str + :ivar billing_profile_id: The ID of the billing profile to which the + product will be billed after the transfer. + :vartype billing_profile_id: str + :ivar transfer_status: Overall transfer status. Possible values include: + 'Pending', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', + 'Canceled', 'Declined' + :vartype transfer_status: str or ~azure.mgmt.billing.models.TransferStatus + :ivar recipient_email_id: The email ID of the user to whom the transfer + request was sent. + :vartype recipient_email_id: str + :ivar initiator_email_id: The email ID of the user who sent the transfer + request. + :vartype initiator_email_id: str + :ivar canceled_by: The email ID of the user who canceled the transfer + request. + :vartype canceled_by: str + :ivar last_modified_time: The time at which the transfer request was last + modified. + :vartype last_modified_time: datetime + :ivar detailed_transfer_status: Detailed transfer status. + :vartype detailed_transfer_status: + list[~azure.mgmt.billing.models.DetailedTransferStatus] + """ + + _validation = { + 'creation_time': {'readonly': True}, + 'expiration_time': {'readonly': True}, + 'invoice_section_id': {'readonly': True}, + 'billing_account_id': {'readonly': True}, + 'reseller_id': {'readonly': True}, + 'reseller_name': {'readonly': True}, + 'initiator_customer_type': {'readonly': True}, + 'billing_profile_id': {'readonly': True}, + 'transfer_status': {'readonly': True}, + 'recipient_email_id': {'readonly': True}, + 'initiator_email_id': {'readonly': True}, + 'canceled_by': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'detailed_transfer_status': {'readonly': True}, + } + + _attribute_map = { + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'expiration_time': {'key': 'properties.expirationTime', 'type': 'iso-8601'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'billing_account_id': {'key': 'properties.billingAccountId', 'type': 'str'}, + 'reseller_id': {'key': 'properties.resellerId', 'type': 'str'}, + 'reseller_name': {'key': 'properties.resellerName', 'type': 'str'}, + 'initiator_customer_type': {'key': 'properties.initiatorCustomerType', 'type': 'str'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'transfer_status': {'key': 'properties.transferStatus', 'type': 'str'}, + 'recipient_email_id': {'key': 'properties.recipientEmailId', 'type': 'str'}, + 'initiator_email_id': {'key': 'properties.initiatorEmailId', 'type': 'str'}, + 'canceled_by': {'key': 'properties.canceledBy', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'detailed_transfer_status': {'key': 'properties.detailedTransferStatus', 'type': '[DetailedTransferStatus]'}, + } + + def __init__(self, **kwargs) -> None: + super(TransferDetails, self).__init__(**kwargs) + self.creation_time = None + self.expiration_time = None + self.invoice_section_id = None + self.billing_account_id = None + self.reseller_id = None + self.reseller_name = None + self.initiator_customer_type = None + self.billing_profile_id = None + self.transfer_status = None + self.recipient_email_id = None + self.initiator_email_id = None + self.canceled_by = None + self.last_modified_time = None + self.detailed_transfer_status = None + + +class TransferProductRequestProperties(Model): + """The properties of the product to initiate a 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 + """ + + _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, 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 + + +class UpdateAutoRenewOperation(Model): + """Result of the update auto renew operation. + + :param end_date: The date at which the product will be canceled. + :type end_date: datetime + """ + + _attribute_map = { + 'end_date': {'key': 'properties.endDate', 'type': 'iso-8601'}, + } + + def __init__(self, *, end_date=None, **kwargs) -> None: + super(UpdateAutoRenewOperation, self).__init__(**kwargs) + self.end_date = end_date + + +class UpdateAutoRenewRequest(Model): + """Request parameters to update auto renew settings for a product. + + :param auto_renew: The flag that determines the auto-renew settings for a + product. Possible values include: 'true', 'false' + :type auto_renew: str or ~azure.mgmt.billing.models.UpdateAutoRenew + """ + + _attribute_map = { + 'auto_renew': {'key': 'autoRenew', 'type': 'str'}, + } + + def __init__(self, *, auto_renew=None, **kwargs) -> None: + super(UpdateAutoRenewRequest, self).__init__(**kwargs) + self.auto_renew = auto_renew + + +class ValidateAddressResponse(Model): + """Result of the address validation. + + :param status: status of the address validation. Possible values include: + 'Valid', 'Invalid' + :type status: str or ~azure.mgmt.billing.models.AddressValidationStatus + :param suggested_addresses: The list of suggested addresses. + :type suggested_addresses: list[~azure.mgmt.billing.models.AddressDetails] + :param validation_message: Validation error message. + :type validation_message: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'suggested_addresses': {'key': 'suggestedAddresses', 'type': '[AddressDetails]'}, + 'validation_message': {'key': 'validationMessage', 'type': 'str'}, + } + + def __init__(self, *, status=None, suggested_addresses=None, validation_message: str=None, **kwargs) -> None: + super(ValidateAddressResponse, self).__init__(**kwargs) + self.status = status + self.suggested_addresses = suggested_addresses + self.validation_message = validation_message + + +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 + + +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 + + +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 + + +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 subscription is eligible + to be transferred. + :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 + + +class ValidateTransferListResponse(Model): + """Result of transfer validation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of transfer validation results. + :vartype value: list[~azure.mgmt.billing.models.ValidateTransferResponse] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ValidateTransferResponse]'}, + } + + def __init__(self, **kwargs) -> None: + super(ValidateTransferListResponse, self).__init__(**kwargs) + self.value = None + + +class ValidateTransferResponse(Model): + """Transfer validation response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar status: The status of validation + :vartype status: str + :ivar product_id: The product id for which this result applies. + :vartype product_id: str + :param results: The array of validation results. + :type results: list[~azure.mgmt.billing.models.ValidationResultProperties] + """ + + _validation = { + 'status': {'readonly': True}, + 'product_id': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'properties.status', 'type': 'str'}, + 'product_id': {'key': 'properties.productId', 'type': 'str'}, + 'results': {'key': 'properties.results', 'type': '[ValidationResultProperties]'}, + } + + def __init__(self, *, results=None, **kwargs) -> None: + super(ValidateTransferResponse, self).__init__(**kwargs) + self.status = None + self.product_id = None + self.results = results + + +class ValidationResultProperties(Model): + """The properties of the validation result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar level: Result Level. + :vartype level: str + :ivar code: Result Code. + :vartype code: str + :ivar message: The validation message. + :vartype message: str + """ + + _validation = { + 'level': {'readonly': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'level': {'key': 'level', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ValidationResultProperties, self).__init__(**kwargs) + self.level = None + self.code = None + self.message = None diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_paged_models.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_paged_models.py new file mode 100644 index 000000000000..20f1ee4f239a --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_paged_models.py @@ -0,0 +1,157 @@ +# 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.paging import Paged + + +class InvoiceSectionWithCreateSubPermissionPaged(Paged): + """ + A paging container for iterating over a list of :class:`InvoiceSectionWithCreateSubPermission ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[InvoiceSectionWithCreateSubPermission]'} + } + + def __init__(self, *args, **kwargs): + + super(InvoiceSectionWithCreateSubPermissionPaged, self).__init__(*args, **kwargs) +class PaymentMethodPaged(Paged): + """ + A paging container for iterating over a list of :class:`PaymentMethod ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PaymentMethod]'} + } + + def __init__(self, *args, **kwargs): + + super(PaymentMethodPaged, self).__init__(*args, **kwargs) +class InstructionPaged(Paged): + """ + A paging container for iterating over a list of :class:`Instruction ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Instruction]'} + } + + def __init__(self, *args, **kwargs): + + super(InstructionPaged, self).__init__(*args, **kwargs) +class CustomerPaged(Paged): + """ + A paging container for iterating over a list of :class:`Customer ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Customer]'} + } + + def __init__(self, *args, **kwargs): + + super(CustomerPaged, self).__init__(*args, **kwargs) +class BillingSubscriptionPaged(Paged): + """ + A paging container for iterating over a list of :class:`BillingSubscription ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BillingSubscription]'} + } + + def __init__(self, *args, **kwargs): + + super(BillingSubscriptionPaged, self).__init__(*args, **kwargs) +class ProductPaged(Paged): + """ + A paging container for iterating over a list of :class:`Product ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Product]'} + } + + def __init__(self, *args, **kwargs): + + super(ProductPaged, self).__init__(*args, **kwargs) +class TransactionPaged(Paged): + """ + A paging container for iterating over a list of :class:`Transaction ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Transaction]'} + } + + def __init__(self, *args, **kwargs): + + super(TransactionPaged, self).__init__(*args, **kwargs) +class InvoicePaged(Paged): + """ + A paging container for iterating over a list of :class:`Invoice ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Invoice]'} + } + + def __init__(self, *args, **kwargs): + + super(InvoicePaged, self).__init__(*args, **kwargs) +class TransferDetailsPaged(Paged): + """ + A paging container for iterating over a list of :class:`TransferDetails ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[TransferDetails]'} + } + + def __init__(self, *args, **kwargs): + + super(TransferDetailsPaged, self).__init__(*args, **kwargs) +class RecipientTransferDetailsPaged(Paged): + """ + A paging container for iterating over a list of :class:`RecipientTransferDetails ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RecipientTransferDetails]'} + } + + def __init__(self, *args, **kwargs): + + super(RecipientTransferDetailsPaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_period.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_period.py deleted file mode 100644 index a8a38c17d40f..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_period.py +++ /dev/null @@ -1,59 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource import Resource - - -class BillingPeriod(Resource): - """A billing period resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar billing_period_start_date: The start of the date range covered by - the billing period. - :vartype billing_period_start_date: date - :ivar billing_period_end_date: The end of the date range covered by the - billing period. - :vartype billing_period_end_date: date - :ivar invoice_ids: Array of invoice ids that associated with. - :vartype invoice_ids: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'billing_period_start_date': {'readonly': True}, - 'billing_period_end_date': {'readonly': True}, - 'invoice_ids': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'billing_period_start_date': {'key': 'properties.billingPeriodStartDate', 'type': 'date'}, - 'billing_period_end_date': {'key': 'properties.billingPeriodEndDate', 'type': 'date'}, - 'invoice_ids': {'key': 'properties.invoiceIds', 'type': '[str]'}, - } - - def __init__(self): - super(BillingPeriod, self).__init__() - self.billing_period_start_date = None - self.billing_period_end_date = None - self.invoice_ids = None diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_period_paged.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_period_paged.py deleted file mode 100644 index 54fd2546182b..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/billing_period_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class BillingPeriodPaged(Paged): - """ - A paging container for iterating over a list of :class:`BillingPeriod ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BillingPeriod]'} - } - - def __init__(self, *args, **kwargs): - - super(BillingPeriodPaged, self).__init__(*args, **kwargs) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/download_url.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/download_url.py deleted file mode 100644 index 175264024ae9..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/download_url.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class DownloadUrl(Model): - """A secure URL that can be used to download a PDF invoice until the URL - expires. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar expiry_time: The time in UTC at which this download URL will expire. - :vartype expiry_time: datetime - :ivar url: The URL to the PDF file. - :vartype url: str - """ - - _validation = { - 'expiry_time': {'readonly': True}, - 'url': {'readonly': True}, - } - - _attribute_map = { - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__(self): - super(DownloadUrl, self).__init__() - self.expiry_time = None - self.url = None diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/enrollment_account.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/enrollment_account.py deleted file mode 100644 index 3e8e6cb69204..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/enrollment_account.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource import Resource - - -class EnrollmentAccount(Resource): - """An enrollment account resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar principal_name: The account owner's principal name. - :vartype principal_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'principal_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, - } - - def __init__(self): - super(EnrollmentAccount, self).__init__() - self.principal_name = None diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/enrollment_account_paged.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/enrollment_account_paged.py deleted file mode 100644 index bf852a37e1b1..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/enrollment_account_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class EnrollmentAccountPaged(Paged): - """ - A paging container for iterating over a list of :class:`EnrollmentAccount ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[EnrollmentAccount]'} - } - - def __init__(self, *args, **kwargs): - - super(EnrollmentAccountPaged, self).__init__(*args, **kwargs) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/error_details.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/error_details.py deleted file mode 100644 index 91d77d6df46b..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/error_details.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ErrorDetails(Model): - """The details of the error. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - :ivar target: The target of the particular error. - :vartype target: str - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__(self): - super(ErrorDetails, self).__init__() - self.code = None - self.message = None - self.target = None diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/error_response.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/error_response.py deleted file mode 100644 index 06441e8c4e75..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/error_response.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError - - -class ErrorResponse(Model): - """Error response indicates that the service is not able to process the - incoming request. The reason is provided in the error message. - - :param error: The details of the error. - :type error: ~azure.mgmt.billing.models.ErrorDetails - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetails'}, - } - - def __init__(self, error=None): - super(ErrorResponse, self).__init__() - self.error = error - - -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/invoice.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/invoice.py deleted file mode 100644 index c97af83790a2..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/invoice.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource import Resource - - -class Invoice(Resource): - """An invoice resource can be used download a PDF version of an invoice. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param download_url: A secure link to download the PDF version of an - invoice. The link will cease to work after its expiry time is reached. - :type download_url: ~azure.mgmt.billing.models.DownloadUrl - :ivar invoice_period_start_date: The start of the date range covered by - the invoice. - :vartype invoice_period_start_date: date - :ivar invoice_period_end_date: The end of the date range covered by the - invoice. - :vartype invoice_period_end_date: date - :ivar billing_period_ids: Array of billing perdiod ids that the invoice is - attributed to. - :vartype billing_period_ids: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'invoice_period_start_date': {'readonly': True}, - 'invoice_period_end_date': {'readonly': True}, - 'billing_period_ids': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'download_url': {'key': 'properties.downloadUrl', 'type': 'DownloadUrl'}, - 'invoice_period_start_date': {'key': 'properties.invoicePeriodStartDate', 'type': 'date'}, - 'invoice_period_end_date': {'key': 'properties.invoicePeriodEndDate', 'type': 'date'}, - 'billing_period_ids': {'key': 'properties.billingPeriodIds', 'type': '[str]'}, - } - - def __init__(self, download_url=None): - super(Invoice, self).__init__() - self.download_url = download_url - self.invoice_period_start_date = None - self.invoice_period_end_date = None - self.billing_period_ids = None diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/invoice_paged.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/invoice_paged.py deleted file mode 100644 index 500bcafab923..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/invoice_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class InvoicePaged(Paged): - """ - A paging container for iterating over a list of :class:`Invoice ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Invoice]'} - } - - def __init__(self, *args, **kwargs): - - super(InvoicePaged, self).__init__(*args, **kwargs) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation.py deleted file mode 100644 index c2aae214fd34..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Operation(Model): - """A Billing REST API operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.billing.models.OperationDisplay - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__(self, display=None): - super(Operation, self).__init__() - self.name = None - self.display = display diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation_display.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation_display.py deleted file mode 100644 index 0dcad2d20d02..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation_display.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationDisplay(Model): - """The object that represents the operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar provider: Service provider: Microsoft.Billing. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: Invoice, - etc. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. - :vartype operation: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - } - - def __init__(self): - super(OperationDisplay, self).__init__() - self.provider = None - self.resource = None - self.operation = None diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation_paged.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation_paged.py deleted file mode 100644 index 434d72d13b22..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/operation_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class OperationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Operation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/resource.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/resource.py deleted file mode 100644 index ff02c012b072..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/resource.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Resource(Model): - """The Resource model definition. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self): - super(Resource, self).__init__() - self.id = None - self.name = None - self.type = None diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py index c3d1d198514e..933542baff8d 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py @@ -9,14 +9,56 @@ # regenerated. # -------------------------------------------------------------------------- -from .enrollment_accounts_operations import EnrollmentAccountsOperations -from .billing_periods_operations import BillingPeriodsOperations -from .invoices_operations import InvoicesOperations -from .operations import Operations +from ._billing_accounts_operations import BillingAccountsOperations +from ._payment_methods_operations import PaymentMethodsOperations +from ._address_operations import AddressOperations +from ._available_balances_operations import AvailableBalancesOperations +from ._instructions_operations import InstructionsOperations +from ._billing_profiles_operations import BillingProfilesOperations +from ._customers_operations import CustomersOperations +from ._invoice_sections_operations import InvoiceSectionsOperations +from ._billing_permissions_operations import BillingPermissionsOperations +from ._billing_subscriptions_operations import BillingSubscriptionsOperations +from ._products_operations import ProductsOperations +from ._transactions_operations import TransactionsOperations +from ._departments_operations import DepartmentsOperations +from ._enrollment_accounts_operations import EnrollmentAccountsOperations +from ._invoices_operations import InvoicesOperations +from ._price_sheet_operations import PriceSheetOperations +from ._policies_operations import PoliciesOperations +from ._billing_property_operations import BillingPropertyOperations +from ._transfers_operations import TransfersOperations +from ._partner_transfers_operations import PartnerTransfersOperations +from ._recipient_transfers_operations import RecipientTransfersOperations +from ._operations import Operations +from ._billing_role_definitions_operations import BillingRoleDefinitionsOperations +from ._billing_role_assignments_operations import BillingRoleAssignmentsOperations +from ._agreements_operations import AgreementsOperations __all__ = [ + 'BillingAccountsOperations', + 'PaymentMethodsOperations', + 'AddressOperations', + 'AvailableBalancesOperations', + 'InstructionsOperations', + 'BillingProfilesOperations', + 'CustomersOperations', + 'InvoiceSectionsOperations', + 'BillingPermissionsOperations', + 'BillingSubscriptionsOperations', + 'ProductsOperations', + 'TransactionsOperations', + 'DepartmentsOperations', 'EnrollmentAccountsOperations', - 'BillingPeriodsOperations', 'InvoicesOperations', + 'PriceSheetOperations', + 'PoliciesOperations', + 'BillingPropertyOperations', + 'TransfersOperations', + 'PartnerTransfersOperations', + 'RecipientTransfersOperations', 'Operations', + 'BillingRoleDefinitionsOperations', + 'BillingRoleAssignmentsOperations', + 'AgreementsOperations', ] diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_address_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_address_operations.py new file mode 100644 index 000000000000..2f52af650619 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_address_operations.py @@ -0,0 +1,96 @@ +# 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 .. import models + + +class AddressOperations(object): + """AddressOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def validate( + self, address, custom_headers=None, raw=False, **operation_config): + """Validates an address. Use the operation to validate an address before + using it as a billing account or a billing profile address. + + :param address: + :type address: ~azure.mgmt.billing.models.AddressDetails + :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: ValidateAddressResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.ValidateAddressResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.validate.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(address, 'AddressDetails') + + # 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('ValidateAddressResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + validate.metadata = {'url': '/providers/Microsoft.Billing/validateAddress'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_agreements_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_agreements_operations.py new file mode 100644 index 000000000000..2c14405544b6 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_agreements_operations.py @@ -0,0 +1,164 @@ +# 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 .. import models + + +class AgreementsOperations(object): + """AgreementsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_billing_account( + self, billing_account_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Lists the agreements for a billing account. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param expand: May be used to expand the participants. + :type expand: 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: AgreementListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.AgreementListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('AgreementListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements'} + + def get( + self, billing_account_name, agreement_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets an agreement by ID. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param agreement_name: The ID that uniquely identifies an agreement. + :type agreement_name: str + :param expand: May be used to expand the participants. + :type expand: 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: Agreement or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Agreement or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'agreementName': self._serialize.url("agreement_name", agreement_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('Agreement', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_available_balances_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_available_balances_operations.py new file mode 100644 index 000000000000..be0ce5e62d43 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_available_balances_operations.py @@ -0,0 +1,103 @@ +# 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 .. import models + + +class AvailableBalancesOperations(object): + """AvailableBalancesOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def get_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """The available credit balance for a billing profile. This is the balance + that can be used for pay now to settle due or past due invoices. The + operation is supported only for billing accounts with agreement type + Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: 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: AvailableBalance or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.AvailableBalance or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('AvailableBalance', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_accounts_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_accounts_operations.py new file mode 100644 index 000000000000..9ccdc7004e45 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_accounts_operations.py @@ -0,0 +1,328 @@ +# 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 BillingAccountsOperations(object): + """BillingAccountsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list( + self, expand=None, custom_headers=None, raw=False, **operation_config): + """Lists the billing accounts that a user has access to. + + :param expand: May be used to expand the address, invoice sections and + billing profiles. + :type expand: 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: BillingAccountListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingAccountListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingAccountListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts'} + + def get( + self, billing_account_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets a billing account by its ID. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param expand: May be used to expand the address, invoice sections and + billing profiles. + :type expand: 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: BillingAccount or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingAccount or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}'} + + + def _update_initial( + self, billing_account_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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(parameters, 'BillingAccountUpdateRequest') + + # Construct and send request + request = self._client.patch(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.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BillingAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, billing_account_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates the properties of a billing account. Currently, displayName and + address can be updated. The operation is supported only for billing + accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param parameters: Request parameters that are provided to the update + billing account operation. + :type parameters: + ~azure.mgmt.billing.models.BillingAccountUpdateRequest + :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 BillingAccount or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.BillingAccount] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.BillingAccount]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._update_initial( + billing_account_name=billing_account_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('BillingAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + 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, **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) + update.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}'} + + def list_invoice_sections_by_create_subscription_permission( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Lists the invoice sections for which the user has permission to create + Azure subscriptions. The operation is supported only for billing + accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: 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: An iterator like instance of + InvoiceSectionWithCreateSubPermission + :rtype: + ~azure.mgmt.billing.models.InvoiceSectionWithCreateSubPermissionPaged[~azure.mgmt.billing.models.InvoiceSectionWithCreateSubPermission] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_invoice_sections_by_create_subscription_permission.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.InvoiceSectionWithCreateSubPermissionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_invoice_sections_by_create_subscription_permission.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_permissions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_permissions_operations.py new file mode 100644 index 000000000000..412d3788f377 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_permissions_operations.py @@ -0,0 +1,282 @@ +# 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 .. import models + + +class BillingPermissionsOperations(object): + """BillingPermissionsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_customer( + self, billing_account_name, customer_name, custom_headers=None, raw=False, **operation_config): + """Lists the billing permissions the caller has for a customer. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: 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: BillingPermissionsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingPermissionsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_customer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingPermissionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_customer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions'} + + def list_by_billing_account( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Lists the billing permissions the caller has on a billing account. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: 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: BillingPermissionsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingPermissionsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingPermissionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions'} + + def list_by_invoice_sections( + self, billing_account_name, billing_profile_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Lists the billing permissions the caller has on an invoice section. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: 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: BillingPermissionsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingPermissionsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_invoice_sections.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingPermissionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_invoice_sections.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions'} + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Lists the billing permissions the caller has on a billing profile. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: 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: BillingPermissionsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingPermissionsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingPermissionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_profiles_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_profiles_operations.py new file mode 100644 index 000000000000..fa792bfd6403 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_profiles_operations.py @@ -0,0 +1,401 @@ +# 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 BillingProfilesOperations(object): + """BillingProfilesOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_billing_account( + self, billing_account_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Lists the billing profiles that a user has access to. The operation is + supported for billing accounts with agreement type Microsoft Customer + Agreement or Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param expand: May be used to expand the invoice sections. + :type expand: 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: BillingProfileListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingProfileListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingProfileListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles'} + + def get( + self, billing_account_name, billing_profile_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets a billing profile by its ID. The operation is supported for + billing accounts with agreement type Microsoft Customer Agreement or + Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param expand: May be used to expand the invoice sections. + :type expand: 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: BillingProfile or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingProfile or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingProfile', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}'} + + + def _create_initial( + self, billing_account_name, billing_profile_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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(parameters, 'BillingProfileCreationRequest') + + # Construct and send request + request = self._client.put(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.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('BillingProfile', 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 create( + self, billing_account_name, billing_profile_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a billing profile. The operation is supported for billing + accounts with agreement type Microsoft Customer Agreement or Microsoft + Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param parameters: Request parameters that are provided to the create + billing profile operation. + :type parameters: + ~azure.mgmt.billing.models.BillingProfileCreationRequest + :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 BillingProfile or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.BillingProfile] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.BillingProfile]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_initial( + billing_account_name=billing_account_name, + billing_profile_name=billing_profile_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + deserialized = self._deserialize('BillingProfile', 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, **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) + create.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}'} + + + def _update_initial( + self, billing_account_name, billing_profile_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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(parameters, 'BillingProfile') + + # Construct and send request + request = self._client.patch(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.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('BillingProfile', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def update( + self, billing_account_name, billing_profile_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates the properties of a billing profile. Currently, displayName, + poNumber, bill-to address and invoiceEmailOptIn can be updated. The + operation is supported for billing accounts with agreement type + Microsoft Customer Agreement or Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param parameters: Request parameters supplied to the update billing + profile operation. + :type parameters: ~azure.mgmt.billing.models.BillingProfile + :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 BillingProfile or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.BillingProfile] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.BillingProfile]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._update_initial( + billing_account_name=billing_account_name, + billing_profile_name=billing_profile_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + deserialized = self._deserialize('BillingProfile', 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, **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) + update.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_property_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_property_operations.py new file mode 100644 index 000000000000..d12105316c84 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_property_operations.py @@ -0,0 +1,95 @@ +# 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 .. import models + + +class BillingPropertyOperations(object): + """BillingPropertyOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def get( + self, custom_headers=None, raw=False, **operation_config): + """Get the billing properties for a subscription. This operation is not + supported for billing accounts with agreement type Enterprise + Agreement. + + :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: BillingProperty or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingProperty or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingProperty', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_assignments_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_assignments_operations.py new file mode 100644 index 000000000000..5517c6d74345 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_assignments_operations.py @@ -0,0 +1,856 @@ +# 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 .. import models + + +class BillingRoleAssignmentsOperations(object): + """BillingRoleAssignmentsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def get_by_billing_account( + self, billing_account_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Gets a role assignment for the caller on a billing account. The + operation is supported for billing accounts with agreement type + Microsoft Partner Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_role_assignment_name: The ID that uniquely identifies a + role assignment. + :type billing_role_assignment_name: 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: BillingRoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingRoleAssignmentName': self._serialize.url("billing_role_assignment_name", billing_role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}'} + + def delete_by_billing_account( + self, billing_account_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Deletes a role assignment for the caller on a billing account. The + operation is supported for billing accounts with agreement type + Microsoft Partner Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_role_assignment_name: The ID that uniquely identifies a + role assignment. + :type billing_role_assignment_name: 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: BillingRoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingRoleAssignmentName': self._serialize.url("billing_role_assignment_name", billing_role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.delete(url, query_parameters, header_parameters) + 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('BillingRoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}'} + + def get_by_invoice_section( + self, billing_account_name, billing_profile_name, invoice_section_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Gets a role assignment for the caller on an invoice section. The + operation is supported for billing accounts with agreement type + Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param billing_role_assignment_name: The ID that uniquely identifies a + role assignment. + :type billing_role_assignment_name: 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: BillingRoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_invoice_section.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'billingRoleAssignmentName': self._serialize.url("billing_role_assignment_name", billing_role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}'} + + def delete_by_invoice_section( + self, billing_account_name, billing_profile_name, invoice_section_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Deletes a role assignment for the caller on an invoice section. The + operation is supported for billing accounts with agreement type + Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param billing_role_assignment_name: The ID that uniquely identifies a + role assignment. + :type billing_role_assignment_name: 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: BillingRoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete_by_invoice_section.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'billingRoleAssignmentName': self._serialize.url("billing_role_assignment_name", billing_role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.delete(url, query_parameters, header_parameters) + 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('BillingRoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}'} + + def get_by_billing_profile( + self, billing_account_name, billing_profile_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Gets a role assignment for the caller on a billing profile. The + operation is supported for billing accounts with agreement type + Microsoft Partner Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param billing_role_assignment_name: The ID that uniquely identifies a + role assignment. + :type billing_role_assignment_name: 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: BillingRoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'billingRoleAssignmentName': self._serialize.url("billing_role_assignment_name", billing_role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}'} + + def delete_by_billing_profile( + self, billing_account_name, billing_profile_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Deletes a role assignment for the caller on a billing profile. The + operation is supported for billing accounts with agreement type + Microsoft Partner Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param billing_role_assignment_name: The ID that uniquely identifies a + role assignment. + :type billing_role_assignment_name: 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: BillingRoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'billingRoleAssignmentName': self._serialize.url("billing_role_assignment_name", billing_role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.delete(url, query_parameters, header_parameters) + 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('BillingRoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}'} + + def list_by_billing_account( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Lists the role assignments for the caller on a billing account. The + operation is supported for billing accounts with agreement type + Microsoft Partner Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: 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: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments'} + + def add_by_billing_account( + self, billing_account_name, principal_id=None, billing_role_definition_id=None, custom_headers=None, raw=False, **operation_config): + """Adds a role assignment on a billing account. The operation is supported + for billing accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param principal_id: The user's principal id that the role gets + assigned to + :type principal_id: str + :param billing_role_definition_id: The role definition id + :type billing_role_definition_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: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.BillingRoleAssignmentPayload(principal_id=principal_id, billing_role_definition_id=billing_role_definition_id) + + # Construct URL + url = self.add_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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(parameters, 'BillingRoleAssignmentPayload') + + # 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 [201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/createBillingRoleAssignment'} + + def list_by_invoice_section( + self, billing_account_name, billing_profile_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Lists the role assignments for the caller on an invoice section. The + operation is supported for billing accounts with agreement type + Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: 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: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_invoice_section.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments'} + + def add_by_invoice_section( + self, billing_account_name, billing_profile_name, invoice_section_name, principal_id=None, billing_role_definition_id=None, custom_headers=None, raw=False, **operation_config): + """Adds a role assignment on an invoice section. The operation is + supported for billing accounts with agreement type Microsoft Customer + Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param principal_id: The user's principal id that the role gets + assigned to + :type principal_id: str + :param billing_role_definition_id: The role definition id + :type billing_role_definition_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: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.BillingRoleAssignmentPayload(principal_id=principal_id, billing_role_definition_id=billing_role_definition_id) + + # Construct URL + url = self.add_by_invoice_section.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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(parameters, 'BillingRoleAssignmentPayload') + + # 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 [201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/createBillingRoleAssignment'} + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Lists the role assignments for the caller on a billing profile. The + operation is supported for billing accounts with agreement type + Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: 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: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments'} + + def add_by_billing_profile( + self, billing_account_name, billing_profile_name, principal_id=None, billing_role_definition_id=None, custom_headers=None, raw=False, **operation_config): + """Adds a role assignment on a billing profile. The operation is supported + for billing accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param principal_id: The user's principal id that the role gets + assigned to + :type principal_id: str + :param billing_role_definition_id: The role definition id + :type billing_role_definition_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: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.BillingRoleAssignmentPayload(principal_id=principal_id, billing_role_definition_id=billing_role_definition_id) + + # Construct URL + url = self.add_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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(parameters, 'BillingRoleAssignmentPayload') + + # 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 [201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/createBillingRoleAssignment'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_definitions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_definitions_operations.py new file mode 100644 index 000000000000..af2965d57be7 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_definitions_operations.py @@ -0,0 +1,432 @@ +# 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 .. import models + + +class BillingRoleDefinitionsOperations(object): + """BillingRoleDefinitionsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def get_by_billing_account( + self, billing_account_name, billing_role_definition_name, custom_headers=None, raw=False, **operation_config): + """Gets the definition for a role on a billing account. The operation is + supported for billing accounts with agreement type Microsoft Partner + Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_role_definition_name: The ID that uniquely identifies a + role definition. + :type billing_role_definition_name: 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: BillingRoleDefinition or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleDefinition or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingRoleDefinitionName': self._serialize.url("billing_role_definition_name", billing_role_definition_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}'} + + def get_by_invoice_section( + self, billing_account_name, billing_profile_name, invoice_section_name, billing_role_definition_name, custom_headers=None, raw=False, **operation_config): + """Gets the definition for a role on an invoice section. The operation is + supported only for billing accounts with agreement type Microsoft + Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param billing_role_definition_name: The ID that uniquely identifies a + role definition. + :type billing_role_definition_name: 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: BillingRoleDefinition or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleDefinition or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_invoice_section.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'billingRoleDefinitionName': self._serialize.url("billing_role_definition_name", billing_role_definition_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}'} + + def get_by_billing_profile( + self, billing_account_name, billing_profile_name, billing_role_definition_name, custom_headers=None, raw=False, **operation_config): + """Gets the definition for a role on a billing profile. The operation is + supported for billing accounts with agreement type Microsoft Partner + Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param billing_role_definition_name: The ID that uniquely identifies a + role definition. + :type billing_role_definition_name: 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: BillingRoleDefinition or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleDefinition or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'billingRoleDefinitionName': self._serialize.url("billing_role_definition_name", billing_role_definition_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}'} + + def list_by_billing_account( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Lists the role definitions for a billing account. The operation is + supported for billing accounts with agreement type Microsoft Partner + Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: 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: BillingRoleDefinitionListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleDefinitionListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleDefinitionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions'} + + def list_by_invoice_section( + self, billing_account_name, billing_profile_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Lists the role definitions for an invoice section. The operation is + supported for billing accounts with agreement type Microsoft Partner + Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: 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: BillingRoleDefinitionListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleDefinitionListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_invoice_section.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleDefinitionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions'} + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Lists the role definitions for a billing profile. The operation is + supported for billing accounts with agreement type Microsoft Partner + Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: 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: BillingRoleDefinitionListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleDefinitionListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingRoleDefinitionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions'} 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 new file mode 100644 index 000000000000..afc49d8aa058 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_subscriptions_operations.py @@ -0,0 +1,667 @@ +# 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 BillingSubscriptionsOperations(object): + """BillingSubscriptionsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_customer( + self, billing_account_name, customer_name, custom_headers=None, raw=False, **operation_config): + """Lists the subscriptions for a customer. The operation is supported only + for billing accounts with agreement type Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: 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: An iterator like instance of BillingSubscription + :rtype: + ~azure.mgmt.billing.models.BillingSubscriptionPaged[~azure.mgmt.billing.models.BillingSubscription] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_customer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.BillingSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_customer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions'} + + def get_by_customer( + self, billing_account_name, customer_name, billing_subscription_name, custom_headers=None, raw=False, **operation_config): + """Gets a subscription by its ID. The operation is supported only for + billing accounts with agreement type Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: str + :param billing_subscription_name: The ID that uniquely identifies a + subscription. + :type billing_subscription_name: 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: BillingSubscription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingSubscription or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_customer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_customer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions/{billingSubscriptionName}'} + + def list_by_billing_account( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Lists the subscriptions for a billing account. The operation is + supported for billing accounts with agreement type Microsoft Customer + Agreement or Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: 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: An iterator like instance of BillingSubscription + :rtype: + ~azure.mgmt.billing.models.BillingSubscriptionPaged[~azure.mgmt.billing.models.BillingSubscription] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.BillingSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions'} + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Lists the subscriptions that are billed to a billing profile. The + operation is supported for billing accounts with agreement type + Microsoft Customer Agreement or Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: 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: BillingSubscriptionsListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingSubscriptionsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingSubscriptionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions'} + + def list_by_invoice_section( + self, billing_account_name, billing_profile_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Lists the subscriptions that are billed to an invoice section. The + operation is supported only for billing accounts with agreement type + Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: 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: BillingSubscriptionsListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingSubscriptionsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_invoice_section.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingSubscriptionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions'} + + def get( + self, billing_account_name, billing_profile_name, invoice_section_name, billing_subscription_name, custom_headers=None, raw=False, **operation_config): + """Gets a subscription by its ID. The operation is supported only for + billing accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param billing_subscription_name: The ID that uniquely identifies a + subscription. + :type billing_subscription_name: 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: BillingSubscription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingSubscription or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('BillingSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}'} + + + def _transfer_initial( + self, billing_account_name, billing_profile_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'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_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, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('TransferBillingSubscriptionResult', 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 transfer( + self, billing_account_name, billing_profile_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): + """Moves a subscription's charges to a new invoice section. The new + invoice section must belong to the same billing profile as the existing + invoice section. This operation is supported only for products that are + purchased with a recurring charge and for billing accounts with + agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param billing_subscription_name: The ID that uniquely identifies a + subscription. + :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: 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 + TransferBillingSubscriptionResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.TransferBillingSubscriptionResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.TransferBillingSubscriptionResult]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._transfer_initial( + billing_account_name=billing_account_name, + billing_profile_name=billing_profile_name, + 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 + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + deserialized = self._deserialize('TransferBillingSubscriptionResult', 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, **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) + transfer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer'} + + def validate_transfer( + self, billing_account_name, billing_profile_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 if a subscription's charges can be moved to a new invoice + section. This operation is supported only for products that are + purchased with a recurring charge and for billing accounts with + agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param billing_subscription_name: The ID that uniquely identifies a + subscription. + :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'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_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}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/validateTransferEligibility'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_customers_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_customers_operations.py new file mode 100644 index 000000000000..695efe753151 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_customers_operations.py @@ -0,0 +1,270 @@ +# 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 .. import models + + +class CustomersOperations(object): + """CustomersOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, filter=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): + """Lists the customers that are billed to a billing profile. The operation + is supported only for billing accounts with agreement type Microsoft + Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param filter: May be used to filter the list of customers. + :type filter: str + :param skiptoken: Skiptoken is only used if a previous operation + returned a partial result. If a previous response contains a nextLink + element, the value of the nextLink element will include a skiptoken + parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: 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: An iterator like instance of Customer + :rtype: + ~azure.mgmt.billing.models.CustomerPaged[~azure.mgmt.billing.models.Customer] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.CustomerPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers'} + + def list_by_billing_account( + self, billing_account_name, filter=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): + """Lists the customers that are billed to a billing account. The operation + is supported only for billing accounts with agreement type Microsoft + Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param filter: May be used to filter the list of customers. + :type filter: str + :param skiptoken: Skiptoken is only used if a previous operation + returned a partial result. If a previous response contains a nextLink + element, the value of the nextLink element will include a skiptoken + parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: 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: An iterator like instance of Customer + :rtype: + ~azure.mgmt.billing.models.CustomerPaged[~azure.mgmt.billing.models.Customer] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.CustomerPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers'} + + def get( + self, billing_account_name, customer_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets a customer by its ID. The operation is supported only for billing + accounts with agreement type Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: str + :param expand: May be used to expand enabledAzurePlans and resellers + :type expand: 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: Customer or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Customer or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('Customer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_departments_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_departments_operations.py new file mode 100644 index 000000000000..9c819ee4321d --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_departments_operations.py @@ -0,0 +1,181 @@ +# 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 .. import models + + +class DepartmentsOperations(object): + """DepartmentsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_billing_account_name( + self, billing_account_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the departments that a user has access to. The operation is + supported only for billing accounts with agreement type Enterprise + Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param expand: May be used to expand the enrollment accounts. + :type expand: str + :param filter: May be used to filter by department name. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: DepartmentListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.DepartmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('DepartmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments'} + + def get( + self, billing_account_name, department_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets a department by ID. The operation is supported only for billing + accounts with agreement type Enterprise Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param department_name: The ID that uniquely identifies a department. + :type department_name: str + :param expand: May be used to expand the enrollment accounts. + :type expand: str + :param filter: May be used to filter by department name. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: Department or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Department or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'departmentName': self._serialize.url("department_name", department_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('Department', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_enrollment_accounts_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_enrollment_accounts_operations.py new file mode 100644 index 000000000000..2045a6a0150d --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_enrollment_accounts_operations.py @@ -0,0 +1,182 @@ +# 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 .. import models + + +class EnrollmentAccountsOperations(object): + """EnrollmentAccountsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_billing_account_name( + self, billing_account_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the enrollment accounts for a billing account. The operation is + supported only for billing accounts with agreement type Enterprise + Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param expand: May be used to expand the department. + :type expand: str + :param filter: May be used to filter by account name. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: EnrollmentAccountListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.EnrollmentAccountListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('EnrollmentAccountListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts'} + + def get_by_enrollment_account_id( + self, billing_account_name, enrollment_account_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets an enrollment account by ID. The operation is supported only for + billing accounts with agreement type Enterprise Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param enrollment_account_name: The ID that uniquely identifies an + enrollment account. + :type enrollment_account_name: str + :param expand: May be used to expand the department. + :type expand: str + :param filter: May be used to filter by account name. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: EnrollmentAccount or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.EnrollmentAccount or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_enrollment_account_id.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'enrollmentAccountName': self._serialize.url("enrollment_account_name", enrollment_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('EnrollmentAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_enrollment_account_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_instructions_operations.py similarity index 51% rename from sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py rename to sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_instructions_operations.py index e56ced653ad8..33f06e88d405 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_instructions_operations.py @@ -15,14 +15,16 @@ from .. import models -class InvoicesOperations(object): - """InvoicesOperations operations. +class InstructionsOperations(object): + """InstructionsOperations 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: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". + :ivar api_version: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". """ models = models @@ -32,69 +34,44 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-03-01-preview" + self.api_version = "2019-10-01-preview" self.config = config - def list( - self, expand=None, filter=None, skiptoken=None, top=None, custom_headers=None, raw=False, **operation_config): - """Lists the available invoices for a subscription in reverse - chronological order beginning with the most recent invoice. In preview, - invoices are available via this API only for invoice periods which end - December 1, 2016 or later. This is only supported for Azure Web-Direct - subscriptions. Other subscription types which were not purchased - directly through the Azure web portal are not supported through this - preview API. - - :param expand: May be used to expand the downloadUrl property within a - list of invoices. This enables download links to be generated for - multiple invoices at once. By default, downloadURLs are not included - when listing invoices. - :type expand: str - :param filter: May be used to filter invoices by invoicePeriodEndDate. - The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does - not currently support 'ne', 'or', or 'not'. - :type filter: str - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N invoices. - :type top: int + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Lists the instructions by billing profile id. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: 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: An iterator like instance of Invoice + :return: An iterator like instance of Instruction :rtype: - ~azure.mgmt.billing.models.InvoicePaged[~azure.mgmt.billing.models.Invoice] + ~azure.mgmt.billing.models.InstructionPaged[~azure.mgmt.billing.models.Instruction] :raises: :class:`ErrorResponseException` """ - def internal_paging(next_link=None, raw=False): - + def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list_by_billing_profile.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) else: url = next_link @@ -102,7 +79,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -111,9 +88,13 @@ def internal_paging(next_link=None, raw=False): header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -121,33 +102,34 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.InvoicePaged(internal_paging, self._deserialize.dependencies) - + header_dict = None if raw: header_dict = {} - client_raw_response = models.InvoicePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + deserialized = models.InstructionPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices'} + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions'} def get( - self, invoice_name, custom_headers=None, raw=False, **operation_config): - """Gets a named invoice resource. When getting a single invoice, the - downloadUrl property is expanded automatically. This is only supported - for Azure Web-Direct subscriptions. Other subscription types which were - not purchased directly through the Azure web portal are not supported - through this preview API. - - :param invoice_name: The name of an invoice resource. - :type invoice_name: str + self, billing_account_name, billing_profile_name, instruction_name, custom_headers=None, raw=False, **operation_config): + """Get the instruction by name. These are custom billing instructions and + are only applicable for certain customers. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param instruction_name: Instruction Name. + :type instruction_name: 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: Invoice or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.Invoice or + :return: Instruction or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Instruction or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` @@ -155,8 +137,9 @@ def get( # Construct URL url = self.get.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'invoiceName': self._serialize.url("invoice_name", invoice_name, 'str') + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'instructionName': self._serialize.url("instruction_name", instruction_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +149,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -175,47 +158,55 @@ def get( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + 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('Invoice', response) + deserialized = self._deserialize('Instruction', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/{invoiceName}'} - - def get_latest( - self, custom_headers=None, raw=False, **operation_config): - """Gets the most recent invoice. When getting a single invoice, the - downloadUrl property is expanded automatically. This is only supported - for Azure Web-Direct subscriptions. Other subscription types which were - not purchased directly through the Azure web portal are not supported - through this preview API. - + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}'} + + def put( + self, billing_account_name, billing_profile_name, instruction_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an instruction. These are custom billing + instructions and are only applicable for certain customers. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param instruction_name: Instruction Name. + :type instruction_name: str + :param parameters: The new instruction. + :type parameters: ~azure.mgmt.billing.models.Instruction :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: Invoice or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.Invoice or + :return: Instruction or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Instruction or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.get_latest.metadata['url'] + url = self.put.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'instructionName': self._serialize.url("instruction_name", instruction_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -225,6 +216,7 @@ def get_latest( # 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()) @@ -233,21 +225,23 @@ def get_latest( 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, 'Instruction') + # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.put(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('Invoice', response) + deserialized = self._deserialize('Instruction', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_latest.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/latest'} + put.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoice_sections_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoice_sections_operations.py new file mode 100644 index 000000000000..33e5bf0593a3 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoice_sections_operations.py @@ -0,0 +1,467 @@ +# 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 InvoiceSectionsOperations(object): + """InvoiceSectionsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Lists the invoice sections that a user has access to. The operation is + supported only for billing accounts with agreement type Microsoft + Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: 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: InvoiceSectionListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.InvoiceSectionListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('InvoiceSectionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections'} + + def get( + self, billing_account_name, billing_profile_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Gets an invoice section by its ID. The operation is supported only for + billing accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: 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: InvoiceSection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.InvoiceSection or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('InvoiceSection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}'} + + + def _create_initial( + self, billing_account_name, billing_profile_name, invoice_section_name, display_name=None, custom_headers=None, raw=False, **operation_config): + parameters = models.InvoiceSectionCreationRequest(display_name=display_name) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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(parameters, 'InvoiceSectionCreationRequest') + + # Construct and send request + request = self._client.put(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.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('InvoiceSection', 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 create( + self, billing_account_name, billing_profile_name, invoice_section_name, display_name=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates an invoice section. The operation is supported only for billing + accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param display_name: The name of the invoice section. + :type display_name: 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 + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns InvoiceSection or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.InvoiceSection] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.InvoiceSection]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_initial( + billing_account_name=billing_account_name, + billing_profile_name=billing_profile_name, + invoice_section_name=invoice_section_name, + display_name=display_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + deserialized = self._deserialize('InvoiceSection', 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, **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) + create.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}'} + + + def _update_initial( + self, billing_account_name, billing_profile_name, invoice_section_name, display_name=None, custom_headers=None, raw=False, **operation_config): + parameters = models.InvoiceSection(display_name=display_name) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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(parameters, 'InvoiceSection') + + # Construct and send request + request = self._client.patch(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.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('InvoiceSection', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def update( + self, billing_account_name, billing_profile_name, invoice_section_name, display_name=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates an invoice section. Currently, only displayName can be updated. + The operation is supported only for billing accounts with agreement + type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param display_name: The name of the invoice section. + :type display_name: 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 + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns InvoiceSection or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.InvoiceSection] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.InvoiceSection]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._update_initial( + billing_account_name=billing_account_name, + billing_profile_name=billing_profile_name, + invoice_section_name=invoice_section_name, + display_name=display_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + deserialized = self._deserialize('InvoiceSection', 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, **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) + update.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}'} + + def elevate_to_billing_profile( + self, billing_account_name, billing_profile_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Gives the caller permissions on an invoice section based on their + billing profile access. The operation is supported only for billing + accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.elevate_to_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + 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 and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + elevate_to_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/elevate'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoices_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoices_operations.py new file mode 100644 index 000000000000..35831b7dc78e --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoices_operations.py @@ -0,0 +1,385 @@ +# 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 .. import models + + +class InvoicesOperations(object): + """InvoicesOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_billing_account( + self, billing_account_name, period_start_date, period_end_date, custom_headers=None, raw=False, **operation_config): + """Lists the invoices for a billing account for a given start date and end + date. The operation is supported for billing accounts with agreement + type Microsoft Partner Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param period_start_date: The start date to fetch the invoices. The + date should be specified in MM-DD-YYYY format. + :type period_start_date: str + :param period_end_date: The end date to fetch the invoices. The date + should be specified in MM-DD-YYYY format. + :type period_end_date: 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: InvoiceListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.InvoiceListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') + query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('InvoiceListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices'} + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, period_start_date, period_end_date, custom_headers=None, raw=False, **operation_config): + """Lists the invoices for a billing profile for a given start date and end + date. The operation is supported for billing accounts with agreement + type Microsoft Partner Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param period_start_date: The start date to fetch the invoices. The + date should be specified in MM-DD-YYYY format. + :type period_start_date: str + :param period_end_date: The end date to fetch the invoices. The date + should be specified in MM-DD-YYYY format. + :type period_end_date: 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: InvoiceListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.InvoiceListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') + query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('InvoiceListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices'} + + def get( + self, billing_account_name, billing_profile_name, invoice_name, custom_headers=None, raw=False, **operation_config): + """Gets an invoice by ID. The operation is supported for billing accounts + with agreement type Microsoft Partner Agreement or Microsoft Customer + Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_name: The ID that uniquely identifies an invoice. + :type invoice_name: 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: Invoice or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Invoice or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceName': self._serialize.url("invoice_name", invoice_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('Invoice', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}'} + + def list_by_billing_subscription( + self, billing_account_name, billing_subscription_name, period_start_date, period_end_date, custom_headers=None, raw=False, **operation_config): + """Lists the invoices for a subscription. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_subscription_name: The ID that uniquely identifies a + subscription. + :type billing_subscription_name: str + :param period_start_date: Invoice period start date. + :type period_start_date: str + :param period_end_date: Invoice period end date. + :type period_end_date: 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: An iterator like instance of Invoice + :rtype: + ~azure.mgmt.billing.models.InvoicePaged[~azure.mgmt.billing.models.Invoice] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_billing_subscription.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_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 = {} + query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') + query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.InvoicePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_billing_subscription.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/invoices'} + + def get_by_id( + self, billing_account_name, billing_subscription_name, invoice_name, custom_headers=None, raw=False, **operation_config): + """Gets an invoice by ID. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_subscription_name: The ID that uniquely identifies a + subscription. + :type billing_subscription_name: str + :param invoice_name: The ID that uniquely identifies an invoice. + :type invoice_name: 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: Invoice or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Invoice or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingSubscriptionName': self._serialize.url("billing_subscription_name", billing_subscription_name, 'str'), + 'invoiceName': self._serialize.url("invoice_name", invoice_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('Invoice', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/invoices/{invoiceName}'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_operations.py similarity index 77% rename from sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py rename to sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_operations.py index 5d38dd4b2ce2..5adb9426bc4b 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_operations.py @@ -18,11 +18,13 @@ class Operations(object): """Operations 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: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". + :ivar api_version: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". """ models = models @@ -32,13 +34,13 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-03-01-preview" + self.api_version = "2019-10-01-preview" self.config = config def list( self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available billing REST API operations. + """Lists the available billing REST API operations. :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -51,8 +53,7 @@ def list( :raises: :class:`ErrorResponseException` """ - def internal_paging(next_link=None, raw=False): - + def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list.metadata['url'] @@ -67,7 +68,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -76,9 +77,13 @@ def internal_paging(next_link=None, raw=False): header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -86,12 +91,10 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) - + header_dict = None if raw: header_dict = {} - client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized list.metadata = {'url': '/providers/Microsoft.Billing/operations'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_partner_transfers_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_partner_transfers_operations.py new file mode 100644 index 000000000000..d9e5404d2e21 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_partner_transfers_operations.py @@ -0,0 +1,328 @@ +# 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 .. import models + + +class PartnerTransfersOperations(object): + """PartnerTransfersOperations 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. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def initiate( + self, billing_account_name, billing_profile_name, customer_name, recipient_email_id=None, reseller_id=None, custom_headers=None, raw=False, **operation_config): + """Sends a request to a user in a customer's billing account to transfer + billing ownership of their subscriptions. The operation is supported + only for billing accounts with agreement type Microsoft Partner + Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: str + :param recipient_email_id: The email ID of the recipient to whom the + transfer request is sent. + :type recipient_email_id: str + :param reseller_id: Optional MPN ID of the reseller for transfer + requests that are sent from a Microsoft Partner Agreement billing + account. + :type reseller_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: TransferDetails or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.TransferDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.InitiateTransferRequest(recipient_email_id=recipient_email_id, reseller_id=reseller_id) + + # Construct URL + url = self.initiate.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_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, 'InitiateTransferRequest') + + # 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('TransferDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + initiate.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/initiateTransfer'} + + def get( + self, billing_account_name, billing_profile_name, customer_name, transfer_name, custom_headers=None, raw=False, **operation_config): + """Gets a transfer request by ID. The operation is supported only for + billing accounts with agreement type Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: str + :param transfer_name: The ID that uniquely identifies a transfer + request. + :type transfer_name: 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: TransferDetails or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.TransferDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str'), + 'transferName': self._serialize.url("transfer_name", transfer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('TransferDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}'} + + def cancel( + self, billing_account_name, billing_profile_name, customer_name, transfer_name, custom_headers=None, raw=False, **operation_config): + """Cancels a transfer request. The operation is supported only for billing + accounts with agreement type Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: str + :param transfer_name: The ID that uniquely identifies a transfer + request. + :type transfer_name: 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: TransferDetails or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.TransferDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.cancel.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str'), + 'transferName': self._serialize.url("transfer_name", transfer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.delete(url, query_parameters, header_parameters) + 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('TransferDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + cancel.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}'} + + def list( + self, billing_account_name, billing_profile_name, customer_name, custom_headers=None, raw=False, **operation_config): + """Lists the transfer requests sent to a customer. The operation is + supported only for billing accounts with agreement type Microsoft + Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: 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: An iterator like instance of TransferDetails + :rtype: + ~azure.mgmt.billing.models.TransferDetailsPaged[~azure.mgmt.billing.models.TransferDetails] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TransferDetailsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_payment_methods_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_payment_methods_operations.py new file mode 100644 index 000000000000..3b5d794acf25 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_payment_methods_operations.py @@ -0,0 +1,183 @@ +# 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 .. import models + + +class PaymentMethodsOperations(object): + """PaymentMethodsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_billing_account( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Lists the payment Methods for a billing account. The operation is + supported only for billing accounts with agreement type Microsoft + Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: 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: An iterator like instance of PaymentMethod + :rtype: + ~azure.mgmt.billing.models.PaymentMethodPaged[~azure.mgmt.billing.models.PaymentMethod] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PaymentMethodPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods'} + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Lists the payment Methods for a billing profile. The operation is + supported only for billing accounts with agreement type Microsoft + Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: 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: An iterator like instance of PaymentMethod + :rtype: + ~azure.mgmt.billing.models.PaymentMethodPaged[~azure.mgmt.billing.models.PaymentMethod] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PaymentMethodPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethods'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_policies_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_policies_operations.py new file mode 100644 index 000000000000..a8576fadfbf4 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_policies_operations.py @@ -0,0 +1,304 @@ +# 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 .. import models + + +class PoliciesOperations(object): + """PoliciesOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def get_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Lists the policies for a billing profile. This operation is supported + only for billing accounts with agreement type Microsoft Customer + Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: 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: Policy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Policy or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('Policy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default'} + + def update( + self, billing_account_name, billing_profile_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates the policies for a billing profile. This operation is supported + only for billing accounts with agreement type Microsoft Customer + Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param parameters: Request parameters that are provided to the update + policies operation. + :type parameters: ~azure.mgmt.billing.models.Policy + :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: Policy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Policy or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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(parameters, 'Policy') + + # Construct and send request + request = self._client.put(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('Policy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default'} + + def get_by_customer( + self, billing_account_name, customer_name, custom_headers=None, raw=False, **operation_config): + """Lists the policies for a customer. This operation is supported only for + billing accounts with agreement type Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: 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: CustomerPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.CustomerPolicy or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_customer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('CustomerPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_customer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default'} + + def update_customer( + self, billing_account_name, customer_name, view_charges=None, custom_headers=None, raw=False, **operation_config): + """Updates the policies for a customer. This operation is supported only + for billing accounts with agreement type Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: str + :param view_charges: The policy that controls whether the users in + customer's organization can view charges at pay-as-you-go prices. + Possible values include: 'Allowed', 'NotAllowed' + :type view_charges: str or ~azure.mgmt.billing.models.ViewCharges + :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: CustomerPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.CustomerPolicy or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.CustomerPolicy(view_charges=view_charges) + + # Construct URL + url = self.update_customer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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(parameters, 'CustomerPolicy') + + # Construct and send request + request = self._client.put(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('CustomerPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update_customer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_price_sheet_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_price_sheet_operations.py new file mode 100644 index 000000000000..2f2f90b9a138 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_price_sheet_operations.py @@ -0,0 +1,261 @@ +# 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 PriceSheetOperations(object): + """PriceSheetOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + + def _download_initial( + self, billing_account_name, billing_profile_name, invoice_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.download.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceName': self._serialize.url("invoice_name", invoice_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('DownloadUrl', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + 'OData-EntityId': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def download( + self, billing_account_name, billing_profile_name, invoice_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Gets a URL to download the pricesheet for an invoice. The operation is + supported for billing accounts with agreement type Microsoft Partner + Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_name: The ID that uniquely identifies an invoice. + :type invoice_name: 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 + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns DownloadUrl or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.DownloadUrl] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.DownloadUrl]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._download_initial( + billing_account_name=billing_account_name, + billing_profile_name=billing_profile_name, + invoice_name=invoice_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + 'OData-EntityId': 'str', + } + deserialized = self._deserialize('DownloadUrl', 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) + download.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/pricesheet/default/download'} + + + def _download_by_billing_profile_initial( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.download_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('DownloadUrl', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + 'OData-EntityId': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def download_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Gets a URL to download the current month's pricesheet for a billing + profile. The operation is supported for billing accounts with agreement + type Microsoft Partner Agreement or Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: 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 + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns DownloadUrl or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.DownloadUrl] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.DownloadUrl]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._download_by_billing_profile_initial( + billing_account_name=billing_account_name, + billing_profile_name=billing_profile_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + 'OData-EntityId': 'str', + } + deserialized = self._deserialize('DownloadUrl', 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) + download_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/pricesheet/default/download'} 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 new file mode 100644 index 000000000000..0bdb77f012cc --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_products_operations.py @@ -0,0 +1,644 @@ +# 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 .. import models + + +class ProductsOperations(object): + """ProductsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_customer( + self, billing_account_name, customer_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the products for a customer. These don't include products billed + based on usage.The operation is supported only for billing accounts + with agreement type Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: str + :param filter: May be used to filter by product type. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: ProductsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.ProductsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_customer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('ProductsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_customer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products'} + + def get_by_customer( + self, billing_account_name, customer_name, product_name, custom_headers=None, raw=False, **operation_config): + """Gets a product by ID. The operation is supported only for billing + accounts with agreement type Microsoft Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: str + :param product_name: The ID that uniquely identifies a product. + :type product_name: 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: Product or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Product or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_customer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str'), + 'productName': self._serialize.url("product_name", product_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('Product', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_customer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products/{productName}'} + + def list_by_billing_account( + self, billing_account_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the products for a billing account. These don't include products + billed based on usage. The operation is supported for billing accounts + with agreement type Microsoft Customer Agreement or Microsoft Partner + Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param filter: May be used to filter by product type. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: An iterator like instance of Product + :rtype: + ~azure.mgmt.billing.models.ProductPaged[~azure.mgmt.billing.models.Product] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ProductPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products'} + + def list_by_invoice_section( + self, billing_account_name, billing_profile_name, invoice_section_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the products for an invoice section. These don't include products + billed based on usage. The operation is supported only for billing + accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param filter: May be used to filter by product type. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: ProductsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.ProductsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_invoice_section.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('ProductsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products'} + + def get( + self, billing_account_name, billing_profile_name, invoice_section_name, product_name, custom_headers=None, raw=False, **operation_config): + """Gets a product by ID. The operation is supported only for billing + accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param product_name: The ID that uniquely identifies a product. + :type product_name: 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: Product or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Product or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('Product', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}'} + + def transfer( + self, billing_account_name, billing_profile_name, invoice_section_name, product_name, destination_invoice_section_id=None, destination_billing_profile_id=None, custom_headers=None, raw=False, **operation_config): + """Moves a product's charges to a new invoice section. The new invoice + section must belong to the same billing profile as the existing invoice + section. This operation is supported only for products that are + purchased with a recurring charge and for billing accounts with + agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param product_name: The ID that uniquely identifies a product. + :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: Product or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Product 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.transfer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_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 = {} + 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(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, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Product', 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 + transfer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/transfer'} + + def validate_transfer( + self, billing_account_name, billing_profile_name, invoice_section_name, product_name, destination_invoice_section_id=None, destination_billing_profile_id=None, custom_headers=None, raw=False, **operation_config): + """Validates if a product's charges can be moved to a new invoice section. + This operation is supported only for products that are purchased with a + recurring charge and for billing accounts with agreement type Microsoft + Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param product_name: The ID that uniquely identifies a product. + :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'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_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}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/validateTransferEligibility'} + + def update_auto_renew_by_invoice_section( + self, billing_account_name, billing_profile_name, invoice_section_name, product_name, auto_renew=None, custom_headers=None, raw=False, **operation_config): + """Cancel auto renew for product by product id and invoice section name. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param product_name: The ID that uniquely identifies a product. + :type product_name: str + :param auto_renew: The flag that determines the auto-renew settings + for a product. Possible values include: 'true', 'false' + :type auto_renew: str or ~azure.mgmt.billing.models.UpdateAutoRenew + :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: UpdateAutoRenewOperation or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.UpdateAutoRenewOperation or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + body = models.UpdateAutoRenewRequest(auto_renew=auto_renew) + + # Construct URL + url = self.update_auto_renew_by_invoice_section.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_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 = {} + 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, 'UpdateAutoRenewRequest') + + # 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('UpdateAutoRenewOperation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update_auto_renew_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_recipient_transfers_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_recipient_transfers_operations.py new file mode 100644 index 000000000000..8b6bed60a410 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_recipient_transfers_operations.py @@ -0,0 +1,340 @@ +# 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 .. import models + + +class RecipientTransfersOperations(object): + """RecipientTransfersOperations 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. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def accept( + self, transfer_name, product_details=None, custom_headers=None, raw=False, **operation_config): + """Accepts a transfer request. + + :param transfer_name: The ID that uniquely identifies a transfer + request. + :type transfer_name: str + :param product_details: Request parameters to accept transfer. + :type product_details: list[~azure.mgmt.billing.models.ProductDetails] + :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: RecipientTransferDetails or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.RecipientTransferDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.AcceptTransferRequest(product_details=product_details) + + # Construct URL + url = self.accept.metadata['url'] + path_format_arguments = { + 'transferName': self._serialize.url("transfer_name", transfer_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, 'AcceptTransferRequest') + + # 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('RecipientTransferDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + accept.metadata = {'url': '/providers/Microsoft.Billing/transfers/{transferName}/acceptTransfer'} + + def validate( + self, transfer_name, product_details=None, custom_headers=None, raw=False, **operation_config): + """Validates if a subscription or a reservation can be transferred. Use + this operation to validate your subscriptions or reservation before + using the accept transfer operation. + + :param transfer_name: The ID that uniquely identifies a transfer + request. + :type transfer_name: str + :param product_details: Request parameters to accept transfer. + :type product_details: list[~azure.mgmt.billing.models.ProductDetails] + :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: ValidateTransferListResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.ValidateTransferListResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.AcceptTransferRequest(product_details=product_details) + + # Construct URL + url = self.validate.metadata['url'] + path_format_arguments = { + 'transferName': self._serialize.url("transfer_name", transfer_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, 'AcceptTransferRequest') + + # 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('ValidateTransferListResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + validate.metadata = {'url': '/providers/Microsoft.Billing/transfers/{transferName}/validateTransfer'} + + def decline( + self, transfer_name, custom_headers=None, raw=False, **operation_config): + """Declines a transfer request. + + :param transfer_name: The ID that uniquely identifies a transfer + request. + :type transfer_name: 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: RecipientTransferDetails or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.RecipientTransferDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.decline.metadata['url'] + path_format_arguments = { + 'transferName': self._serialize.url("transfer_name", transfer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.post(url, query_parameters, header_parameters) + 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('RecipientTransferDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + decline.metadata = {'url': '/providers/Microsoft.Billing/transfers/{transferName}/declineTransfer'} + + def get( + self, transfer_name, custom_headers=None, raw=False, **operation_config): + """Gets a transfer request by ID. The caller must be the recipient of the + transfer request. + + :param transfer_name: The ID that uniquely identifies a transfer + request. + :type transfer_name: 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: RecipientTransferDetails or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.RecipientTransferDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'transferName': self._serialize.url("transfer_name", transfer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('RecipientTransferDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/transfers/{transferName}'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists the transfer requests received by the caller. + + :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: An iterator like instance of RecipientTransferDetails + :rtype: + ~azure.mgmt.billing.models.RecipientTransferDetailsPaged[~azure.mgmt.billing.models.RecipientTransferDetails] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.RecipientTransferDetailsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Billing/transfers'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transactions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transactions_operations.py new file mode 100644 index 000000000000..6561c7b8cff2 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transactions_operations.py @@ -0,0 +1,531 @@ +# 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 .. import models + + +class TransactionsOperations(object): + """TransactionsOperations 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: The version of the API to be used with the client request. The current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-10-01-preview" + + self.config = config + + def list_by_customer( + self, billing_account_name, customer_name, period_start_date, period_end_date, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the billed and unbilled transactions by customer id for given + start date and end date. Transactions include purchases, refunds and + Azure usage charges. Unbilled transactions are listed under pending + invoice Id and do not include tax. Tax is added to the amount once an + invoice is generated. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param customer_name: The ID that uniquely identifies a customer. + :type customer_name: str + :param period_start_date: The start date to fetch the transactions. + The date should be specified in MM-DD-YYYY format. + :type period_start_date: str + :param period_end_date: The end date to fetch the transactions. The + date should be specified in MM-DD-YYYY format. + :type period_end_date: str + :param filter: May be used to filter by transaction type. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: An iterator like instance of Transaction + :rtype: + ~azure.mgmt.billing.models.TransactionPaged[~azure.mgmt.billing.models.Transaction] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_customer.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'customerName': self._serialize.url("customer_name", customer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') + query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TransactionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_customer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/transactions'} + + def list_by_billing_account( + self, billing_account_name, period_start_date, period_end_date, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the billed and unbilled transactions by billing account name for + given start and end date. Transactions include purchases, refunds and + Azure usage charges. Unbilled transactions are listed under pending + invoice ID and do not include tax. Tax is added to the amount once an + invoice is generated. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param period_start_date: The start date to fetch the transactions. + The date should be specified in MM-DD-YYYY format. + :type period_start_date: str + :param period_end_date: The end date to fetch the transactions. The + date should be specified in MM-DD-YYYY format. + :type period_end_date: str + :param filter: May be used to filter by transaction type. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: An iterator like instance of Transaction + :rtype: + ~azure.mgmt.billing.models.TransactionPaged[~azure.mgmt.billing.models.Transaction] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_billing_account.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') + query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TransactionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/transactions'} + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, period_start_date, period_end_date, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the billed and unbilled transactions by billing profile name for + given start date and end date. Transactions include purchases, refunds + and Azure usage charges. Unbilled transactions are listed under pending + invoice Id and do not include tax. Tax is added to the amount once an + invoice is generated. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param period_start_date: The start date to fetch the transactions. + The date should be specified in MM-DD-YYYY format. + :type period_start_date: str + :param period_end_date: The end date to fetch the transactions. The + date should be specified in MM-DD-YYYY format. + :type period_end_date: str + :param filter: May be used to filter by transaction type. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: TransactionListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.TransactionListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') + query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('TransactionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions'} + + def list_by_invoice_section( + self, billing_account_name, billing_profile_name, invoice_section_name, period_start_date, period_end_date, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the billed and unbilled transactions by invoice section name for + given start date and end date. Transactions include purchases, refunds + and Azure usage charges. Unbilled transactions are listed under pending + invoice Id and do not include tax. Tax is added to the amount once an + invoice is generated. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param period_start_date: The start date to fetch the transactions. + The date should be specified in MM-DD-YYYY format. + :type period_start_date: str + :param period_end_date: The end date to fetch the transactions. The + date should be specified in MM-DD-YYYY format. + :type period_end_date: str + :param filter: May be used to filter by transaction type. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + string where key and value are separated by a colon (:). + :type filter: 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: TransactionListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.TransactionListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_invoice_section.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') + query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('TransactionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transactions'} + + def list_by_invoice( + self, billing_account_name, billing_profile_name, invoice_name, custom_headers=None, raw=False, **operation_config): + """Lists the transactions for an invoice. Transactions include purchases, + refunds and Azure usage charges. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_name: The ID that uniquely identifies an invoice. + :type invoice_name: 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: An iterator like instance of Transaction + :rtype: + ~azure.mgmt.billing.models.TransactionPaged[~azure.mgmt.billing.models.Transaction] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_invoice.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceName': self._serialize.url("invoice_name", invoice_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TransactionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_invoice.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/transactions'} + + def get( + self, billing_account_name, billing_profile_name, transaction_name, period_start_date, period_end_date, custom_headers=None, raw=False, **operation_config): + """Gets a transaction by ID. The operation is supported for billing + accounts with agreement type Microsoft Customer Agreement or Microsoft + Partner Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param transaction_name: The ID that uniquely identifies a + transaction. + :type transaction_name: str + :param period_start_date: The start date to fetch the transactions. + The date should be specified in MM-DD-YYYY format. + :type period_start_date: str + :param period_end_date: The end date to fetch the transactions. The + date should be specified in MM-DD-YYYY format. + :type period_end_date: 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: Transaction or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Transaction or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'transactionName': self._serialize.url("transaction_name", transaction_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') + query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('Transaction', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions/{transactionName}'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transfers_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transfers_operations.py new file mode 100644 index 000000000000..0c2e719628c9 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transfers_operations.py @@ -0,0 +1,332 @@ +# 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 .. import models + + +class TransfersOperations(object): + """TransfersOperations 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. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def initiate( + self, billing_account_name, billing_profile_name, invoice_section_name, recipient_email_id=None, reseller_id=None, custom_headers=None, raw=False, **operation_config): + """Sends a request to a user in another billing account to transfer + billing ownership of their subscriptions. The operation is supported + only for billing accounts with agreement type Microsoft Customer + Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param recipient_email_id: The email ID of the recipient to whom the + transfer request is sent. + :type recipient_email_id: str + :param reseller_id: Optional MPN ID of the reseller for transfer + requests that are sent from a Microsoft Partner Agreement billing + account. + :type reseller_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: TransferDetails or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.TransferDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.InitiateTransferRequest(recipient_email_id=recipient_email_id, reseller_id=reseller_id) + + # Construct URL + url = self.initiate.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_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, 'InitiateTransferRequest') + + # 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('TransferDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + initiate.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/initiateTransfer'} + + def get( + self, billing_account_name, billing_profile_name, invoice_section_name, transfer_name, custom_headers=None, raw=False, **operation_config): + """Gets a transfer request by ID. The operation is supported only for + billing accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param transfer_name: The ID that uniquely identifies a transfer + request. + :type transfer_name: 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: TransferDetails or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.TransferDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'transferName': self._serialize.url("transfer_name", transfer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + 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('TransferDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}'} + + def cancel( + self, billing_account_name, billing_profile_name, invoice_section_name, transfer_name, custom_headers=None, raw=False, **operation_config): + """Cancels a transfer request. The operation is supported only for billing + accounts with agreement type Microsoft Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: str + :param transfer_name: The ID that uniquely identifies a transfer + request. + :type transfer_name: 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: TransferDetails or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.TransferDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.cancel.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'transferName': self._serialize.url("transfer_name", transfer_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.delete(url, query_parameters, header_parameters) + 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('TransferDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + cancel.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}'} + + def list( + self, billing_account_name, billing_profile_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Lists the transfer requests for an invoice section. The operation is + supported only for billing accounts with agreement type Microsoft + Customer Agreement. + + :param billing_account_name: The ID that uniquely identifies a billing + account. + :type billing_account_name: str + :param billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_name: str + :param invoice_section_name: The ID that uniquely identifies an + invoice section. + :type invoice_section_name: 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: An iterator like instance of TransferDetails + :rtype: + ~azure.mgmt.billing.models.TransferDetailsPaged[~azure.mgmt.billing.models.TransferDetails] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TransferDetailsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py deleted file mode 100644 index 7f382587610d..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py +++ /dev/null @@ -1,184 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class BillingPeriodsOperations(object): - """BillingPeriodsOperations operations. - - :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: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-03-01-preview" - - self.config = config - - def list( - self, filter=None, skiptoken=None, top=None, custom_headers=None, raw=False, **operation_config): - """Lists the available billing periods for a subscription in reverse - chronological order. This is only supported for Azure Web-Direct - subscriptions. Other subscription types which were not purchased - directly through the Azure web portal are not supported through this - preview API. - - :param filter: May be used to filter billing periods by - billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', - 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - :type filter: str - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N billing periods. - :type top: int - :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: An iterator like instance of BillingPeriod - :rtype: - ~azure.mgmt.billing.models.BillingPeriodPaged[~azure.mgmt.billing.models.BillingPeriod] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.BillingPeriodPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.BillingPeriodPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods'} - - def get( - self, billing_period_name, custom_headers=None, raw=False, **operation_config): - """Gets a named billing period. This is only supported for Azure - Web-Direct subscriptions. Other subscription types which were not - purchased directly through the Azure web portal are not supported - through this preview API. - - :param billing_period_name: The name of a BillingPeriod resource. - :type billing_period_name: 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: BillingPeriod or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingPeriod or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, 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('BillingPeriod', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_operations.py deleted file mode 100644 index 071d1ce3c75c..000000000000 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_operations.py +++ /dev/null @@ -1,154 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class EnrollmentAccountsOperations(object): - """EnrollmentAccountsOperations operations. - - :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: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-03-01-preview" - - self.config = config - - def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists the enrollment accounts the caller has access to. - - :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: An iterator like instance of EnrollmentAccount - :rtype: - ~azure.mgmt.billing.models.EnrollmentAccountPaged[~azure.mgmt.billing.models.EnrollmentAccount] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.EnrollmentAccountPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.EnrollmentAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/enrollmentAccounts'} - - def get( - self, name, custom_headers=None, raw=False, **operation_config): - """Gets a enrollment account by name. - - :param name: Enrollment Account name. - :type name: 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: EnrollmentAccount or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.EnrollmentAccount or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, 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('EnrollmentAccount', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/providers/Microsoft.Billing/enrollmentAccounts/{name}'}