From 6dedc94f5af091d707b3c71ba1105e2b8af23775 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 5 Feb 2019 14:27:56 -0800 Subject: [PATCH] [AutoPR consumption/resource-manager] [Hub Generated] Review request for Microsoft.Consumption to add version 2019-01-01 (#4292) * Generated from a2b1e8bc09063a59d349ebe4a093416dbbb719b7 updated readme to support new stable version 2019-01-01 * Packaging update of azure-mgmt-consumption * Generated from ac1beddbdb7477174b9b956c4eabd6462f2996db introducing MG scope for tags/budgets introduce scope (method) parameter for APIs that support numerous scopes (arm-team suggestion implemented) --- azure-mgmt-consumption/README.rst | 19 - .../consumption_management_client.py | 32 +- .../azure/mgmt/consumption/models/__init__.py | 4 +- .../mgmt/consumption/models/query_options.py | 2 +- .../consumption/models/query_options_py3.py | 2 +- .../mgmt/consumption/operations/__init__.py | 12 +- .../operations/aggregated_cost_operations.py | 4 +- .../operations/balances_operations.py | 4 +- .../operations/budgets_operations.py | 340 ++---- .../operations/charges_operations.py | 244 +---- .../operations/forecasts_operations.py | 4 +- .../operations/marketplaces_operations.py | 830 +-------------- .../mgmt/consumption/operations/operations.py | 4 +- .../operations/price_sheet_operations.py | 4 +- .../reservation_recommendations_operations.py | 4 +- .../reservations_details_operations.py | 4 +- .../reservations_summaries_operations.py | 4 +- .../consumption/operations/tags_operations.py | 29 +- .../operations/usage_details_operations.py | 980 +----------------- 19 files changed, 203 insertions(+), 2323 deletions(-) diff --git a/azure-mgmt-consumption/README.rst b/azure-mgmt-consumption/README.rst index 45de4e6b43ddb..d0429ebc7565a 100644 --- a/azure-mgmt-consumption/README.rst +++ b/azure-mgmt-consumption/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-consumption/azure/mgmt/consumption/consumption_management_client.py b/azure-mgmt-consumption/azure/mgmt/consumption/consumption_management_client.py index d64b6e7d1e73b..7524d73c91218 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/consumption_management_client.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/consumption_management_client.py @@ -15,17 +15,17 @@ from .version import VERSION from .operations.usage_details_operations import UsageDetailsOperations from .operations.marketplaces_operations import MarketplacesOperations +from .operations.budgets_operations import BudgetsOperations +from .operations.tags_operations import TagsOperations +from .operations.charges_operations import ChargesOperations from .operations.balances_operations import BalancesOperations from .operations.reservations_summaries_operations import ReservationsSummariesOperations from .operations.reservations_details_operations import ReservationsDetailsOperations from .operations.reservation_recommendations_operations import ReservationRecommendationsOperations -from .operations.budgets_operations import BudgetsOperations from .operations.price_sheet_operations import PriceSheetOperations -from .operations.tags_operations import TagsOperations from .operations.forecasts_operations import ForecastsOperations from .operations.operations import Operations from .operations.aggregated_cost_operations import AggregatedCostOperations -from .operations.charges_operations import ChargesOperations from . import models @@ -71,6 +71,12 @@ class ConsumptionManagementClient(SDKClient): :vartype usage_details: azure.mgmt.consumption.operations.UsageDetailsOperations :ivar marketplaces: Marketplaces operations :vartype marketplaces: azure.mgmt.consumption.operations.MarketplacesOperations + :ivar budgets: Budgets operations + :vartype budgets: azure.mgmt.consumption.operations.BudgetsOperations + :ivar tags: Tags operations + :vartype tags: azure.mgmt.consumption.operations.TagsOperations + :ivar charges: Charges operations + :vartype charges: azure.mgmt.consumption.operations.ChargesOperations :ivar balances: Balances operations :vartype balances: azure.mgmt.consumption.operations.BalancesOperations :ivar reservations_summaries: ReservationsSummaries operations @@ -79,20 +85,14 @@ class ConsumptionManagementClient(SDKClient): :vartype reservations_details: azure.mgmt.consumption.operations.ReservationsDetailsOperations :ivar reservation_recommendations: ReservationRecommendations operations :vartype reservation_recommendations: azure.mgmt.consumption.operations.ReservationRecommendationsOperations - :ivar budgets: Budgets operations - :vartype budgets: azure.mgmt.consumption.operations.BudgetsOperations :ivar price_sheet: PriceSheet operations :vartype price_sheet: azure.mgmt.consumption.operations.PriceSheetOperations - :ivar tags: Tags operations - :vartype tags: azure.mgmt.consumption.operations.TagsOperations :ivar forecasts: Forecasts operations :vartype forecasts: azure.mgmt.consumption.operations.ForecastsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.consumption.operations.Operations :ivar aggregated_cost: AggregatedCost operations :vartype aggregated_cost: azure.mgmt.consumption.operations.AggregatedCostOperations - :ivar charges: Charges operations - :vartype charges: azure.mgmt.consumption.operations.ChargesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -109,7 +109,7 @@ def __init__( super(ConsumptionManagementClient, 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-10-01' + self.api_version = '2019-01-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -117,6 +117,12 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.marketplaces = MarketplacesOperations( self._client, self.config, self._serialize, self._deserialize) + self.budgets = BudgetsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.tags = TagsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.charges = ChargesOperations( + self._client, self.config, self._serialize, self._deserialize) self.balances = BalancesOperations( self._client, self.config, self._serialize, self._deserialize) self.reservations_summaries = ReservationsSummariesOperations( @@ -125,17 +131,11 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.reservation_recommendations = ReservationRecommendationsOperations( self._client, self.config, self._serialize, self._deserialize) - self.budgets = BudgetsOperations( - self._client, self.config, self._serialize, self._deserialize) self.price_sheet = PriceSheetOperations( self._client, self.config, self._serialize, self._deserialize) - self.tags = TagsOperations( - self._client, self.config, self._serialize, self._deserialize) self.forecasts = ForecastsOperations( self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) self.aggregated_cost = AggregatedCostOperations( self._client, self.config, self._serialize, self._deserialize) - self.charges = ChargesOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py index 5929f28945df3..486cbc9695fbc 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py @@ -75,10 +75,10 @@ from .query_options import QueryOptions from .usage_detail_paged import UsageDetailPaged from .marketplace_paged import MarketplacePaged +from .budget_paged import BudgetPaged from .reservation_summary_paged import ReservationSummaryPaged from .reservation_detail_paged import ReservationDetailPaged from .reservation_recommendation_paged import ReservationRecommendationPaged -from .budget_paged import BudgetPaged from .forecast_paged import ForecastPaged from .operation_paged import OperationPaged from .consumption_management_client_enums import ( @@ -126,10 +126,10 @@ 'QueryOptions', 'UsageDetailPaged', 'MarketplacePaged', + 'BudgetPaged', 'ReservationSummaryPaged', 'ReservationDetailPaged', 'ReservationRecommendationPaged', - 'BudgetPaged', 'ForecastPaged', 'OperationPaged', 'BillingFrequency', diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/query_options.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/query_options.py index 6b327e55fe31a..138f41fe17ade 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/query_options.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/query_options.py @@ -13,7 +13,7 @@ class QueryOptions(Model): - """Additional parameters for a set of operations. + """Additional parameters for list operation. :param apply: OData apply expression to aggregate usageDetails by tags or (tags and properties/usageStart) diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/query_options_py3.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/query_options_py3.py index 073f04526ac36..c397d22ed6ec4 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/query_options_py3.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/query_options_py3.py @@ -13,7 +13,7 @@ class QueryOptions(Model): - """Additional parameters for a set of operations. + """Additional parameters for list operation. :param apply: OData apply expression to aggregate usageDetails by tags or (tags and properties/usageStart) diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/__init__.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/__init__.py index 447570487ba76..f778b44f01719 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/__init__.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/__init__.py @@ -11,30 +11,30 @@ from .usage_details_operations import UsageDetailsOperations from .marketplaces_operations import MarketplacesOperations +from .budgets_operations import BudgetsOperations +from .tags_operations import TagsOperations +from .charges_operations import ChargesOperations from .balances_operations import BalancesOperations from .reservations_summaries_operations import ReservationsSummariesOperations from .reservations_details_operations import ReservationsDetailsOperations from .reservation_recommendations_operations import ReservationRecommendationsOperations -from .budgets_operations import BudgetsOperations from .price_sheet_operations import PriceSheetOperations -from .tags_operations import TagsOperations from .forecasts_operations import ForecastsOperations from .operations import Operations from .aggregated_cost_operations import AggregatedCostOperations -from .charges_operations import ChargesOperations __all__ = [ 'UsageDetailsOperations', 'MarketplacesOperations', + 'BudgetsOperations', + 'TagsOperations', + 'ChargesOperations', 'BalancesOperations', 'ReservationsSummariesOperations', 'ReservationsDetailsOperations', 'ReservationRecommendationsOperations', - 'BudgetsOperations', 'PriceSheetOperations', - 'TagsOperations', 'ForecastsOperations', 'Operations', 'AggregatedCostOperations', - 'ChargesOperations', ] diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/aggregated_cost_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/aggregated_cost_operations.py index ee39f0c76d203..31202cfa3085d 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/aggregated_cost_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/aggregated_cost_operations.py @@ -22,7 +22,7 @@ class AggregatedCostOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ 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-10-01" + self.api_version = "2019-01-01" self.config = config diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/balances_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/balances_operations.py index d9e2c228689b0..2903dae27261b 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/balances_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/balances_operations.py @@ -22,7 +22,7 @@ class BalancesOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ 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-10-01" + self.api_version = "2019-01-01" self.config = config diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/budgets_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/budgets_operations.py index c1410dfba100b..110f5ad241898 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/budgets_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/budgets_operations.py @@ -22,7 +22,7 @@ class BudgetsOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ models = models @@ -32,14 +32,27 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-10-01" + self.api_version = "2019-01-01" self.config = config def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all budgets for a subscription. - + self, scope, custom_headers=None, raw=False, **operation_config): + """Lists all budgets for the defined scope. + + :param scope: The scope associated with budget operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope and + '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope.. + :type scope: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -57,73 +70,7 @@ def internal_paging(next_link=None, raw=False): # Construct URL url = self.list.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - 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.BudgetPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.BudgetPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets'} - - def list_by_resource_group_name( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Lists all budgets for a resource group under a subscription. - - :param resource_group_name: Azure Resource Group Name. - :type resource_group_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 Budget - :rtype: - ~azure.mgmt.consumption.models.BudgetPaged[~azure.mgmt.consumption.models.Budget] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_resource_group_name.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -163,12 +110,25 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized - list_by_resource_group_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets'} + list.metadata = {'url': '/{scope}/providers/Microsoft.Consumption/budgets'} def get( - self, budget_name, custom_headers=None, raw=False, **operation_config): - """Gets the budget for a subscription by budget name. - + self, scope, budget_name, custom_headers=None, raw=False, **operation_config): + """Gets the budget for the scope by budget name. + + :param scope: The scope associated with budget operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope and + '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope.. + :type scope: str :param budget_name: Budget Name. :type budget_name: str :param dict custom_headers: headers that will be added to the request @@ -185,7 +145,7 @@ def get( # Construct URL url = self.get.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'budgetName': self._serialize.url("budget_name", budget_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -221,15 +181,28 @@ def get( return client_raw_response return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}'} + get.metadata = {'url': '/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}'} def create_or_update( - self, budget_name, parameters, custom_headers=None, raw=False, **operation_config): + self, scope, budget_name, parameters, custom_headers=None, raw=False, **operation_config): """The operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + :param scope: The scope associated with budget operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope and + '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope.. + :type scope: str :param budget_name: Budget Name. :type budget_name: str :param parameters: Parameters supplied to the Create Budget operation. @@ -248,7 +221,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'budgetName': self._serialize.url("budget_name", budget_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -290,12 +263,25 @@ def create_or_update( return client_raw_response return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}'} + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}'} def delete( - self, budget_name, custom_headers=None, raw=False, **operation_config): + self, scope, budget_name, custom_headers=None, raw=False, **operation_config): """The operation to delete a budget. + :param scope: The scope associated with budget operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope and + '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope.. + :type scope: str :param budget_name: Budget Name. :type budget_name: str :param dict custom_headers: headers that will be added to the request @@ -311,193 +297,7 @@ def delete( # Construct URL url = self.delete.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'budgetName': self._serialize.url("budget_name", budget_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 = {} - 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) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}'} - - def get_by_resource_group_name( - self, resource_group_name, budget_name, custom_headers=None, raw=False, **operation_config): - """Gets the budget for a resource group under a subscription by budget - name. - - :param resource_group_name: Azure Resource Group Name. - :type resource_group_name: str - :param budget_name: Budget Name. - :type budget_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: Budget or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.Budget or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.get_by_resource_group_name.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'budgetName': self._serialize.url("budget_name", budget_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('Budget', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get_by_resource_group_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets/{budgetName}'} - - def create_or_update_by_resource_group_name( - self, resource_group_name, budget_name, parameters, custom_headers=None, raw=False, **operation_config): - """The operation to create or update a budget. Update operation requires - latest eTag to be set in the request mandatorily. You may obtain the - latest eTag by performing a get operation. Create operation does not - require eTag. - - :param resource_group_name: Azure Resource Group Name. - :type resource_group_name: str - :param budget_name: Budget Name. - :type budget_name: str - :param parameters: Parameters supplied to the Create Budget operation. - :type parameters: ~azure.mgmt.consumption.models.Budget - :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: Budget or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.Budget or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.create_or_update_by_resource_group_name.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'budgetName': self._serialize.url("budget_name", budget_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, 'Budget') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Budget', response) - if response.status_code == 201: - deserialized = self._deserialize('Budget', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create_or_update_by_resource_group_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets/{budgetName}'} - - def delete_by_resource_group_name( - self, resource_group_name, budget_name, custom_headers=None, raw=False, **operation_config): - """The operation to delete a budget. - - :param resource_group_name: Azure Resource Group Name. - :type resource_group_name: str - :param budget_name: Budget Name. - :type budget_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.delete_by_resource_group_name.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'budgetName': self._serialize.url("budget_name", budget_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -525,4 +325,4 @@ def delete_by_resource_group_name( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - delete_by_resource_group_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets/{budgetName}'} + delete.metadata = {'url': '/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/charges_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/charges_operations.py index f81f3e0d77db0..4363d3de914ed 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/charges_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/charges_operations.py @@ -22,7 +22,7 @@ class ChargesOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ models = models @@ -32,227 +32,25 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-10-01" + self.api_version = "2019-01-01" self.config = config - def list_by_enrollment_account( - self, billing_account_id, enrollment_account_id, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists the charges by enrollmentAccountId. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str - :param enrollment_account_id: EnrollmentAccount ID - :type enrollment_account_id: str - :param filter: May be used to filter charges by properties/usageEnd - (Utc time), properties/usageStart (Utc time). 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: ChargesListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.ChargesListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list_by_enrollment_account.metadata['url'] - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - 'enrollmentAccountId': self._serialize.url("enrollment_account_id", enrollment_account_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - # 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('ChargesListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list_by_enrollment_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Consumption/charges'} - - def list_for_billing_period_by_enrollment_account( - self, billing_account_id, enrollment_account_id, billing_period_name, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists the charges based on enrollmentAccountId by billing period. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str - :param enrollment_account_id: EnrollmentAccount ID - :type enrollment_account_id: str - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param filter: May be used to filter charges by properties/usageEnd - (Utc time), properties/usageStart (Utc time). 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: ChargeSummary or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.ChargeSummary or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list_for_billing_period_by_enrollment_account.metadata['url'] - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - 'enrollmentAccountId': self._serialize.url("enrollment_account_id", enrollment_account_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - 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('ChargeSummary', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list_for_billing_period_by_enrollment_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/charges'} - - def list_by_department( - self, billing_account_id, department_id, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists the charges by departmentId. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str - :param department_id: Department ID - :type department_id: str - :param filter: May be used to filter charges by properties/usageEnd - (Utc time), properties/usageStart (Utc time). 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: ChargesListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.ChargesListResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list_by_department.metadata['url'] - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - 'departmentId': self._serialize.url("department_id", department_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - # 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('ChargesListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list_by_department.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Consumption/charges'} - - def list_for_billing_period_by_department( - self, billing_account_id, department_id, billing_period_name, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists the charges based on departmentId by billing period. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str - :param department_id: Department ID - :type department_id: str - :param billing_period_name: Billing Period Name. - :type billing_period_name: str + def list_by_scope( + self, scope, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the charges based for the defined scope. + + :param scope: The scope associated with usage details operations. This + includes + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope. For department and enrollment accounts, + you can also add billing period to the scope using + '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For + e.g. to specify billing period at department scope use + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' + :type scope: str :param filter: May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support @@ -271,11 +69,9 @@ def list_for_billing_period_by_department( :class:`ErrorResponseException` """ # Construct URL - url = self.list_for_billing_period_by_department.metadata['url'] + url = self.list_by_scope.metadata['url'] path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - 'departmentId': self._serialize.url("department_id", department_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -312,4 +108,4 @@ def list_for_billing_period_by_department( return client_raw_response return deserialized - list_for_billing_period_by_department.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/charges'} + list_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.Consumption/charges'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/forecasts_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/forecasts_operations.py index fb7e6399c204e..87648ab49a239 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/forecasts_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/forecasts_operations.py @@ -22,7 +22,7 @@ class ForecastsOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ 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-10-01" + self.api_version = "2019-01-01" self.config = config diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/marketplaces_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/marketplaces_operations.py index cd124e9d37b99..426a899988256 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/marketplaces_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/marketplaces_operations.py @@ -22,7 +22,7 @@ class MarketplacesOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ models = models @@ -32,16 +32,33 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-10-01" + self.api_version = "2019-01-01" self.config = config def list( - self, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): - """Lists the marketplaces for a scope by subscriptionId and current - billing period. Marketplaces are available via this API only for May 1, - 2014 or later. - + self, scope, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): + """Lists the marketplaces for a scope at the defined scope. Marketplaces + are available via this API only for May 1, 2014 or later. + + :param scope: The scope associated with marketplace operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + '/providers/Microsoft.Billing/departments/{departmentId}' for + Department scope, + '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope and + '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope. For subscription, billing account, + department, enrollment account and ManagementGroup, you can also add + billing period to the scope using + '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For + e.g. to specify billing period at department scope use + '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' + :type scope: str :param filter: May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or @@ -73,802 +90,7 @@ def internal_paging(next_link=None, raw=False): # Construct URL url = self.list.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - 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.MarketplacePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MarketplacePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/marketplaces'} - - def list_by_billing_period( - self, billing_period_name, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): - """Lists the marketplaces for a scope by billing period and - subscriptionId. Marketplaces are available via this API only for May 1, - 2014 or later. - - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param filter: May be used to filter marketplaces by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', - 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - :type filter: str - :param top: May be used to limit the number of results to the most - recent N marketplaces. - :type top: int - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Marketplace - :rtype: - ~azure.mgmt.consumption.models.MarketplacePaged[~azure.mgmt.consumption.models.Marketplace] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_billing_period.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - 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.MarketplacePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MarketplacePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_billing_period.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces'} - - def list_by_billing_account( - self, billing_account_id, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): - """Lists the marketplaces for a scope by billingAccountId and current - billing period. Marketplaces are available via this API only for May 1, - 2014 or later. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str - :param filter: May be used to filter marketplaces by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', - 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - :type filter: str - :param top: May be used to limit the number of results to the most - recent N marketplaces. - :type top: int - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Marketplace - :rtype: - ~azure.mgmt.consumption.models.MarketplacePaged[~azure.mgmt.consumption.models.Marketplace] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_billing_account.metadata['url'] - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - 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.MarketplacePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MarketplacePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/marketplaces'} - - def list_for_billing_period_by_billing_account( - self, billing_account_id, billing_period_name, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): - """Lists the marketplaces for a scope by billing period and - billingAccountId. Marketplaces are available via this API only for May - 1, 2014 or later. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param filter: May be used to filter marketplaces by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', - 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - :type filter: str - :param top: May be used to limit the number of results to the most - recent N marketplaces. - :type top: int - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Marketplace - :rtype: - ~azure.mgmt.consumption.models.MarketplacePaged[~azure.mgmt.consumption.models.Marketplace] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_for_billing_period_by_billing_account.metadata['url'] - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - 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.MarketplacePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MarketplacePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_for_billing_period_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces'} - - def list_by_department( - self, department_id, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): - """Lists the marketplaces for a scope by departmentId and current billing - period. Marketplaces are available via this API only for May 1, 2014 or - later. - - :param department_id: Department ID - :type department_id: str - :param filter: May be used to filter marketplaces by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', - 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - :type filter: str - :param top: May be used to limit the number of results to the most - recent N marketplaces. - :type top: int - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Marketplace - :rtype: - ~azure.mgmt.consumption.models.MarketplacePaged[~azure.mgmt.consumption.models.Marketplace] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_department.metadata['url'] - path_format_arguments = { - 'departmentId': self._serialize.url("department_id", department_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - 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.MarketplacePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MarketplacePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_department.metadata = {'url': '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Consumption/marketplaces'} - - def list_for_billing_period_by_department( - self, department_id, billing_period_name, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): - """Lists the marketplaces for a scope by billing period and departmentId. - Marketplaces are available via this API only for May 1, 2014 or later. - - :param department_id: Department ID - :type department_id: str - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param filter: May be used to filter marketplaces by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', - 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - :type filter: str - :param top: May be used to limit the number of results to the most - recent N marketplaces. - :type top: int - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Marketplace - :rtype: - ~azure.mgmt.consumption.models.MarketplacePaged[~azure.mgmt.consumption.models.Marketplace] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_for_billing_period_by_department.metadata['url'] - path_format_arguments = { - 'departmentId': self._serialize.url("department_id", department_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - 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.MarketplacePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MarketplacePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_for_billing_period_by_department.metadata = {'url': '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces'} - - def list_by_enrollment_account( - self, enrollment_account_id, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): - """Lists the marketplaces for a scope by enrollmentAccountId and current - billing period. Marketplaces are available via this API only for May 1, - 2014 or later. - - :param enrollment_account_id: EnrollmentAccount ID - :type enrollment_account_id: str - :param filter: May be used to filter marketplaces by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', - 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - :type filter: str - :param top: May be used to limit the number of results to the most - recent N marketplaces. - :type top: int - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Marketplace - :rtype: - ~azure.mgmt.consumption.models.MarketplacePaged[~azure.mgmt.consumption.models.Marketplace] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_enrollment_account.metadata['url'] - path_format_arguments = { - 'enrollmentAccountId': self._serialize.url("enrollment_account_id", enrollment_account_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - 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.MarketplacePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MarketplacePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_enrollment_account.metadata = {'url': '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Consumption/marketplaces'} - - def list_for_billing_period_by_enrollment_account( - self, enrollment_account_id, billing_period_name, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): - """Lists the marketplaces for a scope by billing period and - enrollmentAccountId. Marketplaces are available via this API only for - May 1, 2014 or later. - - :param enrollment_account_id: EnrollmentAccount ID - :type enrollment_account_id: str - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param filter: May be used to filter marketplaces by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', - 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - :type filter: str - :param top: May be used to limit the number of results to the most - recent N marketplaces. - :type top: int - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Marketplace - :rtype: - ~azure.mgmt.consumption.models.MarketplacePaged[~azure.mgmt.consumption.models.Marketplace] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_for_billing_period_by_enrollment_account.metadata['url'] - path_format_arguments = { - 'enrollmentAccountId': self._serialize.url("enrollment_account_id", enrollment_account_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - 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.MarketplacePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MarketplacePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_for_billing_period_by_enrollment_account.metadata = {'url': '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces'} - - def list_by_management_group( - self, management_group_id, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): - """Lists the marketplace records for all subscriptions belonging to a - management group scope by current billing period. Marketplaces are - available via this API only for May 1, 2014 or later. - - :param management_group_id: Azure Management Group ID. - :type management_group_id: str - :param filter: May be used to filter marketplaces by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', - 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - :type filter: str - :param top: May be used to limit the number of results to the most - recent N marketplaces. - :type top: int - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Marketplace - :rtype: - ~azure.mgmt.consumption.models.MarketplacePaged[~azure.mgmt.consumption.models.Marketplace] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_management_group.metadata['url'] - path_format_arguments = { - 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - 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.MarketplacePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MarketplacePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/marketplaces'} - - def list_for_billing_period_by_management_group( - self, management_group_id, billing_period_name, filter=None, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): - """Lists the marketplace records for all subscriptions belonging to a - management group scope by specified billing period. Marketplaces are - available via this API only for May 1, 2014 or later. - - :param management_group_id: Azure Management Group ID. - :type management_group_id: str - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param filter: May be used to filter marketplaces by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', - 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - :type filter: str - :param top: May be used to limit the number of results to the most - recent N marketplaces. - :type top: int - :param skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Marketplace - :rtype: - ~azure.mgmt.consumption.models.MarketplacePaged[~azure.mgmt.consumption.models.Marketplace] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_for_billing_period_by_management_group.metadata['url'] - path_format_arguments = { - 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -914,4 +136,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized - list_for_billing_period_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces'} + list.metadata = {'url': '/{scope}/providers/Microsoft.Consumption/marketplaces'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/operations.py index 770af693af72b..0374608d07ba3 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ 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-10-01" + self.api_version = "2019-01-01" self.config = config diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/price_sheet_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/price_sheet_operations.py index eaaf6e2321e47..ff9bc16dfbb1d 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/price_sheet_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/price_sheet_operations.py @@ -22,7 +22,7 @@ class PriceSheetOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ 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-10-01" + self.api_version = "2019-01-01" self.config = config diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservation_recommendations_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservation_recommendations_operations.py index 01e382e4c22c6..abeaf315c91b2 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservation_recommendations_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservation_recommendations_operations.py @@ -22,7 +22,7 @@ class ReservationRecommendationsOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ 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-10-01" + self.api_version = "2019-01-01" self.config = config diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_details_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_details_operations.py index 96cebc8bea4c6..4185816146e3d 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_details_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_details_operations.py @@ -22,7 +22,7 @@ class ReservationsDetailsOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ 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-10-01" + self.api_version = "2019-01-01" self.config = config diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_summaries_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_summaries_operations.py index 7bf71e34b28db..8cf4057c120d0 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_summaries_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_summaries_operations.py @@ -22,7 +22,7 @@ class ReservationsSummariesOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ 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-10-01" + self.api_version = "2019-01-01" self.config = config diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/tags_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/tags_operations.py index b5b46045bef9d..f0c5aeefd0670 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/tags_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/tags_operations.py @@ -22,7 +22,7 @@ class TagsOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ models = models @@ -32,16 +32,27 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-10-01" + self.api_version = "2019-01-01" self.config = config def get( - self, billing_account_id, custom_headers=None, raw=False, **operation_config): - """Get all available tag keys for a billing account. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str + self, scope, custom_headers=None, raw=False, **operation_config): + """Get all available tag keys for the defined scope. + + :param scope: The scope associated with tags operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope and + '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope.. + :type scope: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -56,7 +67,7 @@ def get( # Construct URL url = self.get.metadata['url'] path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str') + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -91,4 +102,4 @@ def get( return client_raw_response return deserialized - get.metadata = {'url': '/providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/tags'} + get.metadata = {'url': '/{scope}/providers/Microsoft.Consumption/tags'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/usage_details_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/usage_details_operations.py index 3979ab21614ae..2c7e4ffdf9b07 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/usage_details_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/usage_details_operations.py @@ -22,7 +22,7 @@ class UsageDetailsOperations(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-10-01. Constant value: "2018-10-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-01-01. Constant value: "2019-01-01". """ models = models @@ -32,856 +32,33 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-10-01" + self.api_version = "2019-01-01" self.config = config def list( - self, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): - """Lists the usage details for a scope by current billing period. Usage - details are available via this API only for May 1, 2014 or later. - - :param expand: May be used to expand the - properties/additionalProperties or properties/meterDetails within a - list of usage details. By default, these fields are not included when - listing usage details. - :type expand: str - :param filter: May be used to filter usageDetails by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName, - properties/instanceId or tags. 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 skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N usageDetails. - :type top: int - :param query_options: Additional parameters for the operation - :type query_options: ~azure.mgmt.consumption.models.QueryOptions - :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 UsageDetail - :rtype: - ~azure.mgmt.consumption.models.UsageDetailPaged[~azure.mgmt.consumption.models.UsageDetail] - :raises: - :class:`ErrorResponseException` - """ - apply = None - if query_options is not None: - apply = query_options.apply - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if apply is not None: - query_parameters['$apply'] = self._serialize.query("apply", apply, '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.UsageDetailPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/usageDetails'} - - def list_by_billing_period( - self, billing_period_name, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): - """Lists the usage details for a scope by billing period. Usage details - are available via this API only for May 1, 2014 or later. - - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param expand: May be used to expand the - properties/additionalProperties or properties/meterDetails within a - list of usage details. By default, these fields are not included when - listing usage details. - :type expand: str - :param filter: May be used to filter usageDetails by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. 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 skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N usageDetails. - :type top: int - :param query_options: Additional parameters for the operation - :type query_options: ~azure.mgmt.consumption.models.QueryOptions - :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 UsageDetail - :rtype: - ~azure.mgmt.consumption.models.UsageDetailPaged[~azure.mgmt.consumption.models.UsageDetail] - :raises: - :class:`ErrorResponseException` - """ - apply = None - if query_options is not None: - apply = query_options.apply - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_billing_period.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if apply is not None: - query_parameters['$apply'] = self._serialize.query("apply", apply, '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.UsageDetailPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_billing_period.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'} - - def list_by_billing_account( - self, billing_account_id, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): - """Lists the usage details by billingAccountId for a scope by current - billing period. Usage details are available via this API only for May - 1, 2014 or later. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str - :param expand: May be used to expand the - properties/additionalProperties or properties/meterDetails within a - list of usage details. By default, these fields are not included when - listing usage details. - :type expand: str - :param filter: May be used to filter usageDetails by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName, - properties/instanceId or tags. 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 skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N usageDetails. - :type top: int - :param query_options: Additional parameters for the operation - :type query_options: ~azure.mgmt.consumption.models.QueryOptions - :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 UsageDetail - :rtype: - ~azure.mgmt.consumption.models.UsageDetailPaged[~azure.mgmt.consumption.models.UsageDetail] - :raises: - :class:`ErrorResponseException` - """ - apply = None - if query_options is not None: - apply = query_options.apply - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_billing_account.metadata['url'] - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if apply is not None: - query_parameters['$apply'] = self._serialize.query("apply", apply, '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.UsageDetailPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/usageDetails'} - - def list_for_billing_period_by_billing_account( - self, billing_account_id, billing_period_name, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): - """Lists the usage details based on billingAccountId for a scope by - billing period. Usage details are available via this API only for May - 1, 2014 or later. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param expand: May be used to expand the - properties/additionalProperties or properties/meterDetails within a - list of usage details. By default, these fields are not included when - listing usage details. - :type expand: str - :param filter: May be used to filter usageDetails by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. 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 skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N usageDetails. - :type top: int - :param query_options: Additional parameters for the operation - :type query_options: ~azure.mgmt.consumption.models.QueryOptions - :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 UsageDetail - :rtype: - ~azure.mgmt.consumption.models.UsageDetailPaged[~azure.mgmt.consumption.models.UsageDetail] - :raises: - :class:`ErrorResponseException` - """ - apply = None - if query_options is not None: - apply = query_options.apply - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_for_billing_period_by_billing_account.metadata['url'] - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if apply is not None: - query_parameters['$apply'] = self._serialize.query("apply", apply, '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.UsageDetailPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_for_billing_period_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'} - - def list_by_department( - self, department_id, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): - """Lists the usage details by departmentId for a scope by current billing - period. Usage details are available via this API only for May 1, 2014 - or later. - - :param department_id: Department ID - :type department_id: str - :param expand: May be used to expand the - properties/additionalProperties or properties/meterDetails within a - list of usage details. By default, these fields are not included when - listing usage details. - :type expand: str - :param filter: May be used to filter usageDetails by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName, - properties/instanceId or tags. 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 skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N usageDetails. - :type top: int - :param query_options: Additional parameters for the operation - :type query_options: ~azure.mgmt.consumption.models.QueryOptions - :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 UsageDetail - :rtype: - ~azure.mgmt.consumption.models.UsageDetailPaged[~azure.mgmt.consumption.models.UsageDetail] - :raises: - :class:`ErrorResponseException` - """ - apply = None - if query_options is not None: - apply = query_options.apply - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_department.metadata['url'] - path_format_arguments = { - 'departmentId': self._serialize.url("department_id", department_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if apply is not None: - query_parameters['$apply'] = self._serialize.query("apply", apply, '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.UsageDetailPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_department.metadata = {'url': '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Consumption/usageDetails'} - - def list_for_billing_period_by_department( - self, department_id, billing_period_name, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): - """Lists the usage details based on departmentId for a scope by billing - period. Usage details are available via this API only for May 1, 2014 - or later. - - :param department_id: Department ID - :type department_id: str - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param expand: May be used to expand the - properties/additionalProperties or properties/meterDetails within a - list of usage details. By default, these fields are not included when - listing usage details. - :type expand: str - :param filter: May be used to filter usageDetails by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. 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 skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N usageDetails. - :type top: int - :param query_options: Additional parameters for the operation - :type query_options: ~azure.mgmt.consumption.models.QueryOptions - :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 UsageDetail - :rtype: - ~azure.mgmt.consumption.models.UsageDetailPaged[~azure.mgmt.consumption.models.UsageDetail] - :raises: - :class:`ErrorResponseException` - """ - apply = None - if query_options is not None: - apply = query_options.apply - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_for_billing_period_by_department.metadata['url'] - path_format_arguments = { - 'departmentId': self._serialize.url("department_id", department_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if apply is not None: - query_parameters['$apply'] = self._serialize.query("apply", apply, '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.UsageDetailPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_for_billing_period_by_department.metadata = {'url': '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'} - - def list_by_enrollment_account( - self, enrollment_account_id, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): - """Lists the usage details by enrollmentAccountId for a scope by current - billing period. Usage details are available via this API only for May - 1, 2014 or later. - - :param enrollment_account_id: EnrollmentAccount ID - :type enrollment_account_id: str - :param expand: May be used to expand the - properties/additionalProperties or properties/meterDetails within a - list of usage details. By default, these fields are not included when - listing usage details. - :type expand: str - :param filter: May be used to filter usageDetails by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName, - properties/instanceId or tags. 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 skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N usageDetails. - :type top: int - :param query_options: Additional parameters for the operation - :type query_options: ~azure.mgmt.consumption.models.QueryOptions - :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 UsageDetail - :rtype: - ~azure.mgmt.consumption.models.UsageDetailPaged[~azure.mgmt.consumption.models.UsageDetail] - :raises: - :class:`ErrorResponseException` - """ - apply = None - if query_options is not None: - apply = query_options.apply - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_enrollment_account.metadata['url'] - path_format_arguments = { - 'enrollmentAccountId': self._serialize.url("enrollment_account_id", enrollment_account_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if apply is not None: - query_parameters['$apply'] = self._serialize.query("apply", apply, '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.UsageDetailPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_enrollment_account.metadata = {'url': '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Consumption/usageDetails'} - - def list_for_billing_period_by_enrollment_account( - self, enrollment_account_id, billing_period_name, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): - """Lists the usage details based on enrollmentAccountId for a scope by - billing period. Usage details are available via this API only for May - 1, 2014 or later. - - :param enrollment_account_id: EnrollmentAccount ID - :type enrollment_account_id: str - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param expand: May be used to expand the - properties/additionalProperties or properties/meterDetails within a - list of usage details. By default, these fields are not included when - listing usage details. - :type expand: str - :param filter: May be used to filter usageDetails by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. 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 skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N usageDetails. - :type top: int - :param query_options: Additional parameters for the operation - :type query_options: ~azure.mgmt.consumption.models.QueryOptions - :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 UsageDetail - :rtype: - ~azure.mgmt.consumption.models.UsageDetailPaged[~azure.mgmt.consumption.models.UsageDetail] - :raises: - :class:`ErrorResponseException` - """ - apply = None - if query_options is not None: - apply = query_options.apply - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_for_billing_period_by_enrollment_account.metadata['url'] - path_format_arguments = { - 'enrollmentAccountId': self._serialize.url("enrollment_account_id", enrollment_account_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if apply is not None: - query_parameters['$apply'] = self._serialize.query("apply", apply, '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.UsageDetailPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_for_billing_period_by_enrollment_account.metadata = {'url': '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'} - - def list_by_management_group( - self, management_group_id, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): - """Lists the usage detail records for all subscriptions belonging to a - management group scope by current billing period. Usage details are + self, scope, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): + """Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or later. - :param management_group_id: Azure Management Group ID. - :type management_group_id: str + :param scope: The scope associated with usage details operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + '/providers/Microsoft.Billing/departments/{departmentId}' for + Department scope, + '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope and + '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope. For subscription, billing account, + department, enrollment account and management group, you can also add + billing period to the scope using + '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For + e.g. to specify billing period at department scope use + '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' + :type scope: str :param expand: May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when @@ -924,116 +101,9 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = self.list_by_management_group.metadata['url'] - path_format_arguments = { - 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skiptoken is not None: - query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if apply is not None: - query_parameters['$apply'] = self._serialize.query("apply", apply, '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.UsageDetailPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/usageDetails'} - - def list_for_billing_period_by_management_group( - self, management_group_id, billing_period_name, expand=None, filter=None, skiptoken=None, top=None, query_options=None, custom_headers=None, raw=False, **operation_config): - """Lists the usage detail records for all subscriptions belonging to a - management group scope by specified billing period. Usage details are - available via this API only for May 1, 2014 or later. - - :param management_group_id: Azure Management Group ID. - :type management_group_id: str - :param billing_period_name: Billing Period Name. - :type billing_period_name: str - :param expand: May be used to expand the - properties/additionalProperties or properties/meterDetails within a - list of usage details. By default, these fields are not included when - listing usage details. - :type expand: str - :param filter: May be used to filter usageDetails by - properties/usageEnd (Utc time), properties/usageStart (Utc time), - properties/resourceGroup, properties/instanceName or - properties/instanceId. 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 skiptoken: Skiptoken is only used if a previous operation - returned a partial result. If a previous response contains a nextLink - element, the value of the nextLink element will include a skiptoken - parameter that specifies a starting point to use for subsequent calls. - :type skiptoken: str - :param top: May be used to limit the number of results to the most - recent N usageDetails. - :type top: int - :param query_options: Additional parameters for the operation - :type query_options: ~azure.mgmt.consumption.models.QueryOptions - :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 UsageDetail - :rtype: - ~azure.mgmt.consumption.models.UsageDetailPaged[~azure.mgmt.consumption.models.UsageDetail] - :raises: - :class:`ErrorResponseException` - """ - apply = None - if query_options is not None: - apply = query_options.apply - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_for_billing_period_by_management_group.metadata['url'] + url = self.list.metadata['url'] path_format_arguments = { - 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str'), - 'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -1083,4 +153,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized - list_for_billing_period_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'} + list.metadata = {'url': '/{scope}/providers/Microsoft.Consumption/usageDetails'}