diff --git a/sdk/billing/azure-mgmt-billing/README.md b/sdk/billing/azure-mgmt-billing/README.md index 082fa425381e..003ceb18894d 100644 --- a/sdk/billing/azure-mgmt-billing/README.md +++ b/sdk/billing/azure-mgmt-billing/README.md @@ -1,29 +1,21 @@ -## Microsoft Azure SDK for Python +# Microsoft Azure SDK for Python This is the Microsoft Azure Billing Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). -Azure Resource Manager (ARM) is the next generation of management APIs -that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. +# Usage -For the older Azure Service Management (ASM) libraries, see -[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy) -library. - -For a more complete set of Azure libraries, see the -[azure sdk python release](https://aka.ms/azsdk/python/all). - -## Usage - -For code examples, see -[Billing](https://docs.microsoft.com/python/api/overview/azure/billing) +For code examples, see [Billing](https://docs.microsoft.com/python/api/overview/azure/billing) on docs.microsoft.com. -## Provide Feedback -If you encounter any bugs or have suggestions, please file an issue in -the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. -![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-billing%2FREADME.png) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-billing%2FREADME.png) 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..6498b84ca446 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_billing_management_client.py @@ -0,0 +1,144 @@ +# 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 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 InvoicesOperations +from .operations import TransactionsOperations +from .operations import PoliciesOperations +from .operations import BillingPropertyOperations +from .operations import Operations +from .operations import BillingRoleDefinitionsOperations +from .operations import BillingRoleAssignmentsOperations +from .operations import AgreementsOperations +from .operations import EnrollmentAccountsOperations +from .operations import BillingPeriodsOperations +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 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 invoices: Invoices operations + :vartype invoices: azure.mgmt.billing.operations.InvoicesOperations + :ivar transactions: Transactions operations + :vartype transactions: azure.mgmt.billing.operations.TransactionsOperations + :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 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 + :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 + + :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._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.billing_accounts = BillingAccountsOperations( + 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.invoices = InvoicesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.transactions = TransactionsOperations( + 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.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) + self.enrollment_accounts = EnrollmentAccountsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.billing_periods = BillingPeriodsOperations( + 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..7fa074153a50 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,268 @@ # 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 AddressDetails + from ._models_py3 import Agreement + from ._models_py3 import Amount + from ._models_py3 import AvailableBalance + from ._models_py3 import AzurePlan + from ._models_py3 import BillingAccount + from ._models_py3 import BillingAccountUpdateRequest + from ._models_py3 import BillingPeriod + from ._models_py3 import BillingPermissionsProperties + from ._models_py3 import BillingProfile + from ._models_py3 import BillingProfileCreationRequest + from ._models_py3 import BillingProfilesOnExpand + from ._models_py3 import BillingProperty + from ._models_py3 import BillingRoleAssignment + from ._models_py3 import BillingRoleDefinition + from ._models_py3 import BillingSubscription + from ._models_py3 import Customer + from ._models_py3 import CustomerPolicy + from ._models_py3 import Department + 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 EnrollmentAccountSummary + from ._models_py3 import EnrollmentPolicies + from ._models_py3 import ErrorDetails + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import IndirectRelationshipInfo + from ._models_py3 import Instruction + from ._models_py3 import Invoice + from ._models_py3 import InvoiceSection + from ._models_py3 import InvoiceSectionCreationRequest + from ._models_py3 import InvoiceSectionsOnExpand + from ._models_py3 import InvoiceSectionWithCreateSubPermission + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import Participants + from ._models_py3 import PaymentProperties + from ._models_py3 import Policy + from ._models_py3 import Product + from ._models_py3 import RebillDetails + from ._models_py3 import Reseller + from ._models_py3 import Resource + from ._models_py3 import Transaction + from ._models_py3 import TransferBillingSubscriptionRequestProperties + from ._models_py3 import TransferProductRequestProperties + 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 +except (SyntaxError, ImportError): + from ._models import AddressDetails + from ._models import Agreement + from ._models import Amount + from ._models import AvailableBalance + from ._models import AzurePlan + from ._models import BillingAccount + from ._models import BillingAccountUpdateRequest + from ._models import BillingPeriod + from ._models import BillingPermissionsProperties + from ._models import BillingProfile + from ._models import BillingProfileCreationRequest + from ._models import BillingProfilesOnExpand + from ._models import BillingProperty + from ._models import BillingRoleAssignment + from ._models import BillingRoleDefinition + from ._models import BillingSubscription + from ._models import Customer + from ._models import CustomerPolicy + from ._models import Department + from ._models import Document + from ._models import DownloadUrl + from ._models import Enrollment + from ._models import EnrollmentAccount + from ._models import EnrollmentAccountContext + from ._models import EnrollmentAccountSummary + from ._models import EnrollmentPolicies + from ._models import ErrorDetails + from ._models import ErrorResponse, ErrorResponseException + from ._models import IndirectRelationshipInfo + from ._models import Instruction + from ._models import Invoice + from ._models import InvoiceSection + from ._models import InvoiceSectionCreationRequest + from ._models import InvoiceSectionsOnExpand + from ._models import InvoiceSectionWithCreateSubPermission + from ._models import Operation + from ._models import OperationDisplay + from ._models import Participants + from ._models import PaymentProperties + from ._models import Policy + from ._models import Product + from ._models import RebillDetails + from ._models import Reseller + from ._models import Resource + from ._models import Transaction + from ._models import TransferBillingSubscriptionRequestProperties + from ._models import TransferProductRequestProperties + from ._models import ValidateAddressResponse + from ._models import ValidateProductTransferEligibilityError + from ._models import ValidateProductTransferEligibilityResult + from ._models import ValidateSubscriptionTransferEligibilityError + from ._models import ValidateSubscriptionTransferEligibilityResult +from ._paged_models import AgreementPaged +from ._paged_models import BillingAccountPaged +from ._paged_models import BillingPeriodPaged +from ._paged_models import BillingPermissionsPropertiesPaged +from ._paged_models import BillingProfilePaged +from ._paged_models import BillingRoleAssignmentPaged +from ._paged_models import BillingRoleDefinitionPaged +from ._paged_models import BillingSubscriptionPaged +from ._paged_models import CustomerPaged +from ._paged_models import EnrollmentAccountSummaryPaged +from ._paged_models import InstructionPaged +from ._paged_models import InvoicePaged +from ._paged_models import InvoiceSectionPaged +from ._paged_models import InvoiceSectionWithCreateSubPermissionPaged +from ._paged_models import OperationPaged +from ._paged_models import ProductPaged +from ._paged_models import TransactionPaged +from ._billing_management_client_enums import ( + AddressValidationStatus, + SubscriptionTransferValidationErrorCode, + AgreementType, + AccountType, + AccountStatus, + BillingRelationshipType, + InvoiceSectionState, + TargetCloud, + BillingProfileStatus, + StatusReasonCode, + SpendingLimit, + BillingProfileStatusReasonCode, + BillingProfileSpendingLimit, + StatusReasonCodeForBillingProfile, + SpendingLimitForBillingProfile, + InvoiceStatus, + InvoiceType, + DocumentType, + DocumentSource, + PaymentMethodFamily, + InvoiceDocumentType, + AutoRenew, + ProductStatusType, + BillingFrequency, + ProductTransferValidationErrorCode, + BillingSubscriptionStatusType, + TransactionTypeKind, + ReservationType, + MarketplacePurchasesPolicy, + ReservationPurchasesPolicy, + ViewChargesPolicy, + ViewCharges, + Category, + AcceptanceMode, +) __all__ = [ - 'EnrollmentAccount', + 'AddressDetails', + 'Agreement', + 'Amount', + 'AvailableBalance', + 'AzurePlan', + 'BillingAccount', + 'BillingAccountUpdateRequest', 'BillingPeriod', + 'BillingPermissionsProperties', + 'BillingProfile', + 'BillingProfileCreationRequest', + 'BillingProfilesOnExpand', + 'BillingProperty', + 'BillingRoleAssignment', + 'BillingRoleDefinition', + 'BillingSubscription', + 'Customer', + 'CustomerPolicy', + 'Department', + 'Document', 'DownloadUrl', + 'Enrollment', + 'EnrollmentAccount', + 'EnrollmentAccountContext', + 'EnrollmentAccountSummary', + 'EnrollmentPolicies', 'ErrorDetails', 'ErrorResponse', 'ErrorResponseException', + 'IndirectRelationshipInfo', + 'Instruction', 'Invoice', - 'OperationDisplay', + 'InvoiceSection', + 'InvoiceSectionCreationRequest', + 'InvoiceSectionsOnExpand', + 'InvoiceSectionWithCreateSubPermission', 'Operation', + 'OperationDisplay', + 'Participants', + 'PaymentProperties', + 'Policy', + 'Product', + 'RebillDetails', + 'Reseller', 'Resource', - 'EnrollmentAccountPaged', - 'BillingPeriodPaged', + 'Transaction', + 'TransferBillingSubscriptionRequestProperties', + 'TransferProductRequestProperties', + 'ValidateAddressResponse', + 'ValidateProductTransferEligibilityError', + 'ValidateProductTransferEligibilityResult', + 'ValidateSubscriptionTransferEligibilityError', + 'ValidateSubscriptionTransferEligibilityResult', + 'BillingAccountPaged', + 'InvoiceSectionWithCreateSubPermissionPaged', + 'InstructionPaged', + 'BillingProfilePaged', + 'CustomerPaged', + 'InvoiceSectionPaged', + 'BillingPermissionsPropertiesPaged', + 'BillingSubscriptionPaged', + 'ProductPaged', 'InvoicePaged', + 'TransactionPaged', 'OperationPaged', + 'BillingRoleDefinitionPaged', + 'BillingRoleAssignmentPaged', + 'AgreementPaged', + 'EnrollmentAccountSummaryPaged', + 'BillingPeriodPaged', + 'AddressValidationStatus', + 'SubscriptionTransferValidationErrorCode', + 'AgreementType', + 'AccountType', + 'AccountStatus', + 'BillingRelationshipType', + 'InvoiceSectionState', + 'TargetCloud', + 'BillingProfileStatus', + 'StatusReasonCode', + 'SpendingLimit', + 'BillingProfileStatusReasonCode', + 'BillingProfileSpendingLimit', + 'StatusReasonCodeForBillingProfile', + 'SpendingLimitForBillingProfile', + 'InvoiceStatus', + 'InvoiceType', + 'DocumentType', + 'DocumentSource', + 'PaymentMethodFamily', + 'InvoiceDocumentType', + 'AutoRenew', + 'ProductStatusType', + 'BillingFrequency', + 'ProductTransferValidationErrorCode', + 'BillingSubscriptionStatusType', + 'TransactionTypeKind', + 'ReservationType', + 'MarketplacePurchasesPolicy', + 'ReservationPurchasesPolicy', + 'ViewChargesPolicy', + 'ViewCharges', + '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..52b9d53545ed --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_billing_management_client_enums.py @@ -0,0 +1,264 @@ +# 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 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 AccountType(str, Enum): + + enterprise = "Enterprise" + individual = "Individual" + partner = "Partner" + + +class AccountStatus(str, Enum): + + active = "Active" + deleted = "Deleted" + disabled = "Disabled" + expired = "Expired" + transferred = "Transferred" + extended = "Extended" + terminated = "Terminated" + + +class BillingRelationshipType(str, Enum): + + direct = "Direct" + indirect_customer = "IndirectCustomer" + indirect_partner = "IndirectPartner" + csp_partner = "CSPPartner" + + +class InvoiceSectionState(str, Enum): + + active = "Active" + restricted = "Restricted" + + +class TargetCloud(str, Enum): + + us_gov = "USGov" + us_nat = "USNat" + us_sec = "USSec" + + +class BillingProfileStatus(str, Enum): + + active = "Active" + disabled = "Disabled" + warned = "Warned" + + +class StatusReasonCode(str, Enum): + + past_due = "PastDue" + spending_limit_reached = "SpendingLimitReached" + spending_limit_expired = "SpendingLimitExpired" + + +class SpendingLimit(str, Enum): + + off = "Off" + on = "On" + + +class BillingProfileStatusReasonCode(str, Enum): + + past_due = "PastDue" + spending_limit_reached = "SpendingLimitReached" + spending_limit_expired = "SpendingLimitExpired" + + +class BillingProfileSpendingLimit(str, Enum): + + off = "Off" + on = "On" + + +class StatusReasonCodeForBillingProfile(str, Enum): + + past_due = "PastDue" + spending_limit_reached = "SpendingLimitReached" + spending_limit_expired = "SpendingLimitExpired" + + +class SpendingLimitForBillingProfile(str, Enum): + + off = "Off" + on = "On" + + +class InvoiceStatus(str, Enum): + + due = "Due" + over_due = "OverDue" + paid = "Paid" + void = "Void" + + +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 DocumentSource(str, Enum): + + drs = "DRS" + enf = "ENF" + + +class PaymentMethodFamily(str, Enum): + + credits = "Credits" + check_wire = "CheckWire" + credit_card = "CreditCard" + none = "None" + + +class InvoiceDocumentType(str, Enum): + + invoice = "Invoice" + credit_note = "CreditNote" + + +class AutoRenew(str, Enum): + + off = "Off" + on = "On" + + +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 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..7a28f01fde57 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models.py @@ -0,0 +1,2844 @@ +# 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 AddressDetails(Model): + """Address details. + + All required parameters must be populated in order to send to Azure. + + :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: Required. 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 district: Address district. + :type district: str + :param region: Address region. + :type region: str + :param country: Required. Country code uses ISO2, 2-digit format. + :type country: str + :param postal_code: Postal code. + :type postal_code: str + :param email: Email address. + :type email: str + :param phone_number: Phone number. + :type phone_number: str + """ + + _validation = { + 'address_line1': {'required': True}, + 'country': {'required': True}, + } + + _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'}, + 'district': {'key': 'district', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + 'country': {'key': 'country', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', '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.district = kwargs.get('district', None) + self.region = kwargs.get('region', None) + self.country = kwargs.get('country', None) + self.postal_code = kwargs.get('postal_code', None) + self.email = kwargs.get('email', None) + self.phone_number = kwargs.get('phone_number', 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 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 + :param display_name: The billing account name. + :type display_name: str + :param sold_to: The address of the individual or organization that is + responsible for the billing account. + :type sold_to: ~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 account_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype account_type: str or ~azure.mgmt.billing.models.AccountType + :ivar account_status: The current status of the billing account. Possible + values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', + 'Extended', 'Terminated' + :vartype account_status: str or ~azure.mgmt.billing.models.AccountStatus + :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: ~azure.mgmt.billing.models.BillingProfilesOnExpand + :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 has_read_access: Indicates whether user has read access to the + billing account. + :vartype has_read_access: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'agreement_type': {'readonly': True}, + 'account_type': {'readonly': True}, + 'account_status': {'readonly': True}, + 'enrollment_details': {'readonly': True}, + 'has_read_access': {'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'}, + 'sold_to': {'key': 'properties.soldTo', 'type': 'AddressDetails'}, + 'agreement_type': {'key': 'properties.agreementType', 'type': 'str'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'account_status': {'key': 'properties.accountStatus', 'type': 'str'}, + 'billing_profiles': {'key': 'properties.billingProfiles', 'type': 'BillingProfilesOnExpand'}, + 'enrollment_details': {'key': 'properties.enrollmentDetails', 'type': 'Enrollment'}, + 'departments': {'key': 'properties.departments', 'type': '[Department]'}, + 'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'}, + 'has_read_access': {'key': 'properties.hasReadAccess', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(BillingAccount, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.sold_to = kwargs.get('sold_to', None) + self.agreement_type = None + self.account_type = None + self.account_status = 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.has_read_access = 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. + + :param display_name: The billing account name. + :type display_name: str + :param sold_to: The address of the individual or organization that is + responsible for the billing account. + :type sold_to: ~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 account_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype account_type: str or ~azure.mgmt.billing.models.AccountType + :ivar account_status: The current status of the billing account. Possible + values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', + 'Extended', 'Terminated' + :vartype account_status: str or ~azure.mgmt.billing.models.AccountStatus + :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: ~azure.mgmt.billing.models.BillingProfilesOnExpand + :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 has_read_access: Indicates whether user has read access to the + billing account. + :vartype has_read_access: bool + """ + + _validation = { + 'agreement_type': {'readonly': True}, + 'account_type': {'readonly': True}, + 'account_status': {'readonly': True}, + 'enrollment_details': {'readonly': True}, + 'has_read_access': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'sold_to': {'key': 'properties.soldTo', 'type': 'AddressDetails'}, + 'agreement_type': {'key': 'properties.agreementType', 'type': 'str'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'account_status': {'key': 'properties.accountStatus', 'type': 'str'}, + 'billing_profiles': {'key': 'properties.billingProfiles', 'type': 'BillingProfilesOnExpand'}, + 'enrollment_details': {'key': 'properties.enrollmentDetails', 'type': 'Enrollment'}, + 'departments': {'key': 'properties.departments', 'type': '[Department]'}, + 'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'}, + 'has_read_access': {'key': 'properties.hasReadAccess', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(BillingAccountUpdateRequest, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.sold_to = kwargs.get('sold_to', None) + self.agreement_type = None + self.account_type = None + self.account_status = 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.has_read_access = None + + +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, **kwargs): + super(BillingPeriod, self).__init__(**kwargs) + self.billing_period_start_date = None + self.billing_period_end_date = None + self.invoice_ids = 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 + :ivar billing_relationship_type: Identifies which services and purchases + are paid by a billing profile. Possible values include: 'Direct', + 'IndirectCustomer', 'IndirectPartner', 'CSPPartner' + :vartype billing_relationship_type: str or + ~azure.mgmt.billing.models.BillingRelationshipType + :param bill_to: Billing address. + :type bill_to: ~azure.mgmt.billing.models.AddressDetails + :ivar indirect_relationship_info: Identifies the billing profile that is + linked to another billing profile in indirect purchase motion. + :vartype indirect_relationship_info: + ~azure.mgmt.billing.models.IndirectRelationshipInfo + :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. By default this is not populated, unless it's specified in + $expand. + :type invoice_sections: ~azure.mgmt.billing.models.InvoiceSectionsOnExpand + :ivar has_read_access: Indicates whether user has read access to the + billing profile. + :vartype has_read_access: bool + :ivar system_id: The system generated unique identifier for a billing + profile. + :vartype system_id: str + :ivar status: The status of the billing profile. Possible values include: + 'Active', 'Disabled', 'Warned' + :vartype status: str or ~azure.mgmt.billing.models.BillingProfileStatus + :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 + :ivar target_clouds: Identifies the cloud environments that are associated + with a billing profile. This is a system managed optional field and gets + updated as the billing profile gets associated with accounts in various + clouds. + :vartype target_clouds: list[str or + ~azure.mgmt.billing.models.TargetCloud] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'billing_relationship_type': {'readonly': True}, + 'indirect_relationship_info': {'readonly': True}, + 'invoice_day': {'readonly': True}, + 'currency': {'readonly': True}, + 'has_read_access': {'readonly': True}, + 'system_id': {'readonly': True}, + 'status': {'readonly': True}, + 'status_reason_code': {'readonly': True}, + 'spending_limit': {'readonly': True}, + 'target_clouds': {'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'}, + 'billing_relationship_type': {'key': 'properties.billingRelationshipType', 'type': 'str'}, + 'bill_to': {'key': 'properties.billTo', 'type': 'AddressDetails'}, + 'indirect_relationship_info': {'key': 'properties.indirectRelationshipInfo', 'type': 'IndirectRelationshipInfo'}, + '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': 'InvoiceSectionsOnExpand'}, + 'has_read_access': {'key': 'properties.hasReadAccess', 'type': 'bool'}, + 'system_id': {'key': 'properties.systemId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'status_reason_code': {'key': 'properties.statusReasonCode', 'type': 'str'}, + 'spending_limit': {'key': 'properties.spendingLimit', 'type': 'str'}, + 'target_clouds': {'key': 'properties.targetClouds', '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.billing_relationship_type = None + self.bill_to = kwargs.get('bill_to', None) + self.indirect_relationship_info = 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.has_read_access = None + self.system_id = None + self.status = None + self.status_reason_code = None + self.spending_limit = None + self.target_clouds = 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 bill_to: The address of the individual or organization that is + responsible for the billing profile. + :type bill_to: ~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'}, + 'bill_to': {'key': 'billTo', '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.bill_to = kwargs.get('bill_to', None) + self.invoice_email_opt_in = kwargs.get('invoice_email_opt_in', None) + self.enabled_azure_plans = kwargs.get('enabled_azure_plans', None) + + +class BillingProfilesOnExpand(Model): + """The billing profiles associated with the billing account. By default this + is not populated, unless it's specified in $expand. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar has_more_results: Indicates whether there are more billing profiles + than the ones listed in this collection. The collection lists a maximum of + 50 billing profiles. To get all billing profiles, use the list billing + profiles API. + :vartype has_more_results: bool + :param value: The billing profiles associated with the billing account. + :type value: list[~azure.mgmt.billing.models.BillingProfile] + """ + + _validation = { + 'has_more_results': {'readonly': True}, + } + + _attribute_map = { + 'has_more_results': {'key': 'hasMoreResults', 'type': 'bool'}, + 'value': {'key': 'value', 'type': '[BillingProfile]'}, + } + + def __init__(self, **kwargs): + super(BillingProfilesOnExpand, self).__init__(**kwargs) + self.has_more_results = None + self.value = kwargs.get('value', 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 account_admin_notification_email_address: The email address on which + the account admin gets all Azure notifications. + :vartype account_admin_notification_email_address: 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. 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 cost_center: The cost center applied to the subscription. + :type 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 is_account_admin: Indicates whether user is the account admin. + :vartype is_account_admin: bool + :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}, + 'account_admin_notification_email_address': {'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}, + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'is_account_admin': {'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'}, + 'account_admin_notification_email_address': {'key': 'properties.accountAdminNotificationEmailAddress', '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': 'str'}, + 'billing_profile_spending_limit': {'key': 'properties.billingProfileSpendingLimit', 'type': 'str'}, + 'cost_center': {'key': 'properties.costCenter', 'type': 'str'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'properties.invoiceSectionDisplayName', 'type': 'str'}, + 'is_account_admin': {'key': 'properties.isAccountAdmin', 'type': 'bool'}, + '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.account_admin_notification_email_address = None + 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 = kwargs.get('cost_center', None) + self.invoice_section_id = None + self.invoice_section_display_name = None + self.is_account_admin = 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 created_by_user_email_address: The email address of the user who + created the role assignment. + :vartype created_by_user_email_address: str + :param principal_id: The principal id of the user to whom the role was + assigned. + :type principal_id: str + :param principal_tenant_id: The principal tenant id of the user to whom + the role was assigned. + :type principal_tenant_id: str + :param role_definition_id: The ID of the role definition. + :type role_definition_id: str + :ivar scope: The scope at which the role was assigned. + :vartype scope: str + :param user_authentication_type: The authentication type. + :type user_authentication_type: str + :param user_email_address: The email address of the user. + :type user_email_address: 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}, + 'created_by_user_email_address': {'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'}, + 'created_by_user_email_address': {'key': 'properties.createdByUserEmailAddress', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'principal_tenant_id': {'key': 'properties.principalTenantId', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'user_authentication_type': {'key': 'properties.userAuthenticationType', 'type': 'str'}, + 'user_email_address': {'key': 'properties.userEmailAddress', '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.created_by_user_email_address = None + self.principal_id = kwargs.get('principal_id', None) + self.principal_tenant_id = kwargs.get('principal_tenant_id', None) + self.role_definition_id = kwargs.get('role_definition_id', None) + self.scope = None + self.user_authentication_type = kwargs.get('user_authentication_type', None) + self.user_email_address = kwargs.get('user_email_address', 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 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 + :param cost_center: The cost center applied to the subscription. + :type cost_center: 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'}, + 'cost_center': {'key': 'properties.costCenter', '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.cost_center = kwargs.get('cost_center', 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 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 + :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 + :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}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', '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.billing_profile_id = None + self.billing_profile_display_name = None + 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 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 + :ivar source: The source of the document. ENF for Brazil and DRS for rest + of the world. Possible values include: 'DRS', 'ENF' + :vartype source: str or ~azure.mgmt.billing.models.DocumentSource + """ + + _validation = { + 'kind': {'readonly': True}, + 'url': {'readonly': True}, + 'source': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Document, self).__init__(**kwargs) + self.kind = None + self.url = None + self.source = 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 EnrollmentAccountSummary(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, **kwargs): + super(EnrollmentAccountSummary, self).__init__(**kwargs) + self.principal_name = 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 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 IndirectRelationshipInfo(Model): + """The billing profile details of the partner of the customer for an indirect + motion. + + :param billing_account_name: The billing account name of the partner or + the customer for an indirect motion. + :type billing_account_name: str + :param billing_profile_name: The billing profile name of the partner or + the customer for an indirect motion. + :type billing_profile_name: str + :param display_name: The display name of the partner or customer for an + indirect motion. + :type display_name: str + """ + + _attribute_map = { + 'billing_account_name': {'key': 'billingAccountName', 'type': 'str'}, + 'billing_profile_name': {'key': 'billingProfileName', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(IndirectRelationshipInfo, self).__init__(**kwargs) + self.billing_account_name = kwargs.get('billing_account_name', None) + self.billing_profile_name = kwargs.get('billing_profile_name', None) + self.display_name = kwargs.get('display_name', 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', 'Void' + :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 rebill_details: Rebill details for an invoice. + :vartype rebill_details: dict[str, + ~azure.mgmt.billing.models.RebillDetails] + :ivar document_type: The type of the document. Possible values include: + 'Invoice', 'CreditNote' + :vartype document_type: str or + ~azure.mgmt.billing.models.InvoiceDocumentType + :ivar billed_document_id: The Id of the active invoice which is originally + billed after this invoice was voided. This field is applicable to the void + invoices only. + :vartype billed_document_id: str + :ivar credit_for_document_id: The Id of the invoice which got voided and + this credit note was issued as a result. This field is applicable to the + credit notes only. + :vartype credit_for_document_id: str + :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}, + 'rebill_details': {'readonly': True}, + 'document_type': {'readonly': True}, + 'billed_document_id': {'readonly': True}, + 'credit_for_document_id': {'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]'}, + 'rebill_details': {'key': 'properties.rebillDetails', 'type': '{RebillDetails}'}, + 'document_type': {'key': 'properties.documentType', 'type': 'str'}, + 'billed_document_id': {'key': 'properties.billedDocumentId', 'type': 'str'}, + 'credit_for_document_id': {'key': 'properties.creditForDocumentId', 'type': 'str'}, + '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.rebill_details = None + self.document_type = None + self.billed_document_id = None + self.credit_for_document_id = None + self.subscription_id = 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 + :param labels: Dictionary of metadata associated with the invoice section. + :type labels: dict[str, str] + :ivar state: Identifies the state of an invoice section. Possible values + include: 'Active', 'Restricted' + :vartype state: str or ~azure.mgmt.billing.models.InvoiceSectionState + :ivar system_id: The system generated unique identifier for an invoice + section. + :vartype system_id: str + :ivar target_cloud: Identifies the cloud environments that are associated + with an invoice section. This is a system managed optional field and gets + updated as the invoice section gets associated with accounts in various + clouds. Possible values include: 'USGov', 'USNat', 'USSec' + :vartype target_cloud: str or ~azure.mgmt.billing.models.TargetCloud + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'state': {'readonly': True}, + 'system_id': {'readonly': True}, + 'target_cloud': {'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'}, + 'labels': {'key': 'properties.labels', 'type': '{str}'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'system_id': {'key': 'properties.systemId', 'type': 'str'}, + 'target_cloud': {'key': 'properties.targetCloud', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(InvoiceSection, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.labels = kwargs.get('labels', None) + self.state = None + self.system_id = None + self.target_cloud = 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 InvoiceSectionsOnExpand(Model): + """The invoice sections associated to the billing profile. By default this is + not populated, unless it's specified in $expand. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar has_more_results: Indicates whether there are more invoice sections + than the ones listed in this collection. The collection lists a maximum of + 50 invoice sections. To get all invoice sections, use the list invoice + sections API. + :vartype has_more_results: bool + :param value: The invoice sections associated to the billing profile. + :type value: list[~azure.mgmt.billing.models.InvoiceSection] + """ + + _validation = { + 'has_more_results': {'readonly': True}, + } + + _attribute_map = { + 'has_more_results': {'key': 'hasMoreResults', 'type': 'bool'}, + 'value': {'key': 'value', 'type': '[InvoiceSection]'}, + } + + def __init__(self, **kwargs): + super(InvoiceSectionsOnExpand, self).__init__(**kwargs) + self.has_more_results = None + self.value = kwargs.get('value', 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 invoice_section_system_id: The system generated unique identifier + for an invoice section. + :vartype invoice_section_system_id: 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. 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. Possible values include: 'PastDue', + 'SpendingLimitReached', 'SpendingLimitExpired' + :vartype billing_profile_status_reason_code: str or + ~azure.mgmt.billing.models.StatusReasonCodeForBillingProfile + :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.SpendingLimitForBillingProfile + :ivar billing_profile_system_id: The system generated unique identifier + for a billing profile. + :vartype billing_profile_system_id: str + :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}, + 'invoice_section_system_id': {'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}, + 'billing_profile_system_id': {'readonly': True}, + } + + _attribute_map = { + 'invoice_section_id': {'key': 'invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'invoiceSectionDisplayName', 'type': 'str'}, + 'invoice_section_system_id': {'key': 'invoiceSectionSystemId', 'type': 'str'}, + 'billing_profile_id': {'key': 'billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'billingProfileDisplayName', 'type': 'str'}, + 'billing_profile_status': {'key': 'billingProfileStatus', 'type': 'str'}, + 'billing_profile_status_reason_code': {'key': 'billingProfileStatusReasonCode', 'type': 'str'}, + 'billing_profile_spending_limit': {'key': 'billingProfileSpendingLimit', 'type': 'str'}, + 'billing_profile_system_id': {'key': 'billingProfileSystemId', '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.invoice_section_system_id = 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.billing_profile_system_id = 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 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 + :param auto_renew: Indicates whether auto renewal is turned on or off for + a product. Possible values include: 'Off', 'On' + :type auto_renew: str or ~azure.mgmt.billing.models.AutoRenew + :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 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}, + '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'}, + 'auto_renew': {'key': 'properties.autoRenew', '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'}, + '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.auto_renew = kwargs.get('auto_renew', None) + 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.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 RebillDetails(Model): + """The rebill details of an invoice. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar credit_note_document_id: The ID of credit note. + :vartype credit_note_document_id: str + :ivar invoice_document_id: The ID of invoice. + :vartype invoice_document_id: str + :ivar rebill_details: Rebill details for an invoice. + :vartype rebill_details: dict[str, + ~azure.mgmt.billing.models.RebillDetails] + """ + + _validation = { + 'credit_note_document_id': {'readonly': True}, + 'invoice_document_id': {'readonly': True}, + 'rebill_details': {'readonly': True}, + } + + _attribute_map = { + 'credit_note_document_id': {'key': 'creditNoteDocumentId', 'type': 'str'}, + 'invoice_document_id': {'key': 'invoiceDocumentId', 'type': 'str'}, + 'rebill_details': {'key': 'rebillDetails', 'type': '{RebillDetails}'}, + } + + def __init__(self, **kwargs): + super(RebillDetails, self).__init__(**kwargs) + self.credit_note_document_id = None + self.invoice_document_id = None + self.rebill_details = 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 invoice_id: The ID of the invoice on which the transaction was + billed. This field is only applicable for transactions which are billed. + :vartype invoice_id: 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_plan: The type of azure plan of the subscription that was used + for the transaction. + :vartype azure_plan: 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}, + 'invoice_id': {'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_plan': {'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'}, + 'invoice_id': {'key': 'properties.invoiceId', '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_plan': {'key': 'properties.azurePlan', '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.invoice_id = 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_plan = 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 TransferBillingSubscriptionRequestProperties(Model): + """Request parameters to transfer billing subscription. + + All required parameters must be populated in order to send to Azure. + + :param destination_invoice_section_id: Required. The destination invoice + section id. + :type destination_invoice_section_id: str + """ + + _validation = { + 'destination_invoice_section_id': {'required': True}, + } + + _attribute_map = { + 'destination_invoice_section_id': {'key': 'destinationInvoiceSectionId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TransferBillingSubscriptionRequestProperties, self).__init__(**kwargs) + self.destination_invoice_section_id = kwargs.get('destination_invoice_section_id', 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 + """ + + _attribute_map = { + 'destination_invoice_section_id': {'key': 'destinationInvoiceSectionId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TransferProductRequestProperties, self).__init__(**kwargs) + self.destination_invoice_section_id = kwargs.get('destination_invoice_section_id', 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_move_eligible: Specifies whether the transfer is eligible or not. + :vartype is_move_eligible: bool + :param error_details: Validation error details. + :type error_details: + ~azure.mgmt.billing.models.ValidateProductTransferEligibilityError + """ + + _validation = { + 'is_move_eligible': {'readonly': True}, + } + + _attribute_map = { + 'is_move_eligible': {'key': 'isMoveEligible', 'type': 'bool'}, + 'error_details': {'key': 'errorDetails', 'type': 'ValidateProductTransferEligibilityError'}, + } + + def __init__(self, **kwargs): + super(ValidateProductTransferEligibilityResult, self).__init__(**kwargs) + self.is_move_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_move_eligible: Specifies whether the subscription is eligible to + be transferred. + :vartype is_move_eligible: bool + :param error_details: Validation error details. + :type error_details: + ~azure.mgmt.billing.models.ValidateSubscriptionTransferEligibilityError + """ + + _validation = { + 'is_move_eligible': {'readonly': True}, + } + + _attribute_map = { + 'is_move_eligible': {'key': 'isMoveEligible', 'type': 'bool'}, + 'error_details': {'key': 'errorDetails', 'type': 'ValidateSubscriptionTransferEligibilityError'}, + } + + def __init__(self, **kwargs): + super(ValidateSubscriptionTransferEligibilityResult, self).__init__(**kwargs) + self.is_move_eligible = None + self.error_details = kwargs.get('error_details', 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..f28b09faf946 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models_py3.py @@ -0,0 +1,2844 @@ +# 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 AddressDetails(Model): + """Address details. + + All required parameters must be populated in order to send to Azure. + + :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: Required. 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 district: Address district. + :type district: str + :param region: Address region. + :type region: str + :param country: Required. Country code uses ISO2, 2-digit format. + :type country: str + :param postal_code: Postal code. + :type postal_code: str + :param email: Email address. + :type email: str + :param phone_number: Phone number. + :type phone_number: str + """ + + _validation = { + 'address_line1': {'required': True}, + 'country': {'required': True}, + } + + _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'}, + 'district': {'key': 'district', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + 'country': {'key': 'country', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, *, address_line1: str, country: str, first_name: str=None, last_name: str=None, company_name: str=None, address_line2: str=None, address_line3: str=None, city: str=None, district: str=None, region: str=None, postal_code: str=None, email: str=None, phone_number: 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.district = district + self.region = region + self.country = country + self.postal_code = postal_code + self.email = email + self.phone_number = phone_number + + +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 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 + :param display_name: The billing account name. + :type display_name: str + :param sold_to: The address of the individual or organization that is + responsible for the billing account. + :type sold_to: ~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 account_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype account_type: str or ~azure.mgmt.billing.models.AccountType + :ivar account_status: The current status of the billing account. Possible + values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', + 'Extended', 'Terminated' + :vartype account_status: str or ~azure.mgmt.billing.models.AccountStatus + :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: ~azure.mgmt.billing.models.BillingProfilesOnExpand + :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 has_read_access: Indicates whether user has read access to the + billing account. + :vartype has_read_access: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'agreement_type': {'readonly': True}, + 'account_type': {'readonly': True}, + 'account_status': {'readonly': True}, + 'enrollment_details': {'readonly': True}, + 'has_read_access': {'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'}, + 'sold_to': {'key': 'properties.soldTo', 'type': 'AddressDetails'}, + 'agreement_type': {'key': 'properties.agreementType', 'type': 'str'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'account_status': {'key': 'properties.accountStatus', 'type': 'str'}, + 'billing_profiles': {'key': 'properties.billingProfiles', 'type': 'BillingProfilesOnExpand'}, + 'enrollment_details': {'key': 'properties.enrollmentDetails', 'type': 'Enrollment'}, + 'departments': {'key': 'properties.departments', 'type': '[Department]'}, + 'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'}, + 'has_read_access': {'key': 'properties.hasReadAccess', 'type': 'bool'}, + } + + def __init__(self, *, display_name: str=None, sold_to=None, billing_profiles=None, departments=None, enrollment_accounts=None, **kwargs) -> None: + super(BillingAccount, self).__init__(**kwargs) + self.display_name = display_name + self.sold_to = sold_to + self.agreement_type = None + self.account_type = None + self.account_status = None + self.billing_profiles = billing_profiles + self.enrollment_details = None + self.departments = departments + self.enrollment_accounts = enrollment_accounts + self.has_read_access = 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. + + :param display_name: The billing account name. + :type display_name: str + :param sold_to: The address of the individual or organization that is + responsible for the billing account. + :type sold_to: ~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 account_type: The type of customer. Possible values include: + 'Enterprise', 'Individual', 'Partner' + :vartype account_type: str or ~azure.mgmt.billing.models.AccountType + :ivar account_status: The current status of the billing account. Possible + values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', + 'Extended', 'Terminated' + :vartype account_status: str or ~azure.mgmt.billing.models.AccountStatus + :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: ~azure.mgmt.billing.models.BillingProfilesOnExpand + :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 has_read_access: Indicates whether user has read access to the + billing account. + :vartype has_read_access: bool + """ + + _validation = { + 'agreement_type': {'readonly': True}, + 'account_type': {'readonly': True}, + 'account_status': {'readonly': True}, + 'enrollment_details': {'readonly': True}, + 'has_read_access': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'sold_to': {'key': 'properties.soldTo', 'type': 'AddressDetails'}, + 'agreement_type': {'key': 'properties.agreementType', 'type': 'str'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'account_status': {'key': 'properties.accountStatus', 'type': 'str'}, + 'billing_profiles': {'key': 'properties.billingProfiles', 'type': 'BillingProfilesOnExpand'}, + 'enrollment_details': {'key': 'properties.enrollmentDetails', 'type': 'Enrollment'}, + 'departments': {'key': 'properties.departments', 'type': '[Department]'}, + 'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'}, + 'has_read_access': {'key': 'properties.hasReadAccess', 'type': 'bool'}, + } + + def __init__(self, *, display_name: str=None, sold_to=None, billing_profiles=None, departments=None, enrollment_accounts=None, **kwargs) -> None: + super(BillingAccountUpdateRequest, self).__init__(**kwargs) + self.display_name = display_name + self.sold_to = sold_to + self.agreement_type = None + self.account_type = None + self.account_status = None + self.billing_profiles = billing_profiles + self.enrollment_details = None + self.departments = departments + self.enrollment_accounts = enrollment_accounts + self.has_read_access = None + + +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, **kwargs) -> None: + super(BillingPeriod, self).__init__(**kwargs) + self.billing_period_start_date = None + self.billing_period_end_date = None + self.invoice_ids = 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 + :ivar billing_relationship_type: Identifies which services and purchases + are paid by a billing profile. Possible values include: 'Direct', + 'IndirectCustomer', 'IndirectPartner', 'CSPPartner' + :vartype billing_relationship_type: str or + ~azure.mgmt.billing.models.BillingRelationshipType + :param bill_to: Billing address. + :type bill_to: ~azure.mgmt.billing.models.AddressDetails + :ivar indirect_relationship_info: Identifies the billing profile that is + linked to another billing profile in indirect purchase motion. + :vartype indirect_relationship_info: + ~azure.mgmt.billing.models.IndirectRelationshipInfo + :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. By default this is not populated, unless it's specified in + $expand. + :type invoice_sections: ~azure.mgmt.billing.models.InvoiceSectionsOnExpand + :ivar has_read_access: Indicates whether user has read access to the + billing profile. + :vartype has_read_access: bool + :ivar system_id: The system generated unique identifier for a billing + profile. + :vartype system_id: str + :ivar status: The status of the billing profile. Possible values include: + 'Active', 'Disabled', 'Warned' + :vartype status: str or ~azure.mgmt.billing.models.BillingProfileStatus + :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 + :ivar target_clouds: Identifies the cloud environments that are associated + with a billing profile. This is a system managed optional field and gets + updated as the billing profile gets associated with accounts in various + clouds. + :vartype target_clouds: list[str or + ~azure.mgmt.billing.models.TargetCloud] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'billing_relationship_type': {'readonly': True}, + 'indirect_relationship_info': {'readonly': True}, + 'invoice_day': {'readonly': True}, + 'currency': {'readonly': True}, + 'has_read_access': {'readonly': True}, + 'system_id': {'readonly': True}, + 'status': {'readonly': True}, + 'status_reason_code': {'readonly': True}, + 'spending_limit': {'readonly': True}, + 'target_clouds': {'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'}, + 'billing_relationship_type': {'key': 'properties.billingRelationshipType', 'type': 'str'}, + 'bill_to': {'key': 'properties.billTo', 'type': 'AddressDetails'}, + 'indirect_relationship_info': {'key': 'properties.indirectRelationshipInfo', 'type': 'IndirectRelationshipInfo'}, + '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': 'InvoiceSectionsOnExpand'}, + 'has_read_access': {'key': 'properties.hasReadAccess', 'type': 'bool'}, + 'system_id': {'key': 'properties.systemId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'status_reason_code': {'key': 'properties.statusReasonCode', 'type': 'str'}, + 'spending_limit': {'key': 'properties.spendingLimit', 'type': 'str'}, + 'target_clouds': {'key': 'properties.targetClouds', 'type': '[str]'}, + } + + def __init__(self, *, display_name: str=None, po_number: str=None, bill_to=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.billing_relationship_type = None + self.bill_to = bill_to + self.indirect_relationship_info = None + 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.has_read_access = None + self.system_id = None + self.status = None + self.status_reason_code = None + self.spending_limit = None + self.target_clouds = 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 bill_to: The address of the individual or organization that is + responsible for the billing profile. + :type bill_to: ~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'}, + 'bill_to': {'key': 'billTo', '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, bill_to=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.bill_to = bill_to + self.invoice_email_opt_in = invoice_email_opt_in + self.enabled_azure_plans = enabled_azure_plans + + +class BillingProfilesOnExpand(Model): + """The billing profiles associated with the billing account. By default this + is not populated, unless it's specified in $expand. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar has_more_results: Indicates whether there are more billing profiles + than the ones listed in this collection. The collection lists a maximum of + 50 billing profiles. To get all billing profiles, use the list billing + profiles API. + :vartype has_more_results: bool + :param value: The billing profiles associated with the billing account. + :type value: list[~azure.mgmt.billing.models.BillingProfile] + """ + + _validation = { + 'has_more_results': {'readonly': True}, + } + + _attribute_map = { + 'has_more_results': {'key': 'hasMoreResults', 'type': 'bool'}, + 'value': {'key': 'value', 'type': '[BillingProfile]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(BillingProfilesOnExpand, self).__init__(**kwargs) + self.has_more_results = None + self.value = value + + +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 account_admin_notification_email_address: The email address on which + the account admin gets all Azure notifications. + :vartype account_admin_notification_email_address: 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. 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 cost_center: The cost center applied to the subscription. + :type 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 is_account_admin: Indicates whether user is the account admin. + :vartype is_account_admin: bool + :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}, + 'account_admin_notification_email_address': {'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}, + 'invoice_section_id': {'readonly': True}, + 'invoice_section_display_name': {'readonly': True}, + 'is_account_admin': {'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'}, + 'account_admin_notification_email_address': {'key': 'properties.accountAdminNotificationEmailAddress', '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': 'str'}, + 'billing_profile_spending_limit': {'key': 'properties.billingProfileSpendingLimit', 'type': 'str'}, + 'cost_center': {'key': 'properties.costCenter', 'type': 'str'}, + 'invoice_section_id': {'key': 'properties.invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'properties.invoiceSectionDisplayName', 'type': 'str'}, + 'is_account_admin': {'key': 'properties.isAccountAdmin', 'type': 'bool'}, + '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, *, cost_center: str=None, **kwargs) -> None: + super(BillingProperty, self).__init__(**kwargs) + self.account_admin_notification_email_address = None + 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 = cost_center + self.invoice_section_id = None + self.invoice_section_display_name = None + self.is_account_admin = 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 created_by_user_email_address: The email address of the user who + created the role assignment. + :vartype created_by_user_email_address: str + :param principal_id: The principal id of the user to whom the role was + assigned. + :type principal_id: str + :param principal_tenant_id: The principal tenant id of the user to whom + the role was assigned. + :type principal_tenant_id: str + :param role_definition_id: The ID of the role definition. + :type role_definition_id: str + :ivar scope: The scope at which the role was assigned. + :vartype scope: str + :param user_authentication_type: The authentication type. + :type user_authentication_type: str + :param user_email_address: The email address of the user. + :type user_email_address: 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}, + 'created_by_user_email_address': {'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'}, + 'created_by_user_email_address': {'key': 'properties.createdByUserEmailAddress', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'principal_tenant_id': {'key': 'properties.principalTenantId', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'user_authentication_type': {'key': 'properties.userAuthenticationType', 'type': 'str'}, + 'user_email_address': {'key': 'properties.userEmailAddress', 'type': 'str'}, + } + + def __init__(self, *, principal_id: str=None, principal_tenant_id: str=None, role_definition_id: str=None, user_authentication_type: str=None, user_email_address: str=None, **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.created_by_user_email_address = None + self.principal_id = principal_id + self.principal_tenant_id = principal_tenant_id + self.role_definition_id = role_definition_id + self.scope = None + self.user_authentication_type = user_authentication_type + self.user_email_address = user_email_address + + +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 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 + :param cost_center: The cost center applied to the subscription. + :type cost_center: 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'}, + 'cost_center': {'key': 'properties.costCenter', '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, cost_center: str=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.cost_center = cost_center + 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 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 + :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 + :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}, + 'billing_profile_id': {'readonly': True}, + 'billing_profile_display_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'billing_profile_id': {'key': 'properties.billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'properties.billingProfileDisplayName', '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.billing_profile_id = None + self.billing_profile_display_name = None + 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 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 + :ivar source: The source of the document. ENF for Brazil and DRS for rest + of the world. Possible values include: 'DRS', 'ENF' + :vartype source: str or ~azure.mgmt.billing.models.DocumentSource + """ + + _validation = { + 'kind': {'readonly': True}, + 'url': {'readonly': True}, + 'source': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Document, self).__init__(**kwargs) + self.kind = None + self.url = None + self.source = 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 EnrollmentAccountSummary(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, **kwargs) -> None: + super(EnrollmentAccountSummary, self).__init__(**kwargs) + self.principal_name = 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 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 IndirectRelationshipInfo(Model): + """The billing profile details of the partner of the customer for an indirect + motion. + + :param billing_account_name: The billing account name of the partner or + the customer for an indirect motion. + :type billing_account_name: str + :param billing_profile_name: The billing profile name of the partner or + the customer for an indirect motion. + :type billing_profile_name: str + :param display_name: The display name of the partner or customer for an + indirect motion. + :type display_name: str + """ + + _attribute_map = { + 'billing_account_name': {'key': 'billingAccountName', 'type': 'str'}, + 'billing_profile_name': {'key': 'billingProfileName', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, *, billing_account_name: str=None, billing_profile_name: str=None, display_name: str=None, **kwargs) -> None: + super(IndirectRelationshipInfo, self).__init__(**kwargs) + self.billing_account_name = billing_account_name + self.billing_profile_name = billing_profile_name + self.display_name = display_name + + +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', 'Void' + :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 rebill_details: Rebill details for an invoice. + :vartype rebill_details: dict[str, + ~azure.mgmt.billing.models.RebillDetails] + :ivar document_type: The type of the document. Possible values include: + 'Invoice', 'CreditNote' + :vartype document_type: str or + ~azure.mgmt.billing.models.InvoiceDocumentType + :ivar billed_document_id: The Id of the active invoice which is originally + billed after this invoice was voided. This field is applicable to the void + invoices only. + :vartype billed_document_id: str + :ivar credit_for_document_id: The Id of the invoice which got voided and + this credit note was issued as a result. This field is applicable to the + credit notes only. + :vartype credit_for_document_id: str + :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}, + 'rebill_details': {'readonly': True}, + 'document_type': {'readonly': True}, + 'billed_document_id': {'readonly': True}, + 'credit_for_document_id': {'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]'}, + 'rebill_details': {'key': 'properties.rebillDetails', 'type': '{RebillDetails}'}, + 'document_type': {'key': 'properties.documentType', 'type': 'str'}, + 'billed_document_id': {'key': 'properties.billedDocumentId', 'type': 'str'}, + 'credit_for_document_id': {'key': 'properties.creditForDocumentId', 'type': 'str'}, + '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.rebill_details = None + self.document_type = None + self.billed_document_id = None + self.credit_for_document_id = None + self.subscription_id = 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 + :param labels: Dictionary of metadata associated with the invoice section. + :type labels: dict[str, str] + :ivar state: Identifies the state of an invoice section. Possible values + include: 'Active', 'Restricted' + :vartype state: str or ~azure.mgmt.billing.models.InvoiceSectionState + :ivar system_id: The system generated unique identifier for an invoice + section. + :vartype system_id: str + :ivar target_cloud: Identifies the cloud environments that are associated + with an invoice section. This is a system managed optional field and gets + updated as the invoice section gets associated with accounts in various + clouds. Possible values include: 'USGov', 'USNat', 'USSec' + :vartype target_cloud: str or ~azure.mgmt.billing.models.TargetCloud + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'state': {'readonly': True}, + 'system_id': {'readonly': True}, + 'target_cloud': {'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'}, + 'labels': {'key': 'properties.labels', 'type': '{str}'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'system_id': {'key': 'properties.systemId', 'type': 'str'}, + 'target_cloud': {'key': 'properties.targetCloud', 'type': 'str'}, + } + + def __init__(self, *, display_name: str=None, labels=None, **kwargs) -> None: + super(InvoiceSection, self).__init__(**kwargs) + self.display_name = display_name + self.labels = labels + self.state = None + self.system_id = None + self.target_cloud = 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, *, display_name: str=None, **kwargs) -> None: + super(InvoiceSectionCreationRequest, self).__init__(**kwargs) + self.display_name = display_name + + +class InvoiceSectionsOnExpand(Model): + """The invoice sections associated to the billing profile. By default this is + not populated, unless it's specified in $expand. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar has_more_results: Indicates whether there are more invoice sections + than the ones listed in this collection. The collection lists a maximum of + 50 invoice sections. To get all invoice sections, use the list invoice + sections API. + :vartype has_more_results: bool + :param value: The invoice sections associated to the billing profile. + :type value: list[~azure.mgmt.billing.models.InvoiceSection] + """ + + _validation = { + 'has_more_results': {'readonly': True}, + } + + _attribute_map = { + 'has_more_results': {'key': 'hasMoreResults', 'type': 'bool'}, + 'value': {'key': 'value', 'type': '[InvoiceSection]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(InvoiceSectionsOnExpand, self).__init__(**kwargs) + self.has_more_results = None + self.value = value + + +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 invoice_section_system_id: The system generated unique identifier + for an invoice section. + :vartype invoice_section_system_id: 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. 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. Possible values include: 'PastDue', + 'SpendingLimitReached', 'SpendingLimitExpired' + :vartype billing_profile_status_reason_code: str or + ~azure.mgmt.billing.models.StatusReasonCodeForBillingProfile + :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.SpendingLimitForBillingProfile + :ivar billing_profile_system_id: The system generated unique identifier + for a billing profile. + :vartype billing_profile_system_id: str + :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}, + 'invoice_section_system_id': {'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}, + 'billing_profile_system_id': {'readonly': True}, + } + + _attribute_map = { + 'invoice_section_id': {'key': 'invoiceSectionId', 'type': 'str'}, + 'invoice_section_display_name': {'key': 'invoiceSectionDisplayName', 'type': 'str'}, + 'invoice_section_system_id': {'key': 'invoiceSectionSystemId', 'type': 'str'}, + 'billing_profile_id': {'key': 'billingProfileId', 'type': 'str'}, + 'billing_profile_display_name': {'key': 'billingProfileDisplayName', 'type': 'str'}, + 'billing_profile_status': {'key': 'billingProfileStatus', 'type': 'str'}, + 'billing_profile_status_reason_code': {'key': 'billingProfileStatusReasonCode', 'type': 'str'}, + 'billing_profile_spending_limit': {'key': 'billingProfileSpendingLimit', 'type': 'str'}, + 'billing_profile_system_id': {'key': 'billingProfileSystemId', '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.invoice_section_system_id = 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.billing_profile_system_id = 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 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 + :param auto_renew: Indicates whether auto renewal is turned on or off for + a product. Possible values include: 'Off', 'On' + :type auto_renew: str or ~azure.mgmt.billing.models.AutoRenew + :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 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}, + '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'}, + 'auto_renew': {'key': 'properties.autoRenew', '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'}, + '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, *, auto_renew=None, status=None, billing_frequency=None, **kwargs) -> None: + super(Product, self).__init__(**kwargs) + self.auto_renew = auto_renew + 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.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 RebillDetails(Model): + """The rebill details of an invoice. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar credit_note_document_id: The ID of credit note. + :vartype credit_note_document_id: str + :ivar invoice_document_id: The ID of invoice. + :vartype invoice_document_id: str + :ivar rebill_details: Rebill details for an invoice. + :vartype rebill_details: dict[str, + ~azure.mgmt.billing.models.RebillDetails] + """ + + _validation = { + 'credit_note_document_id': {'readonly': True}, + 'invoice_document_id': {'readonly': True}, + 'rebill_details': {'readonly': True}, + } + + _attribute_map = { + 'credit_note_document_id': {'key': 'creditNoteDocumentId', 'type': 'str'}, + 'invoice_document_id': {'key': 'invoiceDocumentId', 'type': 'str'}, + 'rebill_details': {'key': 'rebillDetails', 'type': '{RebillDetails}'}, + } + + def __init__(self, **kwargs) -> None: + super(RebillDetails, self).__init__(**kwargs) + self.credit_note_document_id = None + self.invoice_document_id = None + self.rebill_details = 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 invoice_id: The ID of the invoice on which the transaction was + billed. This field is only applicable for transactions which are billed. + :vartype invoice_id: 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_plan: The type of azure plan of the subscription that was used + for the transaction. + :vartype azure_plan: 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}, + 'invoice_id': {'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_plan': {'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'}, + 'invoice_id': {'key': 'properties.invoiceId', '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_plan': {'key': 'properties.azurePlan', '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.invoice_id = 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_plan = 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 TransferBillingSubscriptionRequestProperties(Model): + """Request parameters to transfer billing subscription. + + All required parameters must be populated in order to send to Azure. + + :param destination_invoice_section_id: Required. The destination invoice + section id. + :type destination_invoice_section_id: str + """ + + _validation = { + 'destination_invoice_section_id': {'required': True}, + } + + _attribute_map = { + 'destination_invoice_section_id': {'key': 'destinationInvoiceSectionId', 'type': 'str'}, + } + + def __init__(self, *, destination_invoice_section_id: str, **kwargs) -> None: + super(TransferBillingSubscriptionRequestProperties, self).__init__(**kwargs) + self.destination_invoice_section_id = destination_invoice_section_id + + +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 + """ + + _attribute_map = { + 'destination_invoice_section_id': {'key': 'destinationInvoiceSectionId', 'type': 'str'}, + } + + def __init__(self, *, destination_invoice_section_id: str=None, **kwargs) -> None: + super(TransferProductRequestProperties, self).__init__(**kwargs) + self.destination_invoice_section_id = destination_invoice_section_id + + +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_move_eligible: Specifies whether the transfer is eligible or not. + :vartype is_move_eligible: bool + :param error_details: Validation error details. + :type error_details: + ~azure.mgmt.billing.models.ValidateProductTransferEligibilityError + """ + + _validation = { + 'is_move_eligible': {'readonly': True}, + } + + _attribute_map = { + 'is_move_eligible': {'key': 'isMoveEligible', 'type': 'bool'}, + 'error_details': {'key': 'errorDetails', 'type': 'ValidateProductTransferEligibilityError'}, + } + + def __init__(self, *, error_details=None, **kwargs) -> None: + super(ValidateProductTransferEligibilityResult, self).__init__(**kwargs) + self.is_move_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_move_eligible: Specifies whether the subscription is eligible to + be transferred. + :vartype is_move_eligible: bool + :param error_details: Validation error details. + :type error_details: + ~azure.mgmt.billing.models.ValidateSubscriptionTransferEligibilityError + """ + + _validation = { + 'is_move_eligible': {'readonly': True}, + } + + _attribute_map = { + 'is_move_eligible': {'key': 'isMoveEligible', 'type': 'bool'}, + 'error_details': {'key': 'errorDetails', 'type': 'ValidateSubscriptionTransferEligibilityError'}, + } + + def __init__(self, *, error_details=None, **kwargs) -> None: + super(ValidateSubscriptionTransferEligibilityResult, self).__init__(**kwargs) + self.is_move_eligible = None + self.error_details = error_details 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..4dde2e787acb --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_paged_models.py @@ -0,0 +1,235 @@ +# 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 BillingAccountPaged(Paged): + """ + A paging container for iterating over a list of :class:`BillingAccount ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BillingAccount]'} + } + + def __init__(self, *args, **kwargs): + + super(BillingAccountPaged, self).__init__(*args, **kwargs) +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 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 BillingProfilePaged(Paged): + """ + A paging container for iterating over a list of :class:`BillingProfile ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BillingProfile]'} + } + + def __init__(self, *args, **kwargs): + + super(BillingProfilePaged, 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 InvoiceSectionPaged(Paged): + """ + A paging container for iterating over a list of :class:`InvoiceSection ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[InvoiceSection]'} + } + + def __init__(self, *args, **kwargs): + + super(InvoiceSectionPaged, self).__init__(*args, **kwargs) +class BillingPermissionsPropertiesPaged(Paged): + """ + A paging container for iterating over a list of :class:`BillingPermissionsProperties ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BillingPermissionsProperties]'} + } + + def __init__(self, *args, **kwargs): + + super(BillingPermissionsPropertiesPaged, 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 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 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 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) +class BillingRoleDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`BillingRoleDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BillingRoleDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(BillingRoleDefinitionPaged, self).__init__(*args, **kwargs) +class BillingRoleAssignmentPaged(Paged): + """ + A paging container for iterating over a list of :class:`BillingRoleAssignment ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BillingRoleAssignment]'} + } + + def __init__(self, *args, **kwargs): + + super(BillingRoleAssignmentPaged, self).__init__(*args, **kwargs) +class AgreementPaged(Paged): + """ + A paging container for iterating over a list of :class:`Agreement ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Agreement]'} + } + + def __init__(self, *args, **kwargs): + + super(AgreementPaged, self).__init__(*args, **kwargs) +class EnrollmentAccountSummaryPaged(Paged): + """ + A paging container for iterating over a list of :class:`EnrollmentAccountSummary ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[EnrollmentAccountSummary]'} + } + + def __init__(self, *args, **kwargs): + + super(EnrollmentAccountSummaryPaged, self).__init__(*args, **kwargs) +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/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..d294ba99622a 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,46 @@ # 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 ._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 ._invoices_operations import InvoicesOperations +from ._transactions_operations import TransactionsOperations +from ._policies_operations import PoliciesOperations +from ._billing_property_operations import BillingPropertyOperations +from ._operations import Operations +from ._billing_role_definitions_operations import BillingRoleDefinitionsOperations +from ._billing_role_assignments_operations import BillingRoleAssignmentsOperations +from ._agreements_operations import AgreementsOperations +from ._enrollment_accounts_operations import EnrollmentAccountsOperations +from ._billing_periods_operations import BillingPeriodsOperations __all__ = [ - 'EnrollmentAccountsOperations', - 'BillingPeriodsOperations', + 'BillingAccountsOperations', + 'AddressOperations', + 'AvailableBalancesOperations', + 'InstructionsOperations', + 'BillingProfilesOperations', + 'CustomersOperations', + 'InvoiceSectionsOperations', + 'BillingPermissionsOperations', + 'BillingSubscriptionsOperations', + 'ProductsOperations', 'InvoicesOperations', + 'TransactionsOperations', + 'PoliciesOperations', + 'BillingPropertyOperations', 'Operations', + 'BillingRoleDefinitionsOperations', + 'BillingRoleAssignmentsOperations', + 'AgreementsOperations', + 'EnrollmentAccountsOperations', + 'BillingPeriodsOperations', ] 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..b90e976e4e97 --- /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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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 soldTo or a billTo 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..78872784956b --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_agreements_operations.py @@ -0,0 +1,175 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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: An iterator like instance of Agreement + :rtype: + ~azure.mgmt.billing.models.AgreementPaged[~azure.mgmt.billing.models.Agreement] + :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 expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, '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.AgreementPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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..3242c817dcf3 --- /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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + self.config = config + + def get( + 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.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.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..6ac265fd1507 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_accounts_operations.py @@ -0,0 +1,339 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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 soldTo, 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: An iterator like instance of BillingAccount + :rtype: + ~azure.mgmt.billing.models.BillingAccountPaged[~azure.mgmt.billing.models.BillingAccount] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + 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') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, '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.BillingAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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 soldTo, 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_periods_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_periods_operations.py similarity index 90% rename from sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py rename to sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_periods_operations.py index 7f382587610d..54c109b260e0 100644 --- 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 @@ -18,6 +18,8 @@ class BillingPeriodsOperations(object): """BillingPeriodsOperations 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. @@ -67,8 +69,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'] @@ -93,7 +94,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: @@ -102,9 +103,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) @@ -112,12 +117,10 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.BillingPeriodPaged(internal_paging, self._deserialize.dependencies) - + header_dict = None if raw: header_dict = {} - client_raw_response = models.BillingPeriodPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + deserialized = models.BillingPeriodPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods'} @@ -156,7 +159,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: @@ -165,14 +168,13 @@ 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('BillingPeriod', response) 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..102410fafc0c --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_permissions_operations.py @@ -0,0 +1,326 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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: An iterator like instance of BillingPermissionsProperties + :rtype: + ~azure.mgmt.billing.models.BillingPermissionsPropertiesPaged[~azure.mgmt.billing.models.BillingPermissionsProperties] + :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.BillingPermissionsPropertiesPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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: An iterator like instance of BillingPermissionsProperties + :rtype: + ~azure.mgmt.billing.models.BillingPermissionsPropertiesPaged[~azure.mgmt.billing.models.BillingPermissionsProperties] + :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.BillingPermissionsPropertiesPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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: An iterator like instance of BillingPermissionsProperties + :rtype: + ~azure.mgmt.billing.models.BillingPermissionsPropertiesPaged[~azure.mgmt.billing.models.BillingPermissionsProperties] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # 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') + + 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.BillingPermissionsPropertiesPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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: An iterator like instance of BillingPermissionsProperties + :rtype: + ~azure.mgmt.billing.models.BillingPermissionsPropertiesPaged[~azure.mgmt.billing.models.BillingPermissionsProperties] + :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.BillingPermissionsPropertiesPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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..0ae0d11e8767 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_profiles_operations.py @@ -0,0 +1,295 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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: An iterator like instance of BillingProfile + :rtype: + ~azure.mgmt.billing.models.BillingProfilePaged[~azure.mgmt.billing.models.BillingProfile] + :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 expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, '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.BillingProfilePaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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_or_update_initial( + self, billing_account_name, billing_profile_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_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.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_or_update( + self, billing_account_name, billing_profile_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates 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: The new or updated billing profile. + :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._create_or_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': '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_or_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..7ef75964f23e --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_property_operations.py @@ -0,0 +1,159 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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'} + + def update( + self, cost_center=None, custom_headers=None, raw=False, **operation_config): + """Updates the billing property of a subscription. Currently, cost center + can be updated. The operation is supported only for billing accounts + with agreement type Microsoft Customer Agreement. + + :param cost_center: The cost center applied to the subscription. + :type cost_center: 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: BillingProperty or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingProperty or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.BillingProperty(cost_center=cost_center) + + # Construct URL + url = self.update.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' + 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, 'BillingProperty') + + # 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]: + 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 + update.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..8ff3218b1440 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_assignments_operations.py @@ -0,0 +1,663 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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: An iterator like instance of BillingRoleAssignment + :rtype: + ~azure.mgmt.billing.models.BillingRoleAssignmentPaged[~azure.mgmt.billing.models.BillingRoleAssignment] + :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.BillingRoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments'} + + 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: An iterator like instance of BillingRoleAssignment + :rtype: + ~azure.mgmt.billing.models.BillingRoleAssignmentPaged[~azure.mgmt.billing.models.BillingRoleAssignment] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # 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') + + 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.BillingRoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments'} + + 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: An iterator like instance of BillingRoleAssignment + :rtype: + ~azure.mgmt.billing.models.BillingRoleAssignmentPaged[~azure.mgmt.billing.models.BillingRoleAssignment] + :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.BillingRoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments'} 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..06a6f22245ae --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_definitions_operations.py @@ -0,0 +1,462 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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: An iterator like instance of BillingRoleDefinition + :rtype: + ~azure.mgmt.billing.models.BillingRoleDefinitionPaged[~azure.mgmt.billing.models.BillingRoleDefinition] + :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.BillingRoleDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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: An iterator like instance of BillingRoleDefinition + :rtype: + ~azure.mgmt.billing.models.BillingRoleDefinitionPaged[~azure.mgmt.billing.models.BillingRoleDefinition] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # 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') + + 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.BillingRoleDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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: An iterator like instance of BillingRoleDefinition + :rtype: + ~azure.mgmt.billing.models.BillingRoleDefinitionPaged[~azure.mgmt.billing.models.BillingRoleDefinition] + :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.BillingRoleDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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..d03b5fed9a6a --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_subscriptions_operations.py @@ -0,0 +1,646 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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 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: 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_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.BillingSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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: 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_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') + + 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_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions'} + + def get( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Gets a subscription by its ID. The operation is supported for billing + accounts with agreement type Microsoft Customer Agreement and 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: 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'), + '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('BillingSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}'} + + def update( + self, billing_account_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates the properties of a billing subscription. Currently, cost + center 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 subscription operation. + :type parameters: ~azure.mgmt.billing.models.BillingSubscription + :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.update.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + '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' + 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, 'BillingSubscription') + + # 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]: + 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 + update.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}'} + + + def _move_initial( + self, billing_account_name, destination_invoice_section_id, custom_headers=None, raw=False, **operation_config): + parameters = models.TransferBillingSubscriptionRequestProperties(destination_invoice_section_id=destination_invoice_section_id) + + # Construct URL + url = self.move.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + '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' + 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('BillingSubscription', 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 move( + self, billing_account_name, destination_invoice_section_id, 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 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 destination_invoice_section_id: The destination invoice section + id. + :type destination_invoice_section_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 BillingSubscription or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.BillingSubscription] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.BillingSubscription]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._move_initial( + billing_account_name=billing_account_name, + destination_invoice_section_id=destination_invoice_section_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('BillingSubscription', 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) + move.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move'} + + def validate_move( + self, billing_account_name, destination_invoice_section_id, 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 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 destination_invoice_section_id: The destination invoice section + id. + :type destination_invoice_section_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) + + # Construct URL + url = self.validate_move.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + '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' + 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_move.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/validateMoveEligibility'} 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..e91bb7596fa8 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_customers_operations.py @@ -0,0 +1,268 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + self.config = config + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, search=None, filter=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 search: Used for searching customers by their name. Any + customer with name containing the search text will be included in the + response + :type search: str + :param filter: May be used to filter the list of customers. + :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 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 search is not None: + query_parameters['$search'] = self._serialize.query("search", search, '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.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, search=None, filter=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 search: Used for searching customers by their name. Any + customer with name containing the search text will be included in the + response + :type search: str + :param filter: May be used to filter the list of customers. + :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 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 search is not None: + query_parameters['$search'] = self._serialize.query("search", search, '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.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/enrollment_accounts_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_enrollment_accounts_operations.py similarity index 79% rename from sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_operations.py rename to sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_enrollment_accounts_operations.py index 071d1ce3c75c..6d781d1d0496 100644 --- 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 @@ -18,6 +18,8 @@ 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. @@ -45,14 +47,13 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of EnrollmentAccount + :return: An iterator like instance of EnrollmentAccountSummary :rtype: - ~azure.mgmt.billing.models.EnrollmentAccountPaged[~azure.mgmt.billing.models.EnrollmentAccount] + ~azure.mgmt.billing.models.EnrollmentAccountSummaryPaged[~azure.mgmt.billing.models.EnrollmentAccountSummary] :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.EnrollmentAccountPaged(internal_paging, self._deserialize.dependencies) - + header_dict = None if raw: header_dict = {} - client_raw_response = models.EnrollmentAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + deserialized = models.EnrollmentAccountSummaryPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized list.metadata = {'url': '/providers/Microsoft.Billing/enrollmentAccounts'} @@ -107,8 +110,8 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: EnrollmentAccount or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.EnrollmentAccount or + :return: EnrollmentAccountSummary or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.EnrollmentAccountSummary or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` @@ -126,7 +129,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: @@ -135,16 +138,15 @@ 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('EnrollmentAccount', response) + deserialized = self._deserialize('EnrollmentAccountSummary', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) 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..45ecc61fb5d1 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 2020-05-01. Constant value: "2020-05-01". """ 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 = "2020-05-01" 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..8aef6f3c7e2c --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoice_sections_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 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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: An iterator like instance of InvoiceSection + :rtype: + ~azure.mgmt.billing.models.InvoiceSectionPaged[~azure.mgmt.billing.models.InvoiceSection] + :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.InvoiceSectionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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_or_update_initial( + self, billing_account_name, billing_profile_name, invoice_section_name, display_name=None, labels=None, custom_headers=None, raw=False, **operation_config): + parameters = models.InvoiceSection(display_name=display_name, labels=labels) + + # Construct URL + url = self.create_or_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.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_or_update( + self, billing_account_name, billing_profile_name, invoice_section_name, display_name=None, labels=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates 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 labels: Dictionary of metadata associated with the invoice + section. + :type labels: dict[str, 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_or_update_initial( + billing_account_name=billing_account_name, + billing_profile_name=billing_profile_name, + invoice_section_name=invoice_section_name, + display_name=display_name, + labels=labels, + 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_or_update.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}'} 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..3bb95a64618b --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoices_operations.py @@ -0,0 +1,663 @@ +# 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 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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: 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_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') + + 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_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: 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_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') + + 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_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices'} + + def get( + self, billing_account_name, invoice_name, custom_headers=None, raw=False, **operation_config): + """Gets an invoice by billing account name and 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 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'), + '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}/invoices/{invoiceName}'} + + def get_by_id( + self, 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 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 = { + '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/default/invoices/{invoiceName}'} + + + def _download_invoice_initial( + self, billing_account_name, invoice_name, download_token, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.download_invoice.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_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') + query_parameters['downloadToken'] = self._serialize.query("download_token", download_token, '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', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def download_invoice( + self, billing_account_name, invoice_name, download_token, custom_headers=None, raw=False, polling=True, **operation_config): + """Gets a URL to download 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 invoice_name: The ID that uniquely identifies an invoice. + :type invoice_name: str + :param download_token: Download token with document source and + document ID. + :type download_token: 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_invoice_initial( + billing_account_name=billing_account_name, + invoice_name=invoice_name, + download_token=download_token, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': '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_invoice.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download'} + + def list_by_billing_subscription( + self, period_start_date, period_end_date, custom_headers=None, raw=False, **operation_config): + """Lists the invoices for a subscription. + + :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 = { + '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['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/default/billingSubscriptions/{subscriptionId}/invoices'} + + def get_by_subscription_and_invoice_id( + self, invoice_name, custom_headers=None, raw=False, **operation_config): + """Gets an invoice by subscription ID and invoice ID. + + :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_subscription_and_invoice_id.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') + } + 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_subscription_and_invoice_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}'} + + + def _download_billing_subscription_invoice_initial( + self, invoice_name, download_token, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.download_billing_subscription_invoice.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') + } + 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['downloadToken'] = self._serialize.query("download_token", download_token, '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', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def download_billing_subscription_invoice( + self, invoice_name, download_token, custom_headers=None, raw=False, polling=True, **operation_config): + """Gets a URL to download an invoice. + + :param invoice_name: The ID that uniquely identifies an invoice. + :type invoice_name: str + :param download_token: Download token with document source and + document ID. + :type download_token: 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_billing_subscription_invoice_initial( + invoice_name=invoice_name, + download_token=download_token, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': '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_billing_subscription_invoice.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download'} 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 78% 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..1e730a5459dd 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 2020-05-01. Constant value: "2020-05-01". """ 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 = "2020-05-01" 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/_policies_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_policies_operations.py new file mode 100644 index 000000000000..5490f21eedab --- /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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + 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/_products_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_products_operations.py new file mode 100644 index 000000000000..7bffd9d425a5 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_products_operations.py @@ -0,0 +1,640 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + self.config = config + + def list_by_customer( + self, billing_account_name, customer_name, 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 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_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.ProductPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_customer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products'} + + 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_billing_profile( + self, billing_account_name, billing_profile_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the products for a billing profile. 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 billing_profile_name: The ID that uniquely identifies a billing + profile. + :type billing_profile_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_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') + + 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_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/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: 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_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') + + 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_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products'} + + def get( + self, billing_account_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 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'), + '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}/products/{productName}'} + + def update( + self, billing_account_name, product_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates the properties of a Product. Currently, auto renew 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 product_name: The ID that uniquely identifies a product. + :type product_name: str + :param parameters: Request parameters that are provided to the update + product operation. + :type parameters: ~azure.mgmt.billing.models.Product + :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.update.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_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, 'Product') + + # 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]: + 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 + update.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}'} + + def move( + self, billing_account_name, product_name, destination_invoice_section_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 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 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) + + # Construct URL + url = self.move.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_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 + move.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move'} + + def validate_move( + self, billing_account_name, product_name, destination_invoice_section_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 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 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) + + # Construct URL + url = self.validate_move.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_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]: + 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_move.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility'} 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..6cb9b1ea2142 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transactions_operations.py @@ -0,0 +1,111 @@ +# 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 2020-05-01. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + self.config = config + + def list_by_invoice( + self, billing_account_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 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'), + '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}/invoices/{invoiceName}/transactions'} diff --git a/sdk/billing/azure-mgmt-billing/setup.py b/sdk/billing/azure-mgmt-billing/setup.py index 136708993641..64b9ef791d06 100644 --- a/sdk/billing/azure-mgmt-billing/setup.py +++ b/sdk/billing/azure-mgmt-billing/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -64,10 +66,10 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'License :: OSI Approved :: MIT License', ], zip_safe=False,