From 70a801844437a9bb5c8cea457b3b543f7b716ce5 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 22 Apr 2019 20:07:51 +0000 Subject: [PATCH 1/3] Generated from f7a7ff95dbfab2af60f50d78a6c516f2c9f529af Merge remote-tracking branch 'upstream/master' --- .../mgmt/billing/billing_management_client.py | 314 +------ .../azure/mgmt/billing/operations/__init__.py | 74 +- ...ons.py => available_balance_operations.py} | 10 +- ..._account_billing_permissions_operations.py | 94 --- ...s.py => billing_permissions_operations.py} | 47 +- ...file_billing_role_definition_operations.py | 161 ---- ...iles_by_billing_account_name_operations.py | 98 --- .../operations/billing_profiles_operations.py | 61 ++ .../billing_role_assignment_operations.py | 787 ++++++++++++++++++ ... => billing_role_definition_operations.py} | 222 +++-- .../billing_subscription_operations.py | 221 ----- ...criptions_by_billing_profile_operations.py | 98 --- ...criptions_by_invoice_section_operations.py | 98 --- ...py => billing_subscriptions_operations.py} | 251 ++++-- ...ents_by_billing_account_name_operations.py | 105 --- .../operations/departments_operations.py | 68 ++ ...unts_by_billing_account_name_operations.py | 105 --- .../enrollment_accounts_operations.py | 74 +- .../billing/operations/invoice_operations.py | 100 --- ...tion_billing_role_definition_operations.py | 161 ---- ...sections_billing_permissions_operations.py | 97 --- ...ions_by_billing_account_name_operations.py | 98 --- .../operations/invoice_sections_operations.py | 123 +++ ...eate_subscription_permission_operations.py | 99 --- .../invoices_by_billing_account_operations.py | 100 --- .../invoices_by_billing_profile_operations.py | 103 --- ...t_operations.py => invoices_operations.py} | 150 ++-- ...tions.py => payment_methods_operations.py} | 10 +- .../billing/operations/policy_operations.py | 8 +- ...perations.py => price_sheet_operations.py} | 6 +- .../products_by_billing_account_operations.py | 109 --- ...cts_by_billing_subscriptions_operations.py | 102 --- .../products_by_invoice_section_operations.py | 104 --- .../billing/operations/products_operations.py | 284 ++++++- ...nsactions_by_billing_account_operations.py | 116 --- ...nsactions_by_billing_profile_operations.py | 111 --- ...nsactions_by_invoice_section_operations.py | 111 --- .../operations/transactions_operations.py | 264 ++++++ .../operations/transfers_operations.py | 4 +- 39 files changed, 2154 insertions(+), 2994 deletions(-) rename azure-mgmt-billing/azure/mgmt/billing/operations/{available_balance_by_billing_profile_operations.py => available_balance_operations.py} (91%) delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/billing_account_billing_permissions_operations.py rename azure-mgmt-billing/azure/mgmt/billing/operations/{billing_account_billing_role_definition_operations.py => billing_permissions_operations.py} (77%) delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_role_definition_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/billing_profiles_by_billing_account_name_operations.py create mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_assignment_operations.py rename azure-mgmt-billing/azure/mgmt/billing/operations/{billing_profile_billing_role_assignment_operations.py => billing_role_definition_operations.py} (50%) delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscription_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_by_billing_profile_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_by_invoice_section_operations.py rename azure-mgmt-billing/azure/mgmt/billing/operations/{invoice_section_billing_role_assignment_operations.py => billing_subscriptions_operations.py} (53%) delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/departments_by_billing_account_name_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_by_billing_account_name_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/invoice_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/invoice_section_billing_role_definition_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_billing_permissions_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_by_billing_account_name_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_with_create_subscription_permission_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/invoices_by_billing_account_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/invoices_by_billing_profile_operations.py rename azure-mgmt-billing/azure/mgmt/billing/operations/{billing_account_billing_role_assignment_operations.py => invoices_operations.py} (57%) rename azure-mgmt-billing/azure/mgmt/billing/operations/{payment_methods_by_billing_profile_operations.py => payment_methods_operations.py} (91%) rename azure-mgmt-billing/azure/mgmt/billing/operations/{invoice_pricesheet_operations.py => price_sheet_operations.py} (97%) delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/products_by_billing_account_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/products_by_billing_subscriptions_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/products_by_invoice_section_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_billing_account_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_billing_profile_operations.py delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_invoice_section_operations.py create mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/transactions_operations.py diff --git a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py index aafbc90ef229..258152117564 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py +++ b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py @@ -13,50 +13,27 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling -import uuid from .operations.billing_accounts_operations import BillingAccountsOperations -from .operations.available_balance_by_billing_profile_operations import AvailableBalanceByBillingProfileOperations -from .operations.payment_methods_by_billing_profile_operations import PaymentMethodsByBillingProfileOperations -from .operations.billing_profiles_by_billing_account_name_operations import BillingProfilesByBillingAccountNameOperations +from .operations.available_balance_operations import AvailableBalanceOperations +from .operations.payment_methods_operations import PaymentMethodsOperations from .operations.billing_profiles_operations import BillingProfilesOperations -from .operations.invoice_sections_by_billing_account_name_operations import InvoiceSectionsByBillingAccountNameOperations from .operations.invoice_sections_operations import InvoiceSectionsOperations -from .operations.invoice_sections_with_create_subscription_permission_operations import InvoiceSectionsWithCreateSubscriptionPermissionOperations -from .operations.departments_by_billing_account_name_operations import DepartmentsByBillingAccountNameOperations from .operations.departments_operations import DepartmentsOperations -from .operations.enrollment_accounts_by_billing_account_name_operations import EnrollmentAccountsByBillingAccountNameOperations from .operations.enrollment_accounts_operations import EnrollmentAccountsOperations -from .operations.invoices_by_billing_account_operations import InvoicesByBillingAccountOperations -from .operations.invoice_pricesheet_operations import InvoicePricesheetOperations -from .operations.invoices_by_billing_profile_operations import InvoicesByBillingProfileOperations -from .operations.invoice_operations import InvoiceOperations -from .operations.products_by_billing_subscriptions_operations import ProductsByBillingSubscriptionsOperations -from .operations.billing_subscriptions_by_billing_profile_operations import BillingSubscriptionsByBillingProfileOperations -from .operations.billing_subscriptions_by_invoice_section_operations import BillingSubscriptionsByInvoiceSectionOperations -from .operations.billing_subscription_operations import BillingSubscriptionOperations -from .operations.products_by_billing_account_operations import ProductsByBillingAccountOperations -from .operations.products_by_invoice_section_operations import ProductsByInvoiceSectionOperations +from .operations.invoices_operations import InvoicesOperations +from .operations.price_sheet_operations import PriceSheetOperations +from .operations.billing_subscriptions_operations import BillingSubscriptionsOperations from .operations.products_operations import ProductsOperations -from .operations.transactions_by_billing_account_operations import TransactionsByBillingAccountOperations -from .operations.transactions_by_billing_profile_operations import TransactionsByBillingProfileOperations -from .operations.transactions_by_invoice_section_operations import TransactionsByInvoiceSectionOperations +from .operations.transactions_operations import TransactionsOperations from .operations.policy_operations import PolicyOperations from .operations.billing_property_operations import BillingPropertyOperations from .operations.transfers_operations import TransfersOperations from .operations.recipient_transfers_operations import RecipientTransfersOperations from .operations.operations import Operations -from .operations.billing_account_billing_permissions_operations import BillingAccountBillingPermissionsOperations -from .operations.invoice_sections_billing_permissions_operations import InvoiceSectionsBillingPermissionsOperations +from .operations.billing_permissions_operations import BillingPermissionsOperations from .operations.billing_profile_billing_permissions_operations import BillingProfileBillingPermissionsOperations -from .operations.billing_account_billing_role_definition_operations import BillingAccountBillingRoleDefinitionOperations -from .operations.invoice_section_billing_role_definition_operations import InvoiceSectionBillingRoleDefinitionOperations -from .operations.billing_profile_billing_role_definition_operations import BillingProfileBillingRoleDefinitionOperations -from .operations.billing_account_billing_role_assignment_operations import BillingAccountBillingRoleAssignmentOperations -from .operations.invoice_section_billing_role_assignment_operations import InvoiceSectionBillingRoleAssignmentOperations -from .operations.billing_profile_billing_role_assignment_operations import BillingProfileBillingRoleAssignmentOperations +from .operations.billing_role_definition_operations import BillingRoleDefinitionOperations +from .operations.billing_role_assignment_operations import BillingRoleAssignmentOperations from .operations.agreements_operations import AgreementsOperations from . import models @@ -101,56 +78,28 @@ class BillingManagementClient(SDKClient): :ivar billing_accounts: BillingAccounts operations :vartype billing_accounts: azure.mgmt.billing.operations.BillingAccountsOperations - :ivar available_balance_by_billing_profile: AvailableBalanceByBillingProfile operations - :vartype available_balance_by_billing_profile: azure.mgmt.billing.operations.AvailableBalanceByBillingProfileOperations - :ivar payment_methods_by_billing_profile: PaymentMethodsByBillingProfile operations - :vartype payment_methods_by_billing_profile: azure.mgmt.billing.operations.PaymentMethodsByBillingProfileOperations - :ivar billing_profiles_by_billing_account_name: BillingProfilesByBillingAccountName operations - :vartype billing_profiles_by_billing_account_name: azure.mgmt.billing.operations.BillingProfilesByBillingAccountNameOperations + :ivar available_balance: AvailableBalance operations + :vartype available_balance: azure.mgmt.billing.operations.AvailableBalanceOperations + :ivar payment_methods: PaymentMethods operations + :vartype payment_methods: azure.mgmt.billing.operations.PaymentMethodsOperations :ivar billing_profiles: BillingProfiles operations :vartype billing_profiles: azure.mgmt.billing.operations.BillingProfilesOperations - :ivar invoice_sections_by_billing_account_name: InvoiceSectionsByBillingAccountName operations - :vartype invoice_sections_by_billing_account_name: azure.mgmt.billing.operations.InvoiceSectionsByBillingAccountNameOperations :ivar invoice_sections: InvoiceSections operations :vartype invoice_sections: azure.mgmt.billing.operations.InvoiceSectionsOperations - :ivar invoice_sections_with_create_subscription_permission: InvoiceSectionsWithCreateSubscriptionPermission operations - :vartype invoice_sections_with_create_subscription_permission: azure.mgmt.billing.operations.InvoiceSectionsWithCreateSubscriptionPermissionOperations - :ivar departments_by_billing_account_name: DepartmentsByBillingAccountName operations - :vartype departments_by_billing_account_name: azure.mgmt.billing.operations.DepartmentsByBillingAccountNameOperations :ivar departments: Departments operations :vartype departments: azure.mgmt.billing.operations.DepartmentsOperations - :ivar enrollment_accounts_by_billing_account_name: EnrollmentAccountsByBillingAccountName operations - :vartype enrollment_accounts_by_billing_account_name: azure.mgmt.billing.operations.EnrollmentAccountsByBillingAccountNameOperations :ivar enrollment_accounts: EnrollmentAccounts operations :vartype enrollment_accounts: azure.mgmt.billing.operations.EnrollmentAccountsOperations - :ivar invoices_by_billing_account: InvoicesByBillingAccount operations - :vartype invoices_by_billing_account: azure.mgmt.billing.operations.InvoicesByBillingAccountOperations - :ivar invoice_pricesheet: InvoicePricesheet operations - :vartype invoice_pricesheet: azure.mgmt.billing.operations.InvoicePricesheetOperations - :ivar invoices_by_billing_profile: InvoicesByBillingProfile operations - :vartype invoices_by_billing_profile: azure.mgmt.billing.operations.InvoicesByBillingProfileOperations - :ivar invoice: Invoice operations - :vartype invoice: azure.mgmt.billing.operations.InvoiceOperations - :ivar products_by_billing_subscriptions: ProductsByBillingSubscriptions operations - :vartype products_by_billing_subscriptions: azure.mgmt.billing.operations.ProductsByBillingSubscriptionsOperations - :ivar billing_subscriptions_by_billing_profile: BillingSubscriptionsByBillingProfile operations - :vartype billing_subscriptions_by_billing_profile: azure.mgmt.billing.operations.BillingSubscriptionsByBillingProfileOperations - :ivar billing_subscriptions_by_invoice_section: BillingSubscriptionsByInvoiceSection operations - :vartype billing_subscriptions_by_invoice_section: azure.mgmt.billing.operations.BillingSubscriptionsByInvoiceSectionOperations - :ivar billing_subscription: BillingSubscription operations - :vartype billing_subscription: azure.mgmt.billing.operations.BillingSubscriptionOperations - :ivar products_by_billing_account: ProductsByBillingAccount operations - :vartype products_by_billing_account: azure.mgmt.billing.operations.ProductsByBillingAccountOperations - :ivar products_by_invoice_section: ProductsByInvoiceSection operations - :vartype products_by_invoice_section: azure.mgmt.billing.operations.ProductsByInvoiceSectionOperations + :ivar invoices: Invoices operations + :vartype invoices: azure.mgmt.billing.operations.InvoicesOperations + :ivar price_sheet: PriceSheet operations + :vartype price_sheet: azure.mgmt.billing.operations.PriceSheetOperations + :ivar billing_subscriptions: BillingSubscriptions operations + :vartype billing_subscriptions: azure.mgmt.billing.operations.BillingSubscriptionsOperations :ivar products: Products operations :vartype products: azure.mgmt.billing.operations.ProductsOperations - :ivar transactions_by_billing_account: TransactionsByBillingAccount operations - :vartype transactions_by_billing_account: azure.mgmt.billing.operations.TransactionsByBillingAccountOperations - :ivar transactions_by_billing_profile: TransactionsByBillingProfile operations - :vartype transactions_by_billing_profile: azure.mgmt.billing.operations.TransactionsByBillingProfileOperations - :ivar transactions_by_invoice_section: TransactionsByInvoiceSection operations - :vartype transactions_by_invoice_section: azure.mgmt.billing.operations.TransactionsByInvoiceSectionOperations + :ivar transactions: Transactions operations + :vartype transactions: azure.mgmt.billing.operations.TransactionsOperations :ivar policy: Policy operations :vartype policy: azure.mgmt.billing.operations.PolicyOperations :ivar billing_property: BillingProperty operations @@ -161,24 +110,14 @@ class BillingManagementClient(SDKClient): :vartype recipient_transfers: azure.mgmt.billing.operations.RecipientTransfersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.billing.operations.Operations - :ivar billing_account_billing_permissions: BillingAccountBillingPermissions operations - :vartype billing_account_billing_permissions: azure.mgmt.billing.operations.BillingAccountBillingPermissionsOperations - :ivar invoice_sections_billing_permissions: InvoiceSectionsBillingPermissions operations - :vartype invoice_sections_billing_permissions: azure.mgmt.billing.operations.InvoiceSectionsBillingPermissionsOperations + :ivar billing_permissions: BillingPermissions operations + :vartype billing_permissions: azure.mgmt.billing.operations.BillingPermissionsOperations :ivar billing_profile_billing_permissions: BillingProfileBillingPermissions operations :vartype billing_profile_billing_permissions: azure.mgmt.billing.operations.BillingProfileBillingPermissionsOperations - :ivar billing_account_billing_role_definition: BillingAccountBillingRoleDefinition operations - :vartype billing_account_billing_role_definition: azure.mgmt.billing.operations.BillingAccountBillingRoleDefinitionOperations - :ivar invoice_section_billing_role_definition: InvoiceSectionBillingRoleDefinition operations - :vartype invoice_section_billing_role_definition: azure.mgmt.billing.operations.InvoiceSectionBillingRoleDefinitionOperations - :ivar billing_profile_billing_role_definition: BillingProfileBillingRoleDefinition operations - :vartype billing_profile_billing_role_definition: azure.mgmt.billing.operations.BillingProfileBillingRoleDefinitionOperations - :ivar billing_account_billing_role_assignment: BillingAccountBillingRoleAssignment operations - :vartype billing_account_billing_role_assignment: azure.mgmt.billing.operations.BillingAccountBillingRoleAssignmentOperations - :ivar invoice_section_billing_role_assignment: InvoiceSectionBillingRoleAssignment operations - :vartype invoice_section_billing_role_assignment: azure.mgmt.billing.operations.InvoiceSectionBillingRoleAssignmentOperations - :ivar billing_profile_billing_role_assignment: BillingProfileBillingRoleAssignment operations - :vartype billing_profile_billing_role_assignment: azure.mgmt.billing.operations.BillingProfileBillingRoleAssignmentOperations + :ivar billing_role_definition: BillingRoleDefinition operations + :vartype billing_role_definition: azure.mgmt.billing.operations.BillingRoleDefinitionOperations + :ivar billing_role_assignment: BillingRoleAssignment operations + :vartype billing_role_assignment: azure.mgmt.billing.operations.BillingRoleAssignmentOperations :ivar agreements: Agreements operations :vartype agreements: azure.mgmt.billing.operations.AgreementsOperations @@ -203,55 +142,27 @@ def __init__( self.billing_accounts = BillingAccountsOperations( self._client, self.config, self._serialize, self._deserialize) - self.available_balance_by_billing_profile = AvailableBalanceByBillingProfileOperations( + self.available_balance = AvailableBalanceOperations( self._client, self.config, self._serialize, self._deserialize) - self.payment_methods_by_billing_profile = PaymentMethodsByBillingProfileOperations( - self._client, self.config, self._serialize, self._deserialize) - self.billing_profiles_by_billing_account_name = BillingProfilesByBillingAccountNameOperations( + self.payment_methods = PaymentMethodsOperations( self._client, self.config, self._serialize, self._deserialize) self.billing_profiles = BillingProfilesOperations( self._client, self.config, self._serialize, self._deserialize) - self.invoice_sections_by_billing_account_name = InvoiceSectionsByBillingAccountNameOperations( - self._client, self.config, self._serialize, self._deserialize) self.invoice_sections = InvoiceSectionsOperations( self._client, self.config, self._serialize, self._deserialize) - self.invoice_sections_with_create_subscription_permission = InvoiceSectionsWithCreateSubscriptionPermissionOperations( - self._client, self.config, self._serialize, self._deserialize) - self.departments_by_billing_account_name = DepartmentsByBillingAccountNameOperations( - self._client, self.config, self._serialize, self._deserialize) self.departments = DepartmentsOperations( self._client, self.config, self._serialize, self._deserialize) - self.enrollment_accounts_by_billing_account_name = EnrollmentAccountsByBillingAccountNameOperations( - self._client, self.config, self._serialize, self._deserialize) self.enrollment_accounts = EnrollmentAccountsOperations( self._client, self.config, self._serialize, self._deserialize) - self.invoices_by_billing_account = InvoicesByBillingAccountOperations( - self._client, self.config, self._serialize, self._deserialize) - self.invoice_pricesheet = InvoicePricesheetOperations( - self._client, self.config, self._serialize, self._deserialize) - self.invoices_by_billing_profile = InvoicesByBillingProfileOperations( - self._client, self.config, self._serialize, self._deserialize) - self.invoice = InvoiceOperations( - self._client, self.config, self._serialize, self._deserialize) - self.products_by_billing_subscriptions = ProductsByBillingSubscriptionsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.billing_subscriptions_by_billing_profile = BillingSubscriptionsByBillingProfileOperations( - self._client, self.config, self._serialize, self._deserialize) - self.billing_subscriptions_by_invoice_section = BillingSubscriptionsByInvoiceSectionOperations( + self.invoices = InvoicesOperations( self._client, self.config, self._serialize, self._deserialize) - self.billing_subscription = BillingSubscriptionOperations( + self.price_sheet = PriceSheetOperations( self._client, self.config, self._serialize, self._deserialize) - self.products_by_billing_account = ProductsByBillingAccountOperations( - self._client, self.config, self._serialize, self._deserialize) - self.products_by_invoice_section = ProductsByInvoiceSectionOperations( + self.billing_subscriptions = BillingSubscriptionsOperations( self._client, self.config, self._serialize, self._deserialize) self.products = ProductsOperations( self._client, self.config, self._serialize, self._deserialize) - self.transactions_by_billing_account = TransactionsByBillingAccountOperations( - self._client, self.config, self._serialize, self._deserialize) - self.transactions_by_billing_profile = TransactionsByBillingProfileOperations( - self._client, self.config, self._serialize, self._deserialize) - self.transactions_by_invoice_section = TransactionsByInvoiceSectionOperations( + self.transactions = TransactionsOperations( self._client, self.config, self._serialize, self._deserialize) self.policy = PolicyOperations( self._client, self.config, self._serialize, self._deserialize) @@ -263,166 +174,13 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) - self.billing_account_billing_permissions = BillingAccountBillingPermissionsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.invoice_sections_billing_permissions = InvoiceSectionsBillingPermissionsOperations( + self.billing_permissions = BillingPermissionsOperations( self._client, self.config, self._serialize, self._deserialize) self.billing_profile_billing_permissions = BillingProfileBillingPermissionsOperations( self._client, self.config, self._serialize, self._deserialize) - self.billing_account_billing_role_definition = BillingAccountBillingRoleDefinitionOperations( - self._client, self.config, self._serialize, self._deserialize) - self.invoice_section_billing_role_definition = InvoiceSectionBillingRoleDefinitionOperations( - self._client, self.config, self._serialize, self._deserialize) - self.billing_profile_billing_role_definition = BillingProfileBillingRoleDefinitionOperations( + self.billing_role_definition = BillingRoleDefinitionOperations( self._client, self.config, self._serialize, self._deserialize) - self.billing_account_billing_role_assignment = BillingAccountBillingRoleAssignmentOperations( - self._client, self.config, self._serialize, self._deserialize) - self.invoice_section_billing_role_assignment = InvoiceSectionBillingRoleAssignmentOperations( - self._client, self.config, self._serialize, self._deserialize) - self.billing_profile_billing_role_assignment = BillingProfileBillingRoleAssignmentOperations( + self.billing_role_assignment = BillingRoleAssignmentOperations( self._client, self.config, self._serialize, self._deserialize) self.agreements = AgreementsOperations( self._client, self.config, self._serialize, self._deserialize) - - def update_auto_renew_for_billing_account( - self, billing_account_name, product_name, auto_renew=None, custom_headers=None, raw=False, **operation_config): - """Cancel product by product id. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param product_name: Invoice Id. - :type product_name: str - :param auto_renew: Request parameters to update auto renew policy a - product. Possible values include: 'true', 'false' - :type auto_renew: str or ~azure.mgmt.billing.models.UpdateAutoRenew - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: UpdateAutoRenewOperationSummary or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.UpdateAutoRenewOperationSummary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - body = models.UpdateAutoRenewRequest(auto_renew=auto_renew) - - # Construct URL - url = self.update_auto_renew_for_billing_account.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(body, 'UpdateAutoRenewRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('UpdateAutoRenewOperationSummary', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update_auto_renew_for_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/updateAutoRenew'} - - def update_auto_renew_for_invoice_section( - self, billing_account_name, invoice_section_name, product_name, auto_renew=None, custom_headers=None, raw=False, **operation_config): - """Cancel auto renew for product by product id. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :type invoice_section_name: str - :param product_name: Invoice Id. - :type product_name: str - :param auto_renew: Request parameters to update auto renew policy a - product. Possible values include: 'true', 'false' - :type auto_renew: str or ~azure.mgmt.billing.models.UpdateAutoRenew - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: UpdateAutoRenewOperationSummary or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.UpdateAutoRenewOperationSummary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - body = models.UpdateAutoRenewRequest(auto_renew=auto_renew) - - # Construct URL - url = self.update_auto_renew_for_invoice_section.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), - 'productName': self._serialize.url("product_name", product_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(body, 'UpdateAutoRenewRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('UpdateAutoRenewOperationSummary', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update_auto_renew_for_invoice_section.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py index 03590866e10e..8a6f50e6a242 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py @@ -10,87 +10,49 @@ # -------------------------------------------------------------------------- from .billing_accounts_operations import BillingAccountsOperations -from .available_balance_by_billing_profile_operations import AvailableBalanceByBillingProfileOperations -from .payment_methods_by_billing_profile_operations import PaymentMethodsByBillingProfileOperations -from .billing_profiles_by_billing_account_name_operations import BillingProfilesByBillingAccountNameOperations +from .available_balance_operations import AvailableBalanceOperations +from .payment_methods_operations import PaymentMethodsOperations from .billing_profiles_operations import BillingProfilesOperations -from .invoice_sections_by_billing_account_name_operations import InvoiceSectionsByBillingAccountNameOperations from .invoice_sections_operations import InvoiceSectionsOperations -from .invoice_sections_with_create_subscription_permission_operations import InvoiceSectionsWithCreateSubscriptionPermissionOperations -from .departments_by_billing_account_name_operations import DepartmentsByBillingAccountNameOperations from .departments_operations import DepartmentsOperations -from .enrollment_accounts_by_billing_account_name_operations import EnrollmentAccountsByBillingAccountNameOperations from .enrollment_accounts_operations import EnrollmentAccountsOperations -from .invoices_by_billing_account_operations import InvoicesByBillingAccountOperations -from .invoice_pricesheet_operations import InvoicePricesheetOperations -from .invoices_by_billing_profile_operations import InvoicesByBillingProfileOperations -from .invoice_operations import InvoiceOperations -from .products_by_billing_subscriptions_operations import ProductsByBillingSubscriptionsOperations -from .billing_subscriptions_by_billing_profile_operations import BillingSubscriptionsByBillingProfileOperations -from .billing_subscriptions_by_invoice_section_operations import BillingSubscriptionsByInvoiceSectionOperations -from .billing_subscription_operations import BillingSubscriptionOperations -from .products_by_billing_account_operations import ProductsByBillingAccountOperations -from .products_by_invoice_section_operations import ProductsByInvoiceSectionOperations +from .invoices_operations import InvoicesOperations +from .price_sheet_operations import PriceSheetOperations +from .billing_subscriptions_operations import BillingSubscriptionsOperations from .products_operations import ProductsOperations -from .transactions_by_billing_account_operations import TransactionsByBillingAccountOperations -from .transactions_by_billing_profile_operations import TransactionsByBillingProfileOperations -from .transactions_by_invoice_section_operations import TransactionsByInvoiceSectionOperations +from .transactions_operations import TransactionsOperations from .policy_operations import PolicyOperations from .billing_property_operations import BillingPropertyOperations from .transfers_operations import TransfersOperations from .recipient_transfers_operations import RecipientTransfersOperations from .operations import Operations -from .billing_account_billing_permissions_operations import BillingAccountBillingPermissionsOperations -from .invoice_sections_billing_permissions_operations import InvoiceSectionsBillingPermissionsOperations +from .billing_permissions_operations import BillingPermissionsOperations from .billing_profile_billing_permissions_operations import BillingProfileBillingPermissionsOperations -from .billing_account_billing_role_definition_operations import BillingAccountBillingRoleDefinitionOperations -from .invoice_section_billing_role_definition_operations import InvoiceSectionBillingRoleDefinitionOperations -from .billing_profile_billing_role_definition_operations import BillingProfileBillingRoleDefinitionOperations -from .billing_account_billing_role_assignment_operations import BillingAccountBillingRoleAssignmentOperations -from .invoice_section_billing_role_assignment_operations import InvoiceSectionBillingRoleAssignmentOperations -from .billing_profile_billing_role_assignment_operations import BillingProfileBillingRoleAssignmentOperations +from .billing_role_definition_operations import BillingRoleDefinitionOperations +from .billing_role_assignment_operations import BillingRoleAssignmentOperations from .agreements_operations import AgreementsOperations __all__ = [ 'BillingAccountsOperations', - 'AvailableBalanceByBillingProfileOperations', - 'PaymentMethodsByBillingProfileOperations', - 'BillingProfilesByBillingAccountNameOperations', + 'AvailableBalanceOperations', + 'PaymentMethodsOperations', 'BillingProfilesOperations', - 'InvoiceSectionsByBillingAccountNameOperations', 'InvoiceSectionsOperations', - 'InvoiceSectionsWithCreateSubscriptionPermissionOperations', - 'DepartmentsByBillingAccountNameOperations', 'DepartmentsOperations', - 'EnrollmentAccountsByBillingAccountNameOperations', 'EnrollmentAccountsOperations', - 'InvoicesByBillingAccountOperations', - 'InvoicePricesheetOperations', - 'InvoicesByBillingProfileOperations', - 'InvoiceOperations', - 'ProductsByBillingSubscriptionsOperations', - 'BillingSubscriptionsByBillingProfileOperations', - 'BillingSubscriptionsByInvoiceSectionOperations', - 'BillingSubscriptionOperations', - 'ProductsByBillingAccountOperations', - 'ProductsByInvoiceSectionOperations', + 'InvoicesOperations', + 'PriceSheetOperations', + 'BillingSubscriptionsOperations', 'ProductsOperations', - 'TransactionsByBillingAccountOperations', - 'TransactionsByBillingProfileOperations', - 'TransactionsByInvoiceSectionOperations', + 'TransactionsOperations', 'PolicyOperations', 'BillingPropertyOperations', 'TransfersOperations', 'RecipientTransfersOperations', 'Operations', - 'BillingAccountBillingPermissionsOperations', - 'InvoiceSectionsBillingPermissionsOperations', + 'BillingPermissionsOperations', 'BillingProfileBillingPermissionsOperations', - 'BillingAccountBillingRoleDefinitionOperations', - 'InvoiceSectionBillingRoleDefinitionOperations', - 'BillingProfileBillingRoleDefinitionOperations', - 'BillingAccountBillingRoleAssignmentOperations', - 'InvoiceSectionBillingRoleAssignmentOperations', - 'BillingProfileBillingRoleAssignmentOperations', + 'BillingRoleDefinitionOperations', + 'BillingRoleAssignmentOperations', 'AgreementsOperations', ] diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/available_balance_by_billing_profile_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/available_balance_operations.py similarity index 91% rename from azure-mgmt-billing/azure/mgmt/billing/operations/available_balance_by_billing_profile_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/available_balance_operations.py index f4d743d0317a..15d52bc69b24 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/available_balance_by_billing_profile_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/available_balance_operations.py @@ -15,8 +15,8 @@ from .. import models -class AvailableBalanceByBillingProfileOperations(object): - """AvailableBalanceByBillingProfileOperations operations. +class AvailableBalanceOperations(object): + """AvailableBalanceOperations operations. :param client: Client for service requests. :param config: Configuration of service client. @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def get( + def get_by_billing_profile( self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): """The latest available credit balance for a given billingAccountName and billingProfileName. @@ -57,7 +57,7 @@ def get( :class:`ErrorResponseException` """ # Construct URL - url = self.get.metadata['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') @@ -95,4 +95,4 @@ def get( return client_raw_response return deserialized - get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default'} + get_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_account_billing_permissions_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_account_billing_permissions_operations.py deleted file mode 100644 index 5424cc0e51cc..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_account_billing_permissions_operations.py +++ /dev/null @@ -1,94 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class BillingAccountBillingPermissionsOperations(object): - """BillingAccountBillingPermissionsOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, custom_headers=None, raw=False, **operation_config): - """Lists all billingPermissions for the caller has for a billing account. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BillingPermissionsListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingPermissionsListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BillingPermissionsListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingPermissions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_account_billing_role_definition_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_permissions_operations.py similarity index 77% rename from azure-mgmt-billing/azure/mgmt/billing/operations/billing_account_billing_role_definition_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/billing_permissions_operations.py index ec6ddf02ab4f..2a41c99fb81e 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_account_billing_role_definition_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_permissions_operations.py @@ -15,8 +15,8 @@ from .. import models -class BillingAccountBillingRoleDefinitionOperations(object): - """BillingAccountBillingRoleDefinitionOperations operations. +class BillingPermissionsOperations(object): + """BillingPermissionsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. @@ -36,30 +36,27 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def get( - self, billing_account_name, billing_role_definition_name, custom_headers=None, raw=False, **operation_config): - """Gets the role definition for a role. + def list_by_billing_account( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Lists all billing permissions for the caller under a billing account. :param billing_account_name: billing Account Id. :type billing_account_name: str - :param billing_role_definition_name: role definition id. - :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 + :return: BillingPermissionsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingPermissionsListResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.get.metadata['url'] + url = self.list_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') + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -87,37 +84,39 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleDefinition', response) + deserialized = self._deserialize('BillingPermissionsListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}'} + list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingPermissions'} - def list( - self, billing_account_name, custom_headers=None, raw=False, **operation_config): - """Lists the role definition for a billing account. + def list_by_invoice_sections( + self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Lists all billing permissions for the caller under Invoice Section. :param billing_account_name: billing Account Id. :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: BillingRoleDefinitionListResult or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleDefinitionListResult or + :return: BillingPermissionsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingPermissionsListResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list.metadata['url'] + url = self.list_by_invoice_sections.metadata['url'] path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -145,11 +144,11 @@ def list( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleDefinitionListResult', response) + deserialized = self._deserialize('BillingPermissionsListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions'} + list_by_invoice_sections.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingPermissions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_role_definition_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_role_definition_operations.py deleted file mode 100644 index 9489c03d4247..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_role_definition_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class BillingProfileBillingRoleDefinitionOperations(object): - """BillingProfileBillingRoleDefinitionOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def get( - self, billing_account_name, billing_profile_name, billing_role_definition_name, custom_headers=None, raw=False, **operation_config): - """Gets the role definition for a role. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param billing_profile_name: Billing Profile Id. - :type billing_profile_name: str - :param billing_role_definition_name: role definition id. - :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.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.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}'} - - def list( - self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): - """Lists the role definition for a Billing Profile. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param billing_profile_name: Billing Profile Id. - :type billing_profile_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BillingRoleDefinitionListResult or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleDefinitionListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BillingRoleDefinitionListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profiles_by_billing_account_name_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profiles_by_billing_account_name_operations.py deleted file mode 100644 index c5b107bebdf5..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profiles_by_billing_account_name_operations.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class BillingProfilesByBillingAccountNameOperations(object): - """BillingProfilesByBillingAccountNameOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Lists all billing profiles for a user which that user has access to. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param expand: May be used to expand the invoiceSections. - :type expand: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BillingProfileListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingProfileListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BillingProfileListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profiles_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profiles_operations.py index 023bd234b1ed..d98add3bbe9f 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profiles_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profiles_operations.py @@ -38,6 +38,67 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def list_by_billing_account_name( + self, billing_account_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Lists all billing profiles for a user which that user has access to. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param expand: May be used to expand the invoiceSections. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingProfileListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingProfileListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BillingProfileListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account_name.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): """Get the billing profile by id. diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_assignment_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_assignment_operations.py new file mode 100644 index 000000000000..df24ea93977f --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_assignment_operations.py @@ -0,0 +1,787 @@ +# 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 BillingRoleAssignmentOperations(object): + """BillingRoleAssignmentOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-11-01-preview" + + self.config = config + + def get_by_billing_account( + self, billing_account_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Get the role assignment for the caller. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param billing_role_assignment_name: role assignment id. + :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}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + + def delete_by_billing_account_name( + self, billing_account_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Delete the role assignment on this billing account. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param billing_role_assignment_name: role assignment id. + :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_name.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_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + + def get_by_invoice_section_name( + self, billing_account_name, invoice_section_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Get the role assignment for the caller on the invoice Section. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param billing_role_assignment_name: role assignment id. + :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_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + '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_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + + def delete_by_invoice_section_name( + self, billing_account_name, invoice_section_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Delete the role assignment on the invoice Section. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param billing_role_assignment_name: role assignment id. + :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_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + '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_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + + def get_by_billing_profile_name( + self, billing_account_name, billing_profile_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Get the role assignment for the caller on the Billing Profile. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param billing_profile_name: Billing Profile Id. + :type billing_profile_name: str + :param billing_role_assignment_name: role assignment id. + :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_name.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_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + + def delete_by_billing_profile_name( + self, billing_account_name, billing_profile_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Delete the role assignment on this Billing Profile. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param billing_profile_name: Billing Profile Id. + :type billing_profile_name: str + :param billing_role_assignment_name: role assignment id. + :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_name.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_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + + def list_by_billing_account_name( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Get the role assignments on the Billing Account. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments'} + + def add_by_billing_account_name( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """The operation to add a role assignment to a billing account. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = None + + # Construct URL + url = self.add_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'BillingRoleAssignmentPayload') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/createBillingRoleAssignment'} + + def list_by_invoice_section_name( + self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Get the role assignments on the invoice Section. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_invoice_section_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_invoice_section_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments'} + + def add_by_invoice_section_name( + self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """The operation to add a role assignment to a invoice Section. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = None + + # Construct URL + url = self.add_by_invoice_section_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'BillingRoleAssignmentPayload') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_by_invoice_section_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/createBillingRoleAssignment'} + + def list_by_billing_profile_name( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Get the role assignments on the Billing Profile. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param billing_profile_name: Billing Profile Id. + :type billing_profile_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_profile_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_profile_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments'} + + def add_by_billing_profile_name( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """The operation to add a role assignment to a billing profile. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param billing_profile_name: Billing Profile Id. + :type billing_profile_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingRoleAssignmentListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = None + + # Construct URL + url = self.add_by_billing_profile_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'BillingRoleAssignmentPayload') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_by_billing_profile_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/createBillingRoleAssignment'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_role_assignment_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_definition_operations.py similarity index 50% rename from azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_role_assignment_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_definition_operations.py index eec018f7a41c..074a6e8be9be 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_role_assignment_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_definition_operations.py @@ -15,8 +15,8 @@ from .. import models -class BillingProfileBillingRoleAssignmentOperations(object): - """BillingProfileBillingRoleAssignmentOperations operations. +class BillingRoleDefinitionOperations(object): + """BillingRoleDefinitionOperations operations. :param client: Client for service requests. :param config: Configuration of service client. @@ -36,33 +36,93 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def get( - self, billing_account_name, billing_profile_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): - """Get the role assignment for the caller on the Billing Profile. + def get_by_billing_account_name( + self, billing_account_name, billing_role_definition_name, custom_headers=None, raw=False, **operation_config): + """Gets the role definition for a role. :param billing_account_name: billing Account Id. :type billing_account_name: str - :param billing_profile_name: Billing Profile Id. - :type billing_profile_name: str - :param billing_role_assignment_name: role assignment id. - :type billing_role_assignment_name: str + :param billing_role_definition_name: role definition id. + :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: BillingRoleAssignment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleAssignment or + :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.metadata['url'] + url = self.get_by_billing_account_name.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') + '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_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}'} + + def get_by_invoice_section_name( + self, billing_account_name, invoice_section_name, billing_role_definition_name, custom_headers=None, raw=False, **operation_config): + """Gets the role definition for a role. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param billing_role_definition_name: role definition id. + :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_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'billingRoleDefinitionName': self._serialize.url("billing_role_definition_name", billing_role_definition_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -90,42 +150,42 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleAssignment', response) + deserialized = self._deserialize('BillingRoleDefinition', 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}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + get_by_invoice_section_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}'} - def delete( - self, billing_account_name, billing_profile_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): - """Delete the role assignment on this Billing Profile. + def get_by_billing_profile_name( + self, billing_account_name, billing_profile_name, billing_role_definition_name, custom_headers=None, raw=False, **operation_config): + """Gets the role definition for a role. :param billing_account_name: billing Account Id. :type billing_account_name: str :param billing_profile_name: Billing Profile Id. :type billing_profile_name: str - :param billing_role_assignment_name: role assignment id. - :type billing_role_assignment_name: str + :param billing_role_definition_name: role definition id. + :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: BillingRoleAssignment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleAssignment or + :return: BillingRoleDefinition or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleDefinition or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.delete.metadata['url'] + url = self.get_by_billing_profile_name.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') + 'billingRoleDefinitionName': self._serialize.url("billing_role_definition_name", billing_role_definition_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -144,7 +204,7 @@ def delete( 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) + 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]: @@ -153,40 +213,98 @@ def delete( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleAssignment', response) + deserialized = self._deserialize('BillingRoleDefinition', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - delete.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + get_by_billing_profile_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}'} - def list( - self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): - """Get the role assignments on the Billing Profile. + def list_by_billing_account_name( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Lists the role definition for a billing account. :param billing_account_name: billing Account Id. :type billing_account_name: str - :param billing_profile_name: Billing Profile Id. - :type billing_profile_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: BillingRoleAssignmentListResult or ClientRawResponse if + :return: BillingRoleDefinitionListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + :rtype: ~azure.mgmt.billing.models.BillingRoleDefinitionListResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list.metadata['url'] + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BillingRoleDefinitionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions'} + + def list_by_invoice_section_name( + self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Lists the role definition for an invoice Section. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingRoleDefinitionListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingRoleDefinitionListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_invoice_section_name.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) @@ -214,18 +332,18 @@ def list( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + deserialized = self._deserialize('BillingRoleDefinitionListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments'} + list_by_invoice_section_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions'} - def add( + def list_by_billing_profile_name( self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): - """The operation to add a role assignment to a billing profile. + """Lists the role definition for a Billing Profile. :param billing_account_name: billing Account Id. :type billing_account_name: str @@ -236,17 +354,15 @@ def add( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: BillingRoleAssignmentListResult or ClientRawResponse if + :return: BillingRoleDefinitionListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + :rtype: ~azure.mgmt.billing.models.BillingRoleDefinitionListResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - parameters = None - # Construct URL - url = self.add.metadata['url'] + url = self.list_by_billing_profile_name.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') @@ -260,7 +376,6 @@ def add( # 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: @@ -268,24 +383,21 @@ def add( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - # Construct body - body_content = self._serialize.body(parameters, 'BillingRoleAssignmentPayload') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [201]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + if response.status_code == 200: + deserialized = self._deserialize('BillingRoleDefinitionListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - add.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/createBillingRoleAssignment'} + list_by_billing_profile_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscription_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscription_operations.py deleted file mode 100644 index c33dae9080a6..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscription_operations.py +++ /dev/null @@ -1,221 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class BillingSubscriptionOperations(object): - """BillingSubscriptionOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def get( - self, billing_account_name, invoice_section_name, billing_subscription_name, custom_headers=None, raw=False, **operation_config): - """Get a single billing subscription by name. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :type invoice_section_name: str - :param billing_subscription_name: Billing Subscription Id. - :type billing_subscription_name: str - :param 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: BillingSubscriptionSummary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingSubscriptionSummary 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'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), - 'billingSubscriptionName': self._serialize.url("billing_subscription_name", billing_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BillingSubscriptionSummary', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}'} - - - def _transfer_initial( - self, billing_account_name, invoice_section_name, billing_subscription_name, destination_invoice_section_id=None, custom_headers=None, raw=False, **operation_config): - parameters = models.TransferBillingSubscriptionRequestProperties(destination_invoice_section_id=destination_invoice_section_id) - - # Construct URL - url = self.transfer.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), - 'billingSubscriptionName': self._serialize.url("billing_subscription_name", billing_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'TransferBillingSubscriptionRequestProperties') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - header_dict = {} - - if response.status_code == 200: - deserialized = self._deserialize('TransferBillingSubscriptionResult', response) - header_dict = { - 'Location': 'str', - 'Retry-After': 'int', - 'Azure-AsyncOperation': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - def transfer( - self, billing_account_name, invoice_section_name, billing_subscription_name, destination_invoice_section_id=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Transfers the GTM subscription from one invoice section to another - within a billing account. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :type invoice_section_name: str - :param billing_subscription_name: Billing Subscription Id. - :type billing_subscription_name: str - :param destination_invoice_section_id: The destination invoice section - id. - :type destination_invoice_section_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - TransferBillingSubscriptionResult or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.TransferBillingSubscriptionResult] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.TransferBillingSubscriptionResult]] - :raises: - :class:`ErrorResponseException` - """ - raw_result = self._transfer_initial( - billing_account_name=billing_account_name, - invoice_section_name=invoice_section_name, - billing_subscription_name=billing_subscription_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', - 'Azure-AsyncOperation': 'str', - } - deserialized = self._deserialize('TransferBillingSubscriptionResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - transfer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_by_billing_profile_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_by_billing_profile_operations.py deleted file mode 100644 index 36803e3ca700..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_by_billing_profile_operations.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class BillingSubscriptionsByBillingProfileOperations(object): - """BillingSubscriptionsByBillingProfileOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): - """Lists billing subscriptions by billingProfileName. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param billing_profile_name: Billing Profile Id. - :type billing_profile_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BillingSubscriptionsListResult or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.BillingSubscriptionsListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BillingSubscriptionsListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_by_invoice_section_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_by_invoice_section_operations.py deleted file mode 100644 index 55d6e5916929..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_by_invoice_section_operations.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class BillingSubscriptionsByInvoiceSectionOperations(object): - """BillingSubscriptionsByInvoiceSectionOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): - """Lists billing subscription by invoiceSectionName. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :type invoice_section_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BillingSubscriptionsListResult or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.BillingSubscriptionsListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BillingSubscriptionsListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_section_billing_role_assignment_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py similarity index 53% rename from azure-mgmt-billing/azure/mgmt/billing/operations/invoice_section_billing_role_assignment_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py index 2a836c469ae8..d20028c5ee8b 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_section_billing_role_assignment_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py @@ -11,12 +11,14 @@ import uuid from msrest.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models -class InvoiceSectionBillingRoleAssignmentOperations(object): - """InvoiceSectionBillingRoleAssignmentOperations operations. +class BillingSubscriptionsOperations(object): + """BillingSubscriptionsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. @@ -36,33 +38,96 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def get( - self, billing_account_name, invoice_section_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): - """Get the role assignment for the caller on the invoice Section. + def list_by_billing_account_name( + self, billing_account_name, custom_headers=None, raw=False, **operation_config): + """Lists billing subscriptions by billing account name. :param billing_account_name: billing Account Id. :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :type invoice_section_name: str - :param billing_role_assignment_name: role assignment id. - :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 + :return: An iterator like instance of BillingSubscriptionSummary + :rtype: + ~azure.mgmt.billing.models.BillingSubscriptionSummaryPaged[~azure.mgmt.billing.models.BillingSubscriptionSummary] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + 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) + 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 + deserialized = models.BillingSubscriptionSummaryPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.BillingSubscriptionSummaryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions'} + + def list_by_billing_profile_name( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Lists billing subscriptions by billing profile name. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param billing_profile_name: Billing Profile Id. + :type billing_profile_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingSubscriptionsListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingSubscriptionsListResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.get.metadata['url'] + url = self.list_by_billing_profile_name.metadata['url'] path_format_arguments = { 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), - 'billingRoleAssignmentName': self._serialize.url("billing_role_assignment_name", billing_role_assignment_name, 'str') + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -90,42 +155,40 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleAssignment', response) + deserialized = self._deserialize('BillingSubscriptionsListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + list_by_billing_profile_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions'} - def delete( - self, billing_account_name, invoice_section_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): - """Delete the role assignment on this invoice Section. + def list_by_invoice_section_name( + self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): + """Lists billing subscription by invoice section name. :param billing_account_name: billing Account Id. :type billing_account_name: str :param invoice_section_name: InvoiceSection Id. :type invoice_section_name: str - :param billing_role_assignment_name: role assignment id. - :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 + :return: BillingSubscriptionsListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.BillingSubscriptionsListResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.delete.metadata['url'] + url = self.list_by_invoice_section_name.metadata['url'] path_format_arguments = { 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), - 'billingRoleAssignmentName': self._serialize.url("billing_role_assignment_name", billing_role_assignment_name, 'str') + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -144,7 +207,7 @@ def delete( 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) + 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]: @@ -153,40 +216,42 @@ def delete( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleAssignment', response) + deserialized = self._deserialize('BillingSubscriptionsListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - delete.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + list_by_invoice_section_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions'} - def list( - self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): - """Get the role assignments on the invoice Section. + def get( + self, billing_account_name, invoice_section_name, billing_subscription_name, custom_headers=None, raw=False, **operation_config): + """Get a single billing subscription by name. :param billing_account_name: billing Account Id. :type billing_account_name: str :param invoice_section_name: InvoiceSection Id. :type invoice_section_name: str + :param billing_subscription_name: Billing Subscription Id. + :type billing_subscription_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: BillingRoleAssignmentListResult or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + :return: BillingSubscriptionSummary or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingSubscriptionSummary or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list.metadata['url'] + url = self.get.metadata['url'] path_format_arguments = { 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'billingSubscriptionName': self._serialize.url("billing_subscription_name", billing_subscription_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -214,48 +279,31 @@ def list( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + deserialized = self._deserialize('BillingSubscriptionSummary', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments'} + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}'} - def add( - self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): - """The operation to add a role assignment to a invoice Section. - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :type invoice_section_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BillingRoleAssignmentListResult or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - parameters = None + def _transfer_initial( + self, billing_account_name, invoice_section_name, billing_subscription_name, destination_invoice_section_id=None, custom_headers=None, raw=False, **operation_config): + parameters = models.TransferBillingSubscriptionRequestProperties(destination_invoice_section_id=destination_invoice_section_id) # Construct URL - url = self.add.metadata['url'] + url = self.transfer.metadata['url'] path_format_arguments = { 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'billingSubscriptionName': self._serialize.url("billing_subscription_name", billing_subscription_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -269,23 +317,92 @@ def add( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'BillingRoleAssignmentPayload') + 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 [201]: + if response.status_code not in [200, 202]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None + header_dict = {} - if response.status_code == 201: - deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + if response.status_code == 200: + deserialized = self._deserialize('TransferBillingSubscriptionResult', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + 'Azure-AsyncOperation': 'str', + } if raw: client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) return client_raw_response return deserialized - add.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/createBillingRoleAssignment'} + + def transfer( + self, billing_account_name, invoice_section_name, billing_subscription_name, destination_invoice_section_id=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Transfers the modern subscription from one invoice section to another + within a billing account. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param billing_subscription_name: Billing Subscription Id. + :type billing_subscription_name: str + :param destination_invoice_section_id: The destination invoice section + id. + :type destination_invoice_section_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + TransferBillingSubscriptionResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.TransferBillingSubscriptionResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.TransferBillingSubscriptionResult]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._transfer_initial( + billing_account_name=billing_account_name, + invoice_section_name=invoice_section_name, + billing_subscription_name=billing_subscription_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', + 'Azure-AsyncOperation': 'str', + } + deserialized = self._deserialize('TransferBillingSubscriptionResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + transfer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/departments_by_billing_account_name_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/departments_by_billing_account_name_operations.py deleted file mode 100644 index 172983a0c965..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/departments_by_billing_account_name_operations.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class DepartmentsByBillingAccountNameOperations(object): - """DepartmentsByBillingAccountNameOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists all departments for a user which he has access to. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param expand: May be used to expand the enrollmentAccounts. - :type expand: str - :param filter: 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 is separated by a colon - (:). - :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DepartmentListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.DepartmentListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('DepartmentListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/departments_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/departments_operations.py index d455356b1845..dd5044ad7ef5 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/departments_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/departments_operations.py @@ -36,6 +36,74 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def list_by_billing_account_name( + self, billing_account_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists all departments for a user which he has access to. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param expand: May be used to expand the enrollmentAccounts. + :type expand: str + :param filter: 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 is separated by a colon + (:). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DepartmentListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.DepartmentListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DepartmentListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments'} + def get( self, billing_account_name, department_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): """Get the department by id. diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_by_billing_account_name_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_by_billing_account_name_operations.py deleted file mode 100644 index 768b8cf0bfdb..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_by_billing_account_name_operations.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class EnrollmentAccountsByBillingAccountNameOperations(object): - """EnrollmentAccountsByBillingAccountNameOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists all Enrollment Accounts for a user which he has access to. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param expand: May be used to expand the department. - :type expand: str - :param filter: 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 is separated by a colon - (:). - :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EnrollmentAccountListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.EnrollmentAccountListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EnrollmentAccountListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_operations.py index 3686d725dbb4..b996cb2b6890 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/enrollment_accounts_operations.py @@ -36,7 +36,75 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def get_by_enrollment_account_account_id( + def list_by_billing_account_name( + self, billing_account_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists all Enrollment Accounts for a user which he has access to. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param expand: May be used to expand the department. + :type expand: str + :param filter: 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 is separated by a colon + (:). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EnrollmentAccountListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.EnrollmentAccountListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('EnrollmentAccountListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts'} + + def get_by_enrollment_account_id( self, billing_account_name, enrollment_account_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): """Get the enrollment account by id. @@ -63,7 +131,7 @@ def get_by_enrollment_account_account_id( :class:`ErrorResponseException` """ # Construct URL - url = self.get_by_enrollment_account_account_id.metadata['url'] + url = self.get_by_enrollment_account_id.metadata['url'] path_format_arguments = { 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), 'enrollmentAccountName': self._serialize.url("enrollment_account_name", enrollment_account_name, 'str') @@ -105,4 +173,4 @@ def get_by_enrollment_account_account_id( return client_raw_response return deserialized - get_by_enrollment_account_account_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}'} + get_by_enrollment_account_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_operations.py deleted file mode 100644 index 8b8e32685d1c..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_operations.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class InvoiceOperations(object): - """InvoiceOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def get( - self, billing_account_name, billing_profile_name, invoice_name, custom_headers=None, raw=False, **operation_config): - """Get the invoice by id. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param billing_profile_name: Billing Profile Id. - :type billing_profile_name: str - :param invoice_name: Invoice Id. - :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: InvoiceSummary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.InvoiceSummary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), - 'invoiceName': self._serialize.url("invoice_name", invoice_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('InvoiceSummary', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_section_billing_role_definition_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_section_billing_role_definition_operations.py deleted file mode 100644 index e45824959e4b..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_section_billing_role_definition_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class InvoiceSectionBillingRoleDefinitionOperations(object): - """InvoiceSectionBillingRoleDefinitionOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def get( - self, billing_account_name, invoice_section_name, billing_role_definition_name, custom_headers=None, raw=False, **operation_config): - """Gets the role definition for a role. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :type invoice_section_name: str - :param billing_role_definition_name: role definition id. - :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.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), - '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.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}'} - - def list( - self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): - """Lists the role definition for a invoice Section. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :type invoice_section_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BillingRoleDefinitionListResult or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleDefinitionListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BillingRoleDefinitionListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_billing_permissions_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_billing_permissions_operations.py deleted file mode 100644 index 36a228cc651a..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_billing_permissions_operations.py +++ /dev/null @@ -1,97 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class InvoiceSectionsBillingPermissionsOperations(object): - """InvoiceSectionsBillingPermissionsOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): - """Lists all billingPermissions for the caller has for a Invoice Section. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :type invoice_section_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BillingPermissionsListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingPermissionsListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BillingPermissionsListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingPermissions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_by_billing_account_name_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_by_billing_account_name_operations.py deleted file mode 100644 index 3bf455e406f5..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_by_billing_account_name_operations.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class InvoiceSectionsByBillingAccountNameOperations(object): - """InvoiceSectionsByBillingAccountNameOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Lists all invoice sections for a user which he has access to. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param expand: May be used to expand the billingProfiles. - :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: InvoiceSectionListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.InvoiceSectionListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.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('InvoiceSectionListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_operations.py index 7d26df363c3b..ef9c355efe1c 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_operations.py @@ -38,6 +38,67 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def list_by_billing_account_name( + self, billing_account_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Lists all invoice sections for a user which he has access to. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param expand: May be used to expand the billingProfiles. + :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: InvoiceSectionListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.InvoiceSectionListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('InvoiceSectionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections'} + def _create_initial( self, billing_account_name, display_name=None, billing_profiles=None, custom_headers=None, raw=False, **operation_config): @@ -213,6 +274,68 @@ def list_by_billing_profile_name( return deserialized list_by_billing_profile_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections'} + def list_by_create_subscription_permission( + self, billing_account_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Lists all invoiceSections with create subscription permission for a + user. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param expand: May be used to expand the billingProfiles. + :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: InvoiceSectionListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.InvoiceSectionListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_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') + 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('InvoiceSectionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_create_subscription_permission.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission'} + def get( self, billing_account_name, invoice_section_name, expand=None, custom_headers=None, raw=False, **operation_config): """Get the InvoiceSection by id. diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_with_create_subscription_permission_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_with_create_subscription_permission_operations.py deleted file mode 100644 index 8cc6ce0f8bb7..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_sections_with_create_subscription_permission_operations.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class InvoiceSectionsWithCreateSubscriptionPermissionOperations(object): - """InvoiceSectionsWithCreateSubscriptionPermissionOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Lists all invoiceSections with create subscription permission for a - user. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param expand: May be used to expand the billingProfiles. - :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: InvoiceSectionListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.InvoiceSectionListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.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('InvoiceSectionListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_by_billing_account_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_by_billing_account_operations.py deleted file mode 100644 index ebe0c5541426..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_by_billing_account_operations.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class InvoicesByBillingAccountOperations(object): - """InvoicesByBillingAccountOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, period_start_date, period_end_date, custom_headers=None, raw=False, **operation_config): - """List of invoices for a billing account. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param period_start_date: Invoice period start date. - :type period_start_date: str - :param period_end_date: Invoice period end date. - :type period_end_date: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: InvoiceListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.InvoiceListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') - query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('InvoiceListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_by_billing_profile_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_by_billing_profile_operations.py deleted file mode 100644 index 6ab2dea8e87b..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_by_billing_profile_operations.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class InvoicesByBillingProfileOperations(object): - """InvoicesByBillingProfileOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, billing_profile_name, period_start_date, period_end_date, custom_headers=None, raw=False, **operation_config): - """List of invoices for a billing profile. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param billing_profile_name: Billing Profile Id. - :type billing_profile_name: str - :param period_start_date: Invoice period start date. - :type period_start_date: str - :param period_end_date: Invoice period end date. - :type period_end_date: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: InvoiceListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.InvoiceListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') - query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('InvoiceListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_account_billing_role_assignment_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py similarity index 57% rename from azure-mgmt-billing/azure/mgmt/billing/operations/billing_account_billing_role_assignment_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py index f8ff12e9940c..cef734c2cd7a 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_account_billing_role_assignment_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py @@ -15,8 +15,8 @@ from .. import models -class BillingAccountBillingRoleAssignmentOperations(object): - """BillingAccountBillingRoleAssignmentOperations operations. +class InvoicesOperations(object): + """InvoicesOperations operations. :param client: Client for service requests. :param config: Configuration of service client. @@ -36,36 +36,39 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def get( - self, billing_account_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): - """Get the role assignment for the caller. + def list_by_billing_account_name( + self, billing_account_name, period_start_date, period_end_date, custom_headers=None, raw=False, **operation_config): + """List of invoices for a billing account. :param billing_account_name: billing Account Id. :type billing_account_name: str - :param billing_role_assignment_name: role assignment id. - :type billing_role_assignment_name: str + :param period_start_date: Invoice period start date. + :type period_start_date: str + :param period_end_date: Invoice period end date. + :type period_end_date: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: BillingRoleAssignment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleAssignment or + :return: InvoiceListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.InvoiceListResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.get.metadata['url'] + url = self.list_by_billing_account_name.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') + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') + query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') # Construct headers header_parameters = {} @@ -87,45 +90,51 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleAssignment', response) + deserialized = self._deserialize('InvoiceListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices'} - def delete( - self, billing_account_name, billing_role_assignment_name, custom_headers=None, raw=False, **operation_config): - """Delete the role assignment on this billing account. + 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): + """List of invoices for a billing profile. :param billing_account_name: billing Account Id. :type billing_account_name: str - :param billing_role_assignment_name: role assignment id. - :type billing_role_assignment_name: str + :param billing_profile_name: Billing Profile Id. + :type billing_profile_name: str + :param period_start_date: Invoice period start date. + :type period_start_date: str + :param period_end_date: Invoice period end date. + :type period_end_date: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: BillingRoleAssignment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleAssignment or + :return: InvoiceListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.InvoiceListResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.delete.metadata['url'] + url = self.list_by_billing_profile.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') + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['periodStartDate'] = self._serialize.query("period_start_date", period_start_date, 'str') + query_parameters['periodEndDate'] = self._serialize.query("period_end_date", period_end_date, 'str') # Construct headers header_parameters = {} @@ -138,7 +147,7 @@ def delete( 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) + 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]: @@ -147,37 +156,42 @@ def delete( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleAssignment', response) + deserialized = self._deserialize('InvoiceListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - delete.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}'} + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices'} - def list( - self, billing_account_name, custom_headers=None, raw=False, **operation_config): - """Get the role assignments on the Billing Account. + def get( + self, billing_account_name, billing_profile_name, invoice_name, custom_headers=None, raw=False, **operation_config): + """Get the invoice by id. :param billing_account_name: billing Account Id. :type billing_account_name: str + :param billing_profile_name: Billing Profile Id. + :type billing_profile_name: str + :param invoice_name: Invoice Id. + :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: BillingRoleAssignmentListResult or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or + :return: InvoiceSummary or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.InvoiceSummary or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list.metadata['url'] + url = self.get.metadata['url'] path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), + 'invoiceName': self._serialize.url("invoice_name", invoice_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -205,75 +219,11 @@ def list( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BillingRoleAssignmentListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments'} - - def add( - self, billing_account_name, custom_headers=None, raw=False, **operation_config): - """The operation to add a role assignment to a billing account. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BillingRoleAssignmentListResult or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.billing.models.BillingRoleAssignmentListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - parameters = None - - # Construct URL - url = self.add.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'BillingRoleAssignmentPayload') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [201]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('BillingRoleAssignmentListResult', response) + deserialized = self._deserialize('InvoiceSummary', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - add.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/createBillingRoleAssignment'} + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/payment_methods_by_billing_profile_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/payment_methods_operations.py similarity index 91% rename from azure-mgmt-billing/azure/mgmt/billing/operations/payment_methods_by_billing_profile_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/payment_methods_operations.py index efdccfb7b5d7..0408e6426d5c 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/payment_methods_by_billing_profile_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/payment_methods_operations.py @@ -15,8 +15,8 @@ from .. import models -class PaymentMethodsByBillingProfileOperations(object): - """PaymentMethodsByBillingProfileOperations operations. +class PaymentMethodsOperations(object): + """PaymentMethodsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def list( + def list_by_billing_profile_name( self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): """Lists the Payment Methods by billing profile Id. @@ -59,7 +59,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list_by_billing_profile_name.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') @@ -102,4 +102,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethods'} + list_by_billing_profile_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethods'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/policy_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/policy_operations.py index 65e34a53f0d1..142a93387bf7 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/policy_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/policy_operations.py @@ -36,9 +36,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def get_by_billing_profile( + def get_by_billing_profile_name( self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): - """The policy for a given billingAccountName and billingProfileName. + """The policy for a given billing account name and billing profile name. :param billing_account_name: billing Account Id. :type billing_account_name: str @@ -56,7 +56,7 @@ def get_by_billing_profile( :class:`ErrorResponseException` """ # Construct URL - url = self.get_by_billing_profile.metadata['url'] + url = self.get_by_billing_profile_name.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') @@ -94,7 +94,7 @@ def get_by_billing_profile( return client_raw_response return deserialized - get_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default'} + get_by_billing_profile_name.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): diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_pricesheet_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/price_sheet_operations.py similarity index 97% rename from azure-mgmt-billing/azure/mgmt/billing/operations/invoice_pricesheet_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/price_sheet_operations.py index 82914f0724ca..2534c60ec8e3 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoice_pricesheet_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/price_sheet_operations.py @@ -17,8 +17,8 @@ from .. import models -class InvoicePricesheetOperations(object): - """InvoicePricesheetOperations operations. +class PriceSheetOperations(object): + """PriceSheetOperations operations. :param client: Client for service requests. :param config: Configuration of service client. @@ -91,7 +91,7 @@ def _download_initial( def download( self, billing_account_name, invoice_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Get pricesheet data for invoice id (invoiceName). + """Get pricesheet for invoice id (invoiceName). :param billing_account_name: Azure Billing Account ID. :type billing_account_name: str diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/products_by_billing_account_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/products_by_billing_account_operations.py deleted file mode 100644 index e8501d24a68c..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/products_by_billing_account_operations.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class ProductsByBillingAccountOperations(object): - """ProductsByBillingAccountOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists products by billingAccountName. - - :param billing_account_name: billing Account Id. - :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 is 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 ProductSummary - :rtype: - ~azure.mgmt.billing.models.ProductSummaryPaged[~azure.mgmt.billing.models.ProductSummary] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - '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) - 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 - deserialized = models.ProductSummaryPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ProductSummaryPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/products_by_billing_subscriptions_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/products_by_billing_subscriptions_operations.py deleted file mode 100644 index 44caf3354c61..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/products_by_billing_subscriptions_operations.py +++ /dev/null @@ -1,102 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class ProductsByBillingSubscriptionsOperations(object): - """ProductsByBillingSubscriptionsOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, custom_headers=None, raw=False, **operation_config): - """Lists billing subscriptions by billingAccountName. - - :param billing_account_name: billing Account Id. - :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 BillingSubscriptionSummary - :rtype: - ~azure.mgmt.billing.models.BillingSubscriptionSummaryPaged[~azure.mgmt.billing.models.BillingSubscriptionSummary] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - '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) - 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 - deserialized = models.BillingSubscriptionSummaryPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.BillingSubscriptionSummaryPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/products_by_invoice_section_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/products_by_invoice_section_operations.py deleted file mode 100644 index 8f9605d27e35..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/products_by_invoice_section_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class ProductsByInvoiceSectionOperations(object): - """ProductsByInvoiceSectionOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, invoice_section_name, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists products by invoiceSectionName. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :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 is separated by a colon (:). - :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProductsListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.ProductsListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ProductsListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py index 2fa6497a7f1c..94d18ee0f768 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py @@ -36,6 +36,145 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def list_by_billing_account_name( + self, billing_account_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists products by billing account name. + + :param billing_account_name: billing Account Id. + :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 is 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 ProductSummary + :rtype: + ~azure.mgmt.billing.models.ProductSummaryPaged[~azure.mgmt.billing.models.ProductSummary] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if 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) + 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 + deserialized = models.ProductSummaryPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ProductSummaryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products'} + + def list_by_invoice_section_name( + self, billing_account_name, invoice_section_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists products by invoice section name. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :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 is separated by a colon (:). + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ProductsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.ProductsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_invoice_section_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ProductsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_invoice_section_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products'} + def get( self, billing_account_name, invoice_section_name, product_name, custom_headers=None, raw=False, **operation_config): """Get a single product by name. @@ -101,7 +240,7 @@ def get( def transfer( self, billing_account_name, invoice_section_name, product_name, destination_invoice_section_id=None, custom_headers=None, raw=False, **operation_config): - """The operation to transfer a Product to another InvoiceSection. + """The operation to transfer a Product to another invoice section. :param billing_account_name: billing Account Id. :type billing_account_name: str @@ -176,3 +315,146 @@ def transfer( return deserialized transfer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/transfer'} + + def update_auto_renew_by_billing_account_name( + self, billing_account_name, product_name, auto_renew=None, custom_headers=None, raw=False, **operation_config): + """Cancel auto renew for product by product id and billing account name. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param product_name: Invoice Id. + :type product_name: str + :param auto_renew: Request parameters to update auto renew policy a + product. Possible values include: 'true', 'false' + :type auto_renew: str or ~azure.mgmt.billing.models.UpdateAutoRenew + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: UpdateAutoRenewOperationSummary or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.UpdateAutoRenewOperationSummary or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + body = models.UpdateAutoRenewRequest(auto_renew=auto_renew) + + # Construct URL + url = self.update_auto_renew_by_billing_account_name.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(body, 'UpdateAutoRenewRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('UpdateAutoRenewOperationSummary', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update_auto_renew_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/updateAutoRenew'} + + def update_auto_renew_by_invoice_section_name( + self, billing_account_name, invoice_section_name, product_name, auto_renew=None, custom_headers=None, raw=False, **operation_config): + """Cancel auto renew for product by product id and invoice section name. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param product_name: Invoice Id. + :type product_name: str + :param auto_renew: Request parameters to update auto renew policy a + product. Possible values include: 'true', 'false' + :type auto_renew: str or ~azure.mgmt.billing.models.UpdateAutoRenew + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: UpdateAutoRenewOperationSummary or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.billing.models.UpdateAutoRenewOperationSummary or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + body = models.UpdateAutoRenewRequest(auto_renew=auto_renew) + + # Construct URL + url = self.update_auto_renew_by_invoice_section_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str'), + 'productName': self._serialize.url("product_name", product_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, 'UpdateAutoRenewRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('UpdateAutoRenewOperationSummary', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update_auto_renew_by_invoice_section_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_billing_account_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_billing_account_operations.py deleted file mode 100644 index 815440c4613b..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_billing_account_operations.py +++ /dev/null @@ -1,116 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class TransactionsByBillingAccountOperations(object): - """TransactionsByBillingAccountOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, start_date, end_date, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists the transactions by billingAccountName for given start and end - date. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param start_date: Start date - :type start_date: str - :param end_date: End date - :type end_date: str - :param filter: May be used to filter by transaction kind. 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 is 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 TransactionsSummary - :rtype: - ~azure.mgmt.billing.models.TransactionsSummaryPaged[~azure.mgmt.billing.models.TransactionsSummary] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - '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['startDate'] = self._serialize.query("start_date", start_date, 'str') - query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - 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 - deserialized = models.TransactionsSummaryPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.TransactionsSummaryPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/transactions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_billing_profile_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_billing_profile_operations.py deleted file mode 100644 index 7361a8c6a7cb..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_billing_profile_operations.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class TransactionsByBillingProfileOperations(object): - """TransactionsByBillingProfileOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, billing_profile_name, start_date, end_date, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists the transactions by billingProfileName for given start date and - end date. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param billing_profile_name: Billing Profile Id. - :type billing_profile_name: str - :param start_date: Start date - :type start_date: str - :param end_date: End date - :type end_date: str - :param filter: May be used to filter by transaction kind. 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 is 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: TransactionsListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.TransactionsListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') - } - 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['startDate'] = self._serialize.query("start_date", start_date, 'str') - query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TransactionsListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_invoice_section_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_invoice_section_operations.py deleted file mode 100644 index 7ecf28a61874..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_by_invoice_section_operations.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class TransactionsByInvoiceSectionOperations(object): - """TransactionsByInvoiceSectionOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, invoice_section_name, start_date, end_date, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists the transactions by invoiceSectionName for given start date and - end date. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param invoice_section_name: InvoiceSection Id. - :type invoice_section_name: str - :param start_date: Start date - :type start_date: str - :param end_date: End date - :type end_date: str - :param filter: May be used to filter by transaction kind. 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 is 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: TransactionsListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.TransactionsListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') - } - 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['startDate'] = self._serialize.query("start_date", start_date, 'str') - query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TransactionsListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transactions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_operations.py new file mode 100644 index 000000000000..3b5566d34793 --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/transactions_operations.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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class TransactionsOperations(object): + """TransactionsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-11-01-preview" + + self.config = config + + def list_by_billing_account_name( + self, billing_account_name, start_date, end_date, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the transactions by billing account name for given start and end + date. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param start_date: Start date + :type start_date: str + :param end_date: End date + :type end_date: str + :param filter: May be used to filter by transaction kind. 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 is 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 TransactionsSummary + :rtype: + ~azure.mgmt.billing.models.TransactionsSummaryPaged[~azure.mgmt.billing.models.TransactionsSummary] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_billing_account_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['startDate'] = self._serialize.query("start_date", start_date, 'str') + query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + 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 + deserialized = models.TransactionsSummaryPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.TransactionsSummaryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/transactions'} + + def list_by_billing_profile_name( + self, billing_account_name, billing_profile_name, start_date, end_date, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the transactions by billing profile name for given start date and + end date. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param billing_profile_name: Billing Profile Id. + :type billing_profile_name: str + :param start_date: Start date + :type start_date: str + :param end_date: End date + :type end_date: str + :param filter: May be used to filter by transaction kind. 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 is 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: TransactionsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.TransactionsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_profile_name.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['startDate'] = self._serialize.query("start_date", start_date, 'str') + query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TransactionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_profile_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions'} + + def list_by_invoice_section_name( + self, billing_account_name, invoice_section_name, start_date, end_date, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the transactions by invoice section name for given start date and + end date. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param invoice_section_name: InvoiceSection Id. + :type invoice_section_name: str + :param start_date: Start date + :type start_date: str + :param end_date: End date + :type end_date: str + :param filter: May be used to filter by transaction kind. 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 is 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: TransactionsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.TransactionsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_invoice_section_name.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') + } + 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['startDate'] = self._serialize.query("start_date", start_date, 'str') + query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TransactionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_invoice_section_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transactions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/transfers_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/transfers_operations.py index 7ab9cae9d90d..36f4cd24ca8d 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/transfers_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/transfers_operations.py @@ -36,8 +36,8 @@ def __init__(self, client, config, serializer, deserializer): def initiate( self, billing_account_name, invoice_section_name, billing_profile_id=None, recipient_email_id=None, custom_headers=None, raw=False, **operation_config): - """Initiates the request to transfer the GTM or legacy subscriptions or - RIs to GTM. + """Initiates the request to transfer the modern or legacy subscriptions or + RIs to modern. :param billing_account_name: billing Account Id. :type billing_account_name: str From 57e0f16d7ae1c4505baccdcef01af0f33d55867f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 22 Apr 2019 20:48:42 +0000 Subject: [PATCH 2/3] Generated from 86c8bcfa38eb98457c66057f99b62b79b5cf9c96 Fixed the errors Fixed the errors --- .../mgmt/billing/billing_management_client.py | 32 +++++++++---------- .../azure/mgmt/billing/operations/__init__.py | 16 +++++----- ...ns.py => available_balances_operations.py} | 4 +-- ...=> billing_role_assignments_operations.py} | 4 +-- ...=> billing_role_definitions_operations.py} | 4 +-- .../billing_subscriptions_operations.py | 4 +-- .../billing/operations/invoices_operations.py | 2 +- ...y_operations.py => policies_operations.py} | 4 +-- .../operations/price_sheet_operations.py | 2 +- .../operations/transfers_operations.py | 3 +- 10 files changed, 37 insertions(+), 38 deletions(-) rename azure-mgmt-billing/azure/mgmt/billing/operations/{available_balance_operations.py => available_balances_operations.py} (97%) rename azure-mgmt-billing/azure/mgmt/billing/operations/{billing_role_assignment_operations.py => billing_role_assignments_operations.py} (99%) rename azure-mgmt-billing/azure/mgmt/billing/operations/{billing_role_definition_operations.py => billing_role_definitions_operations.py} (99%) rename azure-mgmt-billing/azure/mgmt/billing/operations/{policy_operations.py => policies_operations.py} (99%) diff --git a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py index 258152117564..20631a053aa2 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py +++ b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py @@ -14,7 +14,7 @@ from msrestazure import AzureConfiguration from .version import VERSION from .operations.billing_accounts_operations import BillingAccountsOperations -from .operations.available_balance_operations import AvailableBalanceOperations +from .operations.available_balances_operations import AvailableBalancesOperations from .operations.payment_methods_operations import PaymentMethodsOperations from .operations.billing_profiles_operations import BillingProfilesOperations from .operations.invoice_sections_operations import InvoiceSectionsOperations @@ -25,15 +25,15 @@ from .operations.billing_subscriptions_operations import BillingSubscriptionsOperations from .operations.products_operations import ProductsOperations from .operations.transactions_operations import TransactionsOperations -from .operations.policy_operations import PolicyOperations +from .operations.policies_operations import PoliciesOperations from .operations.billing_property_operations import BillingPropertyOperations from .operations.transfers_operations import TransfersOperations from .operations.recipient_transfers_operations import RecipientTransfersOperations from .operations.operations import Operations from .operations.billing_permissions_operations import BillingPermissionsOperations from .operations.billing_profile_billing_permissions_operations import BillingProfileBillingPermissionsOperations -from .operations.billing_role_definition_operations import BillingRoleDefinitionOperations -from .operations.billing_role_assignment_operations import BillingRoleAssignmentOperations +from .operations.billing_role_definitions_operations import BillingRoleDefinitionsOperations +from .operations.billing_role_assignments_operations import BillingRoleAssignmentsOperations from .operations.agreements_operations import AgreementsOperations from . import models @@ -78,8 +78,8 @@ class BillingManagementClient(SDKClient): :ivar billing_accounts: BillingAccounts operations :vartype billing_accounts: azure.mgmt.billing.operations.BillingAccountsOperations - :ivar available_balance: AvailableBalance operations - :vartype available_balance: azure.mgmt.billing.operations.AvailableBalanceOperations + :ivar available_balances: AvailableBalances operations + :vartype available_balances: azure.mgmt.billing.operations.AvailableBalancesOperations :ivar payment_methods: PaymentMethods operations :vartype payment_methods: azure.mgmt.billing.operations.PaymentMethodsOperations :ivar billing_profiles: BillingProfiles operations @@ -100,8 +100,8 @@ class BillingManagementClient(SDKClient): :vartype products: azure.mgmt.billing.operations.ProductsOperations :ivar transactions: Transactions operations :vartype transactions: azure.mgmt.billing.operations.TransactionsOperations - :ivar policy: Policy operations - :vartype policy: azure.mgmt.billing.operations.PolicyOperations + :ivar policies: Policies operations + :vartype policies: azure.mgmt.billing.operations.PoliciesOperations :ivar billing_property: BillingProperty operations :vartype billing_property: azure.mgmt.billing.operations.BillingPropertyOperations :ivar transfers: Transfers operations @@ -114,10 +114,10 @@ class BillingManagementClient(SDKClient): :vartype billing_permissions: azure.mgmt.billing.operations.BillingPermissionsOperations :ivar billing_profile_billing_permissions: BillingProfileBillingPermissions operations :vartype billing_profile_billing_permissions: azure.mgmt.billing.operations.BillingProfileBillingPermissionsOperations - :ivar billing_role_definition: BillingRoleDefinition operations - :vartype billing_role_definition: azure.mgmt.billing.operations.BillingRoleDefinitionOperations - :ivar billing_role_assignment: BillingRoleAssignment operations - :vartype billing_role_assignment: azure.mgmt.billing.operations.BillingRoleAssignmentOperations + :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 @@ -142,7 +142,7 @@ def __init__( self.billing_accounts = BillingAccountsOperations( self._client, self.config, self._serialize, self._deserialize) - self.available_balance = AvailableBalanceOperations( + self.available_balances = AvailableBalancesOperations( self._client, self.config, self._serialize, self._deserialize) self.payment_methods = PaymentMethodsOperations( self._client, self.config, self._serialize, self._deserialize) @@ -164,7 +164,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.transactions = TransactionsOperations( self._client, self.config, self._serialize, self._deserialize) - self.policy = PolicyOperations( + self.policies = PoliciesOperations( self._client, self.config, self._serialize, self._deserialize) self.billing_property = BillingPropertyOperations( self._client, self.config, self._serialize, self._deserialize) @@ -178,9 +178,9 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.billing_profile_billing_permissions = BillingProfileBillingPermissionsOperations( self._client, self.config, self._serialize, self._deserialize) - self.billing_role_definition = BillingRoleDefinitionOperations( + self.billing_role_definitions = BillingRoleDefinitionsOperations( self._client, self.config, self._serialize, self._deserialize) - self.billing_role_assignment = BillingRoleAssignmentOperations( + self.billing_role_assignments = BillingRoleAssignmentsOperations( self._client, self.config, self._serialize, self._deserialize) self.agreements = AgreementsOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py index 8a6f50e6a242..9bb25374607d 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py @@ -10,7 +10,7 @@ # -------------------------------------------------------------------------- from .billing_accounts_operations import BillingAccountsOperations -from .available_balance_operations import AvailableBalanceOperations +from .available_balances_operations import AvailableBalancesOperations from .payment_methods_operations import PaymentMethodsOperations from .billing_profiles_operations import BillingProfilesOperations from .invoice_sections_operations import InvoiceSectionsOperations @@ -21,20 +21,20 @@ from .billing_subscriptions_operations import BillingSubscriptionsOperations from .products_operations import ProductsOperations from .transactions_operations import TransactionsOperations -from .policy_operations import PolicyOperations +from .policies_operations import PoliciesOperations from .billing_property_operations import BillingPropertyOperations from .transfers_operations import TransfersOperations from .recipient_transfers_operations import RecipientTransfersOperations from .operations import Operations from .billing_permissions_operations import BillingPermissionsOperations from .billing_profile_billing_permissions_operations import BillingProfileBillingPermissionsOperations -from .billing_role_definition_operations import BillingRoleDefinitionOperations -from .billing_role_assignment_operations import BillingRoleAssignmentOperations +from .billing_role_definitions_operations import BillingRoleDefinitionsOperations +from .billing_role_assignments_operations import BillingRoleAssignmentsOperations from .agreements_operations import AgreementsOperations __all__ = [ 'BillingAccountsOperations', - 'AvailableBalanceOperations', + 'AvailableBalancesOperations', 'PaymentMethodsOperations', 'BillingProfilesOperations', 'InvoiceSectionsOperations', @@ -45,14 +45,14 @@ 'BillingSubscriptionsOperations', 'ProductsOperations', 'TransactionsOperations', - 'PolicyOperations', + 'PoliciesOperations', 'BillingPropertyOperations', 'TransfersOperations', 'RecipientTransfersOperations', 'Operations', 'BillingPermissionsOperations', 'BillingProfileBillingPermissionsOperations', - 'BillingRoleDefinitionOperations', - 'BillingRoleAssignmentOperations', + 'BillingRoleDefinitionsOperations', + 'BillingRoleAssignmentsOperations', 'AgreementsOperations', ] diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/available_balance_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/available_balances_operations.py similarity index 97% rename from azure-mgmt-billing/azure/mgmt/billing/operations/available_balance_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/available_balances_operations.py index 15d52bc69b24..f425396e08b1 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/available_balance_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/available_balances_operations.py @@ -15,8 +15,8 @@ from .. import models -class AvailableBalanceOperations(object): - """AvailableBalanceOperations operations. +class AvailableBalancesOperations(object): + """AvailableBalancesOperations operations. :param client: Client for service requests. :param config: Configuration of service client. diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_assignment_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_assignments_operations.py similarity index 99% rename from azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_assignment_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_assignments_operations.py index df24ea93977f..1bb2361d9cf9 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_assignment_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_assignments_operations.py @@ -15,8 +15,8 @@ from .. import models -class BillingRoleAssignmentOperations(object): - """BillingRoleAssignmentOperations operations. +class BillingRoleAssignmentsOperations(object): + """BillingRoleAssignmentsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_definition_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_definitions_operations.py similarity index 99% rename from azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_definition_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_definitions_operations.py index 074a6e8be9be..9ee44c433066 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_definition_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_role_definitions_operations.py @@ -15,8 +15,8 @@ from .. import models -class BillingRoleDefinitionOperations(object): - """BillingRoleDefinitionOperations operations. +class BillingRoleDefinitionsOperations(object): + """BillingRoleDefinitionsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py index d20028c5ee8b..c713b7e251c4 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_subscriptions_operations.py @@ -346,8 +346,8 @@ def _transfer_initial( def transfer( self, billing_account_name, invoice_section_name, billing_subscription_name, destination_invoice_section_id=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Transfers the modern subscription from one invoice section to another - within a billing account. + """Transfers the subscription from one invoice section to another within a + billing account. :param billing_account_name: billing Account Id. :type billing_account_name: str diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py index cef734c2cd7a..c5ed960009b8 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py @@ -167,7 +167,7 @@ def list_by_billing_profile( def get( self, billing_account_name, billing_profile_name, invoice_name, custom_headers=None, raw=False, **operation_config): - """Get the invoice by id. + """Get the invoice by name. :param billing_account_name: billing Account Id. :type billing_account_name: str diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/policy_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/policies_operations.py similarity index 99% rename from azure-mgmt-billing/azure/mgmt/billing/operations/policy_operations.py rename to azure-mgmt-billing/azure/mgmt/billing/operations/policies_operations.py index 142a93387bf7..1dcbc3d125e7 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/policy_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/policies_operations.py @@ -15,8 +15,8 @@ from .. import models -class PolicyOperations(object): - """PolicyOperations operations. +class PoliciesOperations(object): + """PoliciesOperations operations. :param client: Client for service requests. :param config: Configuration of service client. diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/price_sheet_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/price_sheet_operations.py index 2534c60ec8e3..b2e7e67f49b5 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/price_sheet_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/price_sheet_operations.py @@ -91,7 +91,7 @@ def _download_initial( def download( self, billing_account_name, invoice_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Get pricesheet for invoice id (invoiceName). + """Download price sheet for an invoice. :param billing_account_name: Azure Billing Account ID. :type billing_account_name: str diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/transfers_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/transfers_operations.py index 36f4cd24ca8d..2daf9f4588e8 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/transfers_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/transfers_operations.py @@ -36,8 +36,7 @@ def __init__(self, client, config, serializer, deserializer): def initiate( self, billing_account_name, invoice_section_name, billing_profile_id=None, recipient_email_id=None, custom_headers=None, raw=False, **operation_config): - """Initiates the request to transfer the modern or legacy subscriptions or - RIs to modern. + """Initiates the request to transfer the legacy subscriptions or RIs. :param billing_account_name: billing Account Id. :type billing_account_name: str From c21a8232840eb63d1ffb0d64377705c9ea16bfaf Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 23 Apr 2019 20:10:20 +0000 Subject: [PATCH 3/3] Generated from 9fb11a5fab1eae53424e0fa9f5c6b0b1da825b90 Incorporated review comments Incorporated review comments --- .../mgmt/billing/billing_management_client.py | 5 - .../azure/mgmt/billing/models/__init__.py | 6 +- .../models/billing_permissions_list_result.py | 5 +- .../billing_permissions_list_result_py3.py | 5 +- ...s.py => billing_permissions_properties.py} | 4 +- ... => billing_permissions_properties_py3.py} | 4 +- .../billing/models/billing_role_definition.py | 5 +- .../models/billing_role_definition_py3.py | 5 +- .../azure/mgmt/billing/operations/__init__.py | 2 - .../billing_permissions_operations.py | 62 +++++++++++- ..._profile_billing_permissions_operations.py | 97 ------------------- 11 files changed, 80 insertions(+), 120 deletions(-) rename azure-mgmt-billing/azure/mgmt/billing/models/{billing_permissions.py => billing_permissions_properties.py} (91%) rename azure-mgmt-billing/azure/mgmt/billing/models/{billing_permissions_py3.py => billing_permissions_properties_py3.py} (92%) delete mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_permissions_operations.py diff --git a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py index 20631a053aa2..a49bf0441ae7 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py +++ b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py @@ -31,7 +31,6 @@ from .operations.recipient_transfers_operations import RecipientTransfersOperations from .operations.operations import Operations from .operations.billing_permissions_operations import BillingPermissionsOperations -from .operations.billing_profile_billing_permissions_operations import BillingProfileBillingPermissionsOperations from .operations.billing_role_definitions_operations import BillingRoleDefinitionsOperations from .operations.billing_role_assignments_operations import BillingRoleAssignmentsOperations from .operations.agreements_operations import AgreementsOperations @@ -112,8 +111,6 @@ class BillingManagementClient(SDKClient): :vartype operations: azure.mgmt.billing.operations.Operations :ivar billing_permissions: BillingPermissions operations :vartype billing_permissions: azure.mgmt.billing.operations.BillingPermissionsOperations - :ivar billing_profile_billing_permissions: BillingProfileBillingPermissions operations - :vartype billing_profile_billing_permissions: azure.mgmt.billing.operations.BillingProfileBillingPermissionsOperations :ivar billing_role_definitions: BillingRoleDefinitions operations :vartype billing_role_definitions: azure.mgmt.billing.operations.BillingRoleDefinitionsOperations :ivar billing_role_assignments: BillingRoleAssignments operations @@ -176,8 +173,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.billing_permissions = BillingPermissionsOperations( self._client, self.config, self._serialize, self._deserialize) - self.billing_profile_billing_permissions = BillingProfileBillingPermissionsOperations( - 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( diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py index aaa96626717a..140c186dbd06 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py @@ -64,7 +64,7 @@ from .billing_role_assignment_payload_py3 import BillingRoleAssignmentPayload from .billing_role_assignment_py3 import BillingRoleAssignment from .billing_role_assignment_list_result_py3 import BillingRoleAssignmentListResult - from .billing_permissions_py3 import BillingPermissions + from .billing_permissions_properties_py3 import BillingPermissionsProperties from .billing_permissions_list_result_py3 import BillingPermissionsListResult from .billing_role_definition_py3 import BillingRoleDefinition from .billing_role_definition_list_result_py3 import BillingRoleDefinitionListResult @@ -126,7 +126,7 @@ from .billing_role_assignment_payload import BillingRoleAssignmentPayload from .billing_role_assignment import BillingRoleAssignment from .billing_role_assignment_list_result import BillingRoleAssignmentListResult - from .billing_permissions import BillingPermissions + from .billing_permissions_properties import BillingPermissionsProperties from .billing_permissions_list_result import BillingPermissionsListResult from .billing_role_definition import BillingRoleDefinition from .billing_role_definition_list_result import BillingRoleDefinitionListResult @@ -209,7 +209,7 @@ 'BillingRoleAssignmentPayload', 'BillingRoleAssignment', 'BillingRoleAssignmentListResult', - 'BillingPermissions', + 'BillingPermissionsProperties', 'BillingPermissionsListResult', 'BillingRoleDefinition', 'BillingRoleDefinitionListResult', diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_list_result.py b/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_list_result.py index a2df95cab160..d260a69513d0 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_list_result.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_list_result.py @@ -20,7 +20,8 @@ class BillingPermissionsListResult(Model): :ivar value: The list OF billingPermissions a caller has on a billing account. - :vartype value: list[~azure.mgmt.billing.models.BillingPermissions] + :vartype value: + list[~azure.mgmt.billing.models.BillingPermissionsProperties] """ _validation = { @@ -28,7 +29,7 @@ class BillingPermissionsListResult(Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[BillingPermissions]'}, + 'value': {'key': 'value', 'type': '[BillingPermissionsProperties]'}, } def __init__(self, **kwargs): diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_list_result_py3.py b/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_list_result_py3.py index dd88a48cdc83..8a8ccfb428cf 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_list_result_py3.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_list_result_py3.py @@ -20,7 +20,8 @@ class BillingPermissionsListResult(Model): :ivar value: The list OF billingPermissions a caller has on a billing account. - :vartype value: list[~azure.mgmt.billing.models.BillingPermissions] + :vartype value: + list[~azure.mgmt.billing.models.BillingPermissionsProperties] """ _validation = { @@ -28,7 +29,7 @@ class BillingPermissionsListResult(Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[BillingPermissions]'}, + 'value': {'key': 'value', 'type': '[BillingPermissionsProperties]'}, } def __init__(self, **kwargs) -> None: diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions.py b/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_properties.py similarity index 91% rename from azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions.py rename to azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_properties.py index dfb6d75273a2..037d3b84b190 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_properties.py @@ -12,7 +12,7 @@ from msrest.serialization import Model -class BillingPermissions(Model): +class BillingPermissionsProperties(Model): """The set of allowed action and not allowed actions a caller has on a billing account. @@ -36,6 +36,6 @@ class BillingPermissions(Model): } def __init__(self, **kwargs): - super(BillingPermissions, self).__init__(**kwargs) + super(BillingPermissionsProperties, self).__init__(**kwargs) self.actions = None self.not_actions = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_py3.py b/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_properties_py3.py similarity index 92% rename from azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_py3.py rename to azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_properties_py3.py index d0a020868a94..0f0fd8a3848f 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_py3.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/billing_permissions_properties_py3.py @@ -12,7 +12,7 @@ from msrest.serialization import Model -class BillingPermissions(Model): +class BillingPermissionsProperties(Model): """The set of allowed action and not allowed actions a caller has on a billing account. @@ -36,6 +36,6 @@ class BillingPermissions(Model): } def __init__(self, **kwargs) -> None: - super(BillingPermissions, self).__init__(**kwargs) + super(BillingPermissionsProperties, self).__init__(**kwargs) self.actions = None self.not_actions = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/billing_role_definition.py b/azure-mgmt-billing/azure/mgmt/billing/models/billing_role_definition.py index 6c8655f43301..ce3773364f39 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/models/billing_role_definition.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/billing_role_definition.py @@ -28,7 +28,8 @@ class BillingRoleDefinition(Resource): :vartype description: str :ivar value: The list OF billingPermissions a caller has on a billing account. - :vartype value: list[~azure.mgmt.billing.models.BillingPermissions] + :vartype value: + list[~azure.mgmt.billing.models.BillingPermissionsProperties] :ivar role_name: The name of the role :vartype role_name: str """ @@ -47,7 +48,7 @@ class BillingRoleDefinition(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, - 'value': {'key': 'properties.permissions.value', 'type': '[BillingPermissions]'}, + 'value': {'key': 'properties.permissions.value', 'type': '[BillingPermissionsProperties]'}, 'role_name': {'key': 'properties.roleName', 'type': 'str'}, } diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/billing_role_definition_py3.py b/azure-mgmt-billing/azure/mgmt/billing/models/billing_role_definition_py3.py index 7db2564951ed..c20af66e272f 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/models/billing_role_definition_py3.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/billing_role_definition_py3.py @@ -28,7 +28,8 @@ class BillingRoleDefinition(Resource): :vartype description: str :ivar value: The list OF billingPermissions a caller has on a billing account. - :vartype value: list[~azure.mgmt.billing.models.BillingPermissions] + :vartype value: + list[~azure.mgmt.billing.models.BillingPermissionsProperties] :ivar role_name: The name of the role :vartype role_name: str """ @@ -47,7 +48,7 @@ class BillingRoleDefinition(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, - 'value': {'key': 'properties.permissions.value', 'type': '[BillingPermissions]'}, + 'value': {'key': 'properties.permissions.value', 'type': '[BillingPermissionsProperties]'}, 'role_name': {'key': 'properties.roleName', 'type': 'str'}, } diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py index 9bb25374607d..43e0ca5a30f8 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py @@ -27,7 +27,6 @@ from .recipient_transfers_operations import RecipientTransfersOperations from .operations import Operations from .billing_permissions_operations import BillingPermissionsOperations -from .billing_profile_billing_permissions_operations import BillingProfileBillingPermissionsOperations from .billing_role_definitions_operations import BillingRoleDefinitionsOperations from .billing_role_assignments_operations import BillingRoleAssignmentsOperations from .agreements_operations import AgreementsOperations @@ -51,7 +50,6 @@ 'RecipientTransfersOperations', 'Operations', 'BillingPermissionsOperations', - 'BillingProfileBillingPermissionsOperations', 'BillingRoleDefinitionsOperations', 'BillingRoleAssignmentsOperations', 'AgreementsOperations', diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_permissions_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_permissions_operations.py index 2a41c99fb81e..f31a5475cb64 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_permissions_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_permissions_operations.py @@ -95,7 +95,7 @@ def list_by_billing_account( def list_by_invoice_sections( self, billing_account_name, invoice_section_name, custom_headers=None, raw=False, **operation_config): - """Lists all billing permissions for the caller under Invoice Section. + """Lists all billing permissions for the caller under invoice section. :param billing_account_name: billing Account Id. :type billing_account_name: str @@ -152,3 +152,63 @@ def list_by_invoice_sections( return deserialized list_by_invoice_sections.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingPermissions'} + + def list_by_billing_profile( + self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): + """Lists all billingPermissions for the caller has for a billing account. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param billing_profile_name: Billing Profile Id. + :type billing_profile_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingPermissionsListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingPermissionsListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_profile.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BillingPermissionsListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_profile.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingPermissions'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_permissions_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_permissions_operations.py deleted file mode 100644 index c9178f7574db..000000000000 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_profile_billing_permissions_operations.py +++ /dev/null @@ -1,97 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class BillingProfileBillingPermissionsOperations(object): - """BillingProfileBillingPermissionsOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-11-01-preview" - - self.config = config - - def list( - self, billing_account_name, billing_profile_name, custom_headers=None, raw=False, **operation_config): - """Lists all billingPermissions for the caller has for a billing account. - - :param billing_account_name: billing Account Id. - :type billing_account_name: str - :param billing_profile_name: Billing Profile Id. - :type billing_profile_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BillingPermissionsListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.billing.models.BillingPermissionsListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BillingPermissionsListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingPermissions'}