diff --git a/azure-mgmt-billing/README.rst b/azure-mgmt-billing/README.rst index 45de4e6b43dd..d0429ebc7565 100644 --- a/azure-mgmt-billing/README.rst +++ b/azure-mgmt-billing/README.rst @@ -14,25 +14,6 @@ For the older Azure Service Management (ASM) libraries, see For a more complete set of Azure libraries, see the `azure `__ bundle package. -Compatibility -============= - -**IMPORTANT**: If you have an earlier version of the azure package -(version < 1.0), you should uninstall it before installing this package. - -You can check the version using pip: - -.. code:: shell - - pip freeze - -If you see azure==0.11.0 (or any version below 1.0), uninstall it first: - -.. code:: shell - - pip uninstall azure - - Usage ===== 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 528867b0d1ce..08c59c12f9d4 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py +++ b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py @@ -16,6 +16,7 @@ from .operations.enrollment_accounts_operations import EnrollmentAccountsOperations from .operations.billing_periods_operations import BillingPeriodsOperations from .operations.invoices_operations import InvoicesOperations +from .operations.products_operations import ProductsOperations from .operations.operations import Operations from . import models @@ -64,6 +65,8 @@ class BillingManagementClient(SDKClient): :vartype billing_periods: azure.mgmt.billing.operations.BillingPeriodsOperations :ivar invoices: Invoices operations :vartype invoices: azure.mgmt.billing.operations.InvoicesOperations + :ivar products: Products operations + :vartype products: azure.mgmt.billing.operations.ProductsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.billing.operations.Operations @@ -82,7 +85,7 @@ def __init__( super(BillingManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2018-03-01-preview' + self.api_version = '2018-11-01-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -92,5 +95,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.invoices = InvoicesOperations( self._client, self.config, self._serialize, self._deserialize) + self.products = ProductsOperations( + self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py index 4e5a8bfe9975..9006f6607762 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- try: + from .transfer_product_properties_py3 import TransferProductProperties from .enrollment_account_py3 import EnrollmentAccount from .billing_period_py3 import BillingPeriod from .download_url_py3 import DownloadUrl @@ -20,6 +21,7 @@ from .operation_py3 import Operation from .resource_py3 import Resource except (SyntaxError, ImportError): + from .transfer_product_properties import TransferProductProperties from .enrollment_account import EnrollmentAccount from .billing_period import BillingPeriod from .download_url import DownloadUrl @@ -35,6 +37,7 @@ from .operation_paged import OperationPaged __all__ = [ + 'TransferProductProperties', 'EnrollmentAccount', 'BillingPeriod', 'DownloadUrl', diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_properties.py b/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_properties.py new file mode 100644 index 000000000000..3df9a9b7db7c --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_properties.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TransferProductProperties(Model): + """The properties of the product to initiate a transfer. + + :param destination_invoice_section_id: Destination invoice section id. + :type destination_invoice_section_id: str + """ + + _attribute_map = { + 'destination_invoice_section_id': {'key': 'destinationInvoiceSectionId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TransferProductProperties, self).__init__(**kwargs) + self.destination_invoice_section_id = kwargs.get('destination_invoice_section_id', None) diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_properties_py3.py b/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_properties_py3.py new file mode 100644 index 000000000000..458f73327173 --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/models/transfer_product_properties_py3.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TransferProductProperties(Model): + """The properties of the product to initiate a transfer. + + :param destination_invoice_section_id: Destination invoice section id. + :type destination_invoice_section_id: str + """ + + _attribute_map = { + 'destination_invoice_section_id': {'key': 'destinationInvoiceSectionId', 'type': 'str'}, + } + + def __init__(self, *, destination_invoice_section_id: str=None, **kwargs) -> None: + super(TransferProductProperties, self).__init__(**kwargs) + self.destination_invoice_section_id = destination_invoice_section_id diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py index c3d1d198514e..4045e0bde0c3 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py @@ -12,11 +12,13 @@ from .enrollment_accounts_operations import EnrollmentAccountsOperations from .billing_periods_operations import BillingPeriodsOperations from .invoices_operations import InvoicesOperations +from .products_operations import ProductsOperations from .operations import Operations __all__ = [ 'EnrollmentAccountsOperations', 'BillingPeriodsOperations', 'InvoicesOperations', + 'ProductsOperations', 'Operations', ] diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py index 337a3d705411..798ee0f0c836 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py @@ -22,7 +22,7 @@ class BillingPeriodsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". + :ivar api_version: 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 @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-03-01-preview" + self.api_version = "2018-11-01-preview" self.config = config 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 58199cd31644..c961803fc78d 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 @@ -22,7 +22,7 @@ class EnrollmentAccountsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". + :ivar api_version: 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 @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-03-01-preview" + self.api_version = "2018-11-01-preview" self.config = config 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 e16ef92f5af0..4c495190b57f 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py @@ -22,7 +22,7 @@ class InvoicesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". + :ivar api_version: 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 @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-03-01-preview" + self.api_version = "2018-11-01-preview" self.config = config diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py index 07621b06039f..09088dd24e9a 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py @@ -22,7 +22,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". + :ivar api_version: 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 @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-03-01-preview" + self.api_version = "2018-11-01-preview" self.config = config diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py new file mode 100644 index 000000000000..6f118528f50e --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/products_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ProductsOperations(object): + """ProductsOperations operations. + + :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 transfer( + self, billing_account_id, invoice_section_id, product_name, destination_invoice_section_id=None, custom_headers=None, raw=False, **operation_config): + """The operation to transfer a Product to another InvoiceSection. + + :param billing_account_id: billing Account Id. + :type billing_account_id: str + :param invoice_section_id: Invoice Id. + :type invoice_section_id: str + :param product_name: Product Id. + :type product_name: str + :param destination_invoice_section_id: Destination invoice section id. + :type destination_invoice_section_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.TransferProductProperties(destination_invoice_section_id=destination_invoice_section_id) + + # Construct URL + url = self.transfer.metadata['url'] + path_format_arguments = { + 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), + 'invoiceSectionId': self._serialize.url("invoice_section_id", invoice_section_id, '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['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, 'TransferProductProperties') + + # 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 [202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'Location': 'str', + 'Retry-After': 'int', + 'Azure-AsyncOperation': 'str', + }) + return client_raw_response + transfer.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}/products/{productName}/transfer'}