diff --git a/azure-mgmt-billing/azure/mgmt/billing/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/__init__.py old mode 100755 new mode 100644 diff --git a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py old mode 100755 new mode 100644 index 84d545b866de..d6d6dacbfd1e --- a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py +++ b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py @@ -13,6 +13,7 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION +from .operations.billing_accounts_operations import BillingAccountsOperations from .operations.billing_periods_operations import BillingPeriodsOperations from .operations.invoices_operations import InvoicesOperations from .operations.operations import Operations @@ -39,14 +40,12 @@ def __init__( raise ValueError("Parameter 'credentials' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not isinstance(subscription_id, str): - raise TypeError("Parameter 'subscription_id' must be str.") if not base_url: base_url = 'https://management.azure.com' super(BillingManagementClientConfiguration, self).__init__(base_url) - self.add_user_agent('billingmanagementclient/{}'.format(VERSION)) + self.add_user_agent('azure-mgmt-billing/{}'.format(VERSION)) self.add_user_agent('Azure-SDK-For-Python') self.credentials = credentials @@ -54,17 +53,19 @@ def __init__( class BillingManagementClient(object): - """Billing client provides access to billing resources for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + """Billing client provides access to billing resources for Azure subscriptions. :ivar config: Configuration for client. :vartype config: BillingManagementClientConfiguration + :ivar billing_accounts: BillingAccounts operations + :vartype billing_accounts: azure.mgmt.billing.operations.BillingAccountsOperations :ivar billing_periods: BillingPeriods operations - :vartype billing_periods: .operations.BillingPeriodsOperations + :vartype billing_periods: azure.mgmt.billing.operations.BillingPeriodsOperations :ivar invoices: Invoices operations - :vartype invoices: .operations.InvoicesOperations + :vartype invoices: azure.mgmt.billing.operations.InvoicesOperations :ivar operations: Operations operations - :vartype operations: .operations.Operations + :vartype operations: azure.mgmt.billing.operations.Operations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -81,10 +82,12 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2017-04-24-preview' + self.api_version = '2018-03-01-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.billing_accounts = BillingAccountsOperations( + self._client, self.config, self._serialize, self._deserialize) self.billing_periods = BillingPeriodsOperations( self._client, self.config, self._serialize, self._deserialize) self.invoices = InvoicesOperations( diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py old mode 100755 new mode 100644 index b9f2165753af..8642777c2870 --- a/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py @@ -9,6 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- +from .billing_account_result import BillingAccountResult +from .billing_account_list_result import BillingAccountListResult from .billing_period import BillingPeriod from .download_url import DownloadUrl from .error_details import ErrorDetails @@ -22,6 +24,8 @@ from .operation_paged import OperationPaged __all__ = [ + 'BillingAccountResult', + 'BillingAccountListResult', 'BillingPeriod', 'DownloadUrl', 'ErrorDetails', diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/billing_account_list_result.py b/azure-mgmt-billing/azure/mgmt/billing/models/billing_account_list_result.py new file mode 100644 index 000000000000..67d85d82207c --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/models/billing_account_list_result.py @@ -0,0 +1,35 @@ +# 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 BillingAccountListResult(Model): + """Result of listing billing accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of billing accounts. + :vartype value: list[~azure.mgmt.billing.models.BillingAccountResult] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BillingAccountResult]'}, + } + + def __init__(self): + super(BillingAccountListResult, self).__init__() + self.value = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/billing_account_result.py b/azure-mgmt-billing/azure/mgmt/billing/models/billing_account_result.py new file mode 100644 index 000000000000..e467dd743b7f --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/models/billing_account_result.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class BillingAccountResult(Resource): + """A billing account resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar principal_name: The account owner's principal name. + :vartype principal_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'principal_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, + } + + def __init__(self): + super(BillingAccountResult, self).__init__() + self.principal_name = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/billing_period.py b/azure-mgmt-billing/azure/mgmt/billing/models/billing_period.py old mode 100755 new mode 100644 index 16525fd72993..a8a38c17d40f --- a/azure-mgmt-billing/azure/mgmt/billing/models/billing_period.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/billing_period.py @@ -31,7 +31,7 @@ class BillingPeriod(Resource): billing period. :vartype billing_period_end_date: date :ivar invoice_ids: Array of invoice ids that associated with. - :vartype invoice_ids: list of str + :vartype invoice_ids: list[str] """ _validation = { diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/billing_period_paged.py b/azure-mgmt-billing/azure/mgmt/billing/models/billing_period_paged.py old mode 100755 new mode 100644 index bd249f5a2ba3..54fd2546182b --- a/azure-mgmt-billing/azure/mgmt/billing/models/billing_period_paged.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/billing_period_paged.py @@ -14,7 +14,7 @@ class BillingPeriodPaged(Paged): """ - A paging container for iterating over a list of BillingPeriod object + A paging container for iterating over a list of :class:`BillingPeriod ` object """ _attribute_map = { diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/download_url.py b/azure-mgmt-billing/azure/mgmt/billing/models/download_url.py old mode 100755 new mode 100644 index c84246ea10b0..175264024ae9 --- a/azure-mgmt-billing/azure/mgmt/billing/models/download_url.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/download_url.py @@ -36,5 +36,6 @@ class DownloadUrl(Model): } def __init__(self): + super(DownloadUrl, self).__init__() self.expiry_time = None self.url = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/error_details.py b/azure-mgmt-billing/azure/mgmt/billing/models/error_details.py old mode 100755 new mode 100644 index c86f0de9e1ff..91d77d6df46b --- a/azure-mgmt-billing/azure/mgmt/billing/models/error_details.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/error_details.py @@ -39,6 +39,7 @@ class ErrorDetails(Model): } def __init__(self): + super(ErrorDetails, self).__init__() self.code = None self.message = None self.target = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/error_response.py b/azure-mgmt-billing/azure/mgmt/billing/models/error_response.py old mode 100755 new mode 100644 index d0d3dbf1f548..06441e8c4e75 --- a/azure-mgmt-billing/azure/mgmt/billing/models/error_response.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/error_response.py @@ -18,8 +18,7 @@ class ErrorResponse(Model): incoming request. The reason is provided in the error message. :param error: The details of the error. - :type error: :class:`ErrorDetails - ` + :type error: ~azure.mgmt.billing.models.ErrorDetails """ _attribute_map = { @@ -27,6 +26,7 @@ class ErrorResponse(Model): } def __init__(self, error=None): + super(ErrorResponse, self).__init__() self.error = error diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/invoice.py b/azure-mgmt-billing/azure/mgmt/billing/models/invoice.py old mode 100755 new mode 100644 index 2e9abfe01af4..c97af83790a2 --- a/azure-mgmt-billing/azure/mgmt/billing/models/invoice.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/invoice.py @@ -26,8 +26,7 @@ class Invoice(Resource): :vartype type: str :param download_url: A secure link to download the PDF version of an invoice. The link will cease to work after its expiry time is reached. - :type download_url: :class:`DownloadUrl - ` + :type download_url: ~azure.mgmt.billing.models.DownloadUrl :ivar invoice_period_start_date: The start of the date range covered by the invoice. :vartype invoice_period_start_date: date @@ -36,7 +35,7 @@ class Invoice(Resource): :vartype invoice_period_end_date: date :ivar billing_period_ids: Array of billing perdiod ids that the invoice is attributed to. - :vartype billing_period_ids: list of str + :vartype billing_period_ids: list[str] """ _validation = { diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/invoice_paged.py b/azure-mgmt-billing/azure/mgmt/billing/models/invoice_paged.py old mode 100755 new mode 100644 index 9c61c3e1e935..500bcafab923 --- a/azure-mgmt-billing/azure/mgmt/billing/models/invoice_paged.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/invoice_paged.py @@ -14,7 +14,7 @@ class InvoicePaged(Paged): """ - A paging container for iterating over a list of Invoice object + A paging container for iterating over a list of :class:`Invoice ` object """ _attribute_map = { diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/operation.py b/azure-mgmt-billing/azure/mgmt/billing/models/operation.py old mode 100755 new mode 100644 index bf1237190fec..c2aae214fd34 --- a/azure-mgmt-billing/azure/mgmt/billing/models/operation.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/operation.py @@ -21,8 +21,7 @@ class Operation(Model): :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str :param display: The object that represents the operation. - :type display: :class:`OperationDisplay - ` + :type display: ~azure.mgmt.billing.models.OperationDisplay """ _validation = { @@ -35,5 +34,6 @@ class Operation(Model): } def __init__(self, display=None): + super(Operation, self).__init__() self.name = None self.display = display diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/operation_display.py b/azure-mgmt-billing/azure/mgmt/billing/models/operation_display.py old mode 100755 new mode 100644 index 2567a9a8d39f..0dcad2d20d02 --- a/azure-mgmt-billing/azure/mgmt/billing/models/operation_display.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/operation_display.py @@ -40,6 +40,7 @@ class OperationDisplay(Model): } def __init__(self): + super(OperationDisplay, self).__init__() self.provider = None self.resource = None self.operation = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/operation_paged.py b/azure-mgmt-billing/azure/mgmt/billing/models/operation_paged.py old mode 100755 new mode 100644 index 09def13d5ae2..434d72d13b22 --- a/azure-mgmt-billing/azure/mgmt/billing/models/operation_paged.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/operation_paged.py @@ -14,7 +14,7 @@ class OperationPaged(Paged): """ - A paging container for iterating over a list of Operation object + A paging container for iterating over a list of :class:`Operation ` object """ _attribute_map = { diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/resource.py b/azure-mgmt-billing/azure/mgmt/billing/models/resource.py old mode 100755 new mode 100644 index 78dd22195309..ff02c012b072 --- a/azure-mgmt-billing/azure/mgmt/billing/models/resource.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/resource.py @@ -39,6 +39,7 @@ class Resource(Model): } def __init__(self): + super(Resource, self).__init__() self.id = None self.name = None self.type = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py old mode 100755 new mode 100644 index 61e3f170a1d1..e5748fe59f07 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py @@ -9,11 +9,13 @@ # regenerated. # -------------------------------------------------------------------------- +from .billing_accounts_operations import BillingAccountsOperations from .billing_periods_operations import BillingPeriodsOperations from .invoices_operations import InvoicesOperations from .operations import Operations __all__ = [ + 'BillingAccountsOperations', 'BillingPeriodsOperations', 'InvoicesOperations', 'Operations', diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_accounts_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_accounts_operations.py new file mode 100644 index 000000000000..2c89009b5c34 --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_accounts_operations.py @@ -0,0 +1,145 @@ +# 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 BillingAccountsOperations(object): + """BillingAccountsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists the billing accounts the caller has access to. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingAccountListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingAccountListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BillingAccountListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts'} + + def get( + self, name, custom_headers=None, raw=False, **operation_config): + """Gets a billing account by name. + + :param name: Billing Account name. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BillingAccountResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingAccountResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BillingAccountResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{name}'} 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 old mode 100755 new mode 100644 index b988bc54bbce..7f382587610d --- a/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/billing_periods_operations.py @@ -9,8 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.pipeline import ClientRawResponse import uuid +from msrest.pipeline import ClientRawResponse from .. import models @@ -21,23 +21,28 @@ class BillingPeriodsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2017-04-24-preview. Constant value: "2017-04-24-preview". + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". """ + models = models + def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-04-24-preview" + self.api_version = "2018-03-01-preview" self.config = config def list( self, filter=None, skiptoken=None, top=None, custom_headers=None, raw=False, **operation_config): """Lists the available billing periods for a subscription in reverse - chronological order. + chronological order. This is only supported for Azure Web-Direct + subscriptions. Other subscription types which were not purchased + directly through the Azure web portal are not supported through this + preview API. :param filter: May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', @@ -56,8 +61,9 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: :class:`BillingPeriodPaged - ` + :return: An iterator like instance of BillingPeriod + :rtype: + ~azure.mgmt.billing.models.BillingPeriodPaged[~azure.mgmt.billing.models.BillingPeriod] :raises: :class:`ErrorResponseException` """ @@ -65,7 +71,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods' + url = self.list.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -98,7 +104,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -114,10 +120,14 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods'} def get( self, billing_period_name, custom_headers=None, raw=False, **operation_config): - """Gets a named billing period. + """Gets a named billing period. This is only supported for Azure + Web-Direct subscriptions. Other subscription types which were not + purchased directly through the Azure web portal are not supported + through this preview API. :param billing_period_name: The name of a BillingPeriod resource. :type billing_period_name: str @@ -126,15 +136,14 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: :class:`BillingPeriod - ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: BillingPeriod or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.BillingPeriod or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' + url = self.get.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') @@ -157,7 +166,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -172,3 +181,4 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py old mode 100755 new mode 100644 index 922b2ac4b4f8..e56ced653ad8 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/invoices_operations.py @@ -9,8 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.pipeline import ClientRawResponse import uuid +from msrest.pipeline import ClientRawResponse from .. import models @@ -21,16 +21,18 @@ class InvoicesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2017-04-24-preview. Constant value: "2017-04-24-preview". + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". """ + models = models + def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-04-24-preview" + self.api_version = "2018-03-01-preview" self.config = config @@ -39,7 +41,10 @@ def list( """Lists the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end - December 1, 2016 or later. + December 1, 2016 or later. This is only supported for Azure Web-Direct + subscriptions. Other subscription types which were not purchased + directly through the Azure web portal are not supported through this + preview API. :param expand: May be used to expand the downloadUrl property within a list of invoices. This enables download links to be generated for @@ -63,7 +68,9 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: :class:`InvoicePaged ` + :return: An iterator like instance of Invoice + :rtype: + ~azure.mgmt.billing.models.InvoicePaged[~azure.mgmt.billing.models.Invoice] :raises: :class:`ErrorResponseException` """ @@ -71,7 +78,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices' + url = self.list.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -106,7 +113,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -122,11 +129,15 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices'} def get( self, invoice_name, custom_headers=None, raw=False, **operation_config): """Gets a named invoice resource. When getting a single invoice, the - downloadUrl property is expanded automatically. + downloadUrl property is expanded automatically. This is only supported + for Azure Web-Direct subscriptions. Other subscription types which were + not purchased directly through the Azure web portal are not supported + through this preview API. :param invoice_name: The name of an invoice resource. :type invoice_name: str @@ -135,14 +146,14 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: :class:`Invoice ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: Invoice or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Invoice or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/{invoiceName}' + url = self.get.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'invoiceName': self._serialize.url("invoice_name", invoice_name, 'str') @@ -165,7 +176,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -180,25 +191,29 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/{invoiceName}'} def get_latest( self, custom_headers=None, raw=False, **operation_config): """Gets the most recent invoice. When getting a single invoice, the - downloadUrl property is expanded automatically. + downloadUrl property is expanded automatically. This is only supported + for Azure Web-Direct subscriptions. Other subscription types which were + not purchased directly through the Azure web portal are not supported + through this preview API. :param 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`. - :rtype: :class:`Invoice ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: Invoice or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Invoice or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/latest' + url = self.get_latest.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -220,7 +235,7 @@ def get_latest( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -235,3 +250,4 @@ def get_latest( return client_raw_response return deserialized + get_latest.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/latest'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py old mode 100755 new mode 100644 index bf14e6815f12..5d38dd4b2ce2 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/operations.py @@ -9,8 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.pipeline import ClientRawResponse import uuid +from msrest.pipeline import ClientRawResponse from .. import models @@ -21,16 +21,18 @@ class Operations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2017-04-24-preview. Constant value: "2017-04-24-preview". + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-01-preview. Constant value: "2018-03-01-preview". """ + models = models + def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-04-24-preview" + self.api_version = "2018-03-01-preview" self.config = config @@ -43,8 +45,9 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: :class:`OperationPaged - ` + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.billing.models.OperationPaged[~azure.mgmt.billing.models.Operation] :raises: :class:`ErrorResponseException` """ @@ -52,7 +55,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/providers/Microsoft.Billing/operations' + url = self.list.metadata['url'] # Construct parameters query_parameters = {} @@ -75,7 +78,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -91,3 +94,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/providers/Microsoft.Billing/operations'} diff --git a/azure-mgmt-billing/azure/mgmt/billing/version.py b/azure-mgmt-billing/azure/mgmt/billing/version.py old mode 100755 new mode 100644 index e0ec669828cb..623d610ecc13 --- a/azure-mgmt-billing/azure/mgmt/billing/version.py +++ b/azure-mgmt-billing/azure/mgmt/billing/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0" +VERSION = "2018-03-01-preview"