From 91f516dd7b03cc6e64f291765fbe57dff7ae28f6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 12 Jul 2018 13:59:34 -0700 Subject: [PATCH] [AutoPR consumption/resource-manager] Adding new properties to Consumption Usage Details (#2877) * Generated from 4394e3bd84d0e9012dd1acac36ce2a82fd02edd6 Merge branch 'master' of https://github.com/Azure/azure-rest-api-specs * Generated from 8d551a2fd9eb30b4c6b9f38b30924f06fed0b02c Merge branch 'master' of https://github.com/Azure/azure-rest-api-specs * Generated from bac7ebe031f40801bd2aca9a368dd9eeaeaa7509 Merge branch 'master' of https://github.com/Azure/azure-rest-api-specs * Generated from 891beecde5b53a8b2fc5a700670df861cc80b1f0 Modified the Operation Id to follow the best practices. * Generated from b9b62fdf3ee427a1f2c1b71293cc422eedbdbd63 Fixed model namings for - ReservationSummaries (now: ReservationSummary), ReservationDetails (now: ReservationDetail) and ReservationRecommendations (now: ReservationRecommendation) * Generated from 5d36df6e4f6b3ddde06f975bfa42fa095a5ad29e Fixed the naming for model CostTags. * Generated from c5a8c67ddd9601adc30c1a968a85629fbe79ccdf Fixing the SDKViolation error on - model Tags. * Generated from b28e418996a4b847984d198b4c0ccbd003466d0a Changed the CostTagResult to CostTag as per review comments. Also changed operations - Marketplaces_ListByEnrollmentAccount and Marketplaces_ListForBillingPeriodByEnrollmentAccount. --- .../consumption_management_client.py | 288 ++----- .../azure/mgmt/consumption/models/__init__.py | 130 +-- .../azure/mgmt/consumption/models/balance.py | 128 +++ ...nce_properties_adjustment_details_item.py} | 18 +- ..._properties_new_purchases_details_item.py} | 28 +- .../azure/mgmt/consumption/models/budget.py | 91 +++ .../{dimension_paged.py => budget_paged.py} | 8 +- .../consumption/models/budget_time_period.py | 37 + .../consumption_management_client_enums.py | 57 +- .../models/{usage_analysis.py => cost_tag.py} | 35 +- ...lysis_column.py => cost_tag_properties.py} | 20 +- .../mgmt/consumption/models/current_spend.py | 41 + .../mgmt/consumption/models/dimension.py | 70 -- .../azure/mgmt/consumption/models/filters.py | 48 ++ .../mgmt/consumption/models/marketplace.py | 174 ++++ ...analysis_paged.py => marketplace_paged.py} | 8 +- .../mgmt/consumption/models/meter_details.py | 10 + .../mgmt/consumption/models/notification.py | 62 ++ .../mgmt/consumption/models/proxy_resource.py | 51 ++ .../mgmt/consumption/models/report_config.py | 66 -- .../report_config_comparison_expression.py | 46 -- .../models/report_config_dataset.py | 56 -- .../models/report_config_definition.py | 51 -- .../report_config_delivery_destination.py | 44 -- .../models/report_config_delivery_info.py | 33 - .../models/report_config_filter.py | 53 -- .../models/report_config_grouping.py | 39 - .../models/report_config_recurrence_period.py | 37 - .../models/report_config_schedule.py | 47 -- .../models/report_config_time_period.py | 37 - .../consumption/models/reservation_detail.py | 97 +++ .../models/reservation_detail_paged.py | 27 + .../models/reservation_recommendation.py | 108 +++ .../reservation_recommendation_paged.py | 27 + .../consumption/models/reservation_summary.py | 108 +++ .../models/reservation_summary_paged.py | 27 + .../consumption/models/resource_attributes.py | 40 + ...config_dataset_configuration.py => tag.py} | 18 +- .../mgmt/consumption/models/tags_result.py | 51 ++ .../mgmt/consumption/models/usage_detail.py | 5 + .../mgmt/consumption/operations/__init__.py | 28 +- .../operations/balances_operations.py | 156 ++++ .../billing_account_dimensions_operations.py | 127 --- ...ig_operations.py => budgets_operations.py} | 310 ++++---- .../operations/cost_tags_operations.py | 169 ++++ .../operations/forecasts_operations.py | 4 +- .../operations/marketplaces_operations.py | 748 ++++++++++++++++++ .../mgmt/consumption/operations/operations.py | 4 +- .../operations/price_sheet_operations.py | 4 +- ...reservation_recommendations_operations.py} | 47 +- .../reservations_details_operations.py | 182 +++++ .../reservations_summaries_operations.py | 190 +++++ .../resource_group_dimensions_operations.py | 128 --- .../consumption/operations/tags_operations.py | 94 +++ .../operations/usage_details_operations.py | 4 +- 55 files changed, 3074 insertions(+), 1442 deletions(-) create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/balance.py rename azure-mgmt-consumption/azure/mgmt/consumption/models/{report_config_list_result.py => balance_properties_adjustment_details_item.py} (61%) rename azure-mgmt-consumption/azure/mgmt/consumption/models/{report_config_aggregation.py => balance_properties_new_purchases_details_item.py} (55%) create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/budget.py rename azure-mgmt-consumption/azure/mgmt/consumption/models/{dimension_paged.py => budget_paged.py} (70%) create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/budget_time_period.py rename azure-mgmt-consumption/azure/mgmt/consumption/models/{usage_analysis.py => cost_tag.py} (54%) rename azure-mgmt-consumption/azure/mgmt/consumption/models/{usage_analysis_column.py => cost_tag_properties.py} (59%) create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/current_spend.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/dimension.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/filters.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/marketplace.py rename azure-mgmt-consumption/azure/mgmt/consumption/models/{usage_analysis_paged.py => marketplace_paged.py} (68%) create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/notification.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/proxy_resource.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_comparison_expression.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_dataset.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_definition.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_delivery_destination.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_delivery_info.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_filter.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_grouping.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_recurrence_period.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_schedule.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_time_period.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_detail.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_detail_paged.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_recommendation.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_recommendation_paged.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_summary.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_summary_paged.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/resource_attributes.py rename azure-mgmt-consumption/azure/mgmt/consumption/models/{report_config_dataset_configuration.py => tag.py} (53%) create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/models/tags_result.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/operations/balances_operations.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/operations/billing_account_dimensions_operations.py rename azure-mgmt-consumption/azure/mgmt/consumption/operations/{report_config_operations.py => budgets_operations.py} (65%) create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/operations/cost_tags_operations.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/operations/marketplaces_operations.py rename azure-mgmt-consumption/azure/mgmt/consumption/operations/{subscription_dimensions_operations.py => reservation_recommendations_operations.py} (62%) create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_details_operations.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_summaries_operations.py delete mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/operations/resource_group_dimensions_operations.py create mode 100644 azure-mgmt-consumption/azure/mgmt/consumption/operations/tags_operations.py 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 8a04c902f2ef..11cb22c46a89 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/consumption_management_client.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/consumption_management_client.py @@ -13,16 +13,18 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION -from msrest.pipeline import ClientRawResponse -import uuid -from .operations.price_sheet_operations import PriceSheetOperations from .operations.usage_details_operations import UsageDetailsOperations +from .operations.marketplaces_operations import MarketplacesOperations +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.cost_tags_operations import CostTagsOperations +from .operations.tags_operations import TagsOperations from .operations.forecasts_operations import ForecastsOperations from .operations.operations import Operations -from .operations.report_config_operations import ReportConfigOperations -from .operations.billing_account_dimensions_operations import BillingAccountDimensionsOperations -from .operations.subscription_dimensions_operations import SubscriptionDimensionsOperations -from .operations.resource_group_dimensions_operations import ResourceGroupDimensionsOperations from . import models @@ -64,22 +66,30 @@ class ConsumptionManagementClient(object): :ivar config: Configuration for client. :vartype config: ConsumptionManagementClientConfiguration - :ivar price_sheet: PriceSheet operations - :vartype price_sheet: azure.mgmt.consumption.operations.PriceSheetOperations :ivar usage_details: UsageDetails operations :vartype usage_details: azure.mgmt.consumption.operations.UsageDetailsOperations + :ivar marketplaces: Marketplaces operations + :vartype marketplaces: azure.mgmt.consumption.operations.MarketplacesOperations + :ivar balances: Balances operations + :vartype balances: azure.mgmt.consumption.operations.BalancesOperations + :ivar reservations_summaries: ReservationsSummaries operations + :vartype reservations_summaries: azure.mgmt.consumption.operations.ReservationsSummariesOperations + :ivar reservations_details: ReservationsDetails operations + :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 cost_tags: CostTags operations + :vartype cost_tags: azure.mgmt.consumption.operations.CostTagsOperations + :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 report_config: ReportConfig operations - :vartype report_config: azure.mgmt.consumption.operations.ReportConfigOperations - :ivar billing_account_dimensions: BillingAccountDimensions operations - :vartype billing_account_dimensions: azure.mgmt.consumption.operations.BillingAccountDimensionsOperations - :ivar subscription_dimensions: SubscriptionDimensions operations - :vartype subscription_dimensions: azure.mgmt.consumption.operations.SubscriptionDimensionsOperations - :ivar resource_group_dimensions: ResourceGroupDimensions operations - :vartype resource_group_dimensions: azure.mgmt.consumption.operations.ResourceGroupDimensionsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -96,241 +106,31 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2018-05-31' + self.api_version = '2018-06-30' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.price_sheet = PriceSheetOperations( - self._client, self.config, self._serialize, self._deserialize) self.usage_details = UsageDetailsOperations( self._client, self.config, self._serialize, self._deserialize) - self.forecasts = ForecastsOperations( + self.marketplaces = MarketplacesOperations( self._client, self.config, self._serialize, self._deserialize) - self.operations = Operations( + self.balances = BalancesOperations( self._client, self.config, self._serialize, self._deserialize) - self.report_config = ReportConfigOperations( + self.reservations_summaries = ReservationsSummariesOperations( self._client, self.config, self._serialize, self._deserialize) - self.billing_account_dimensions = BillingAccountDimensionsOperations( + self.reservations_details = ReservationsDetailsOperations( self._client, self.config, self._serialize, self._deserialize) - self.subscription_dimensions = SubscriptionDimensionsOperations( + self.reservation_recommendations = ReservationRecommendationsOperations( self._client, self.config, self._serialize, self._deserialize) - self.resource_group_dimensions = ResourceGroupDimensionsOperations( + self.budgets = BudgetsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.price_sheet = PriceSheetOperations( + self._client, self.config, self._serialize, self._deserialize) + self.cost_tags = CostTagsOperations( + 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) - - def analyze_subscription_usage( - self, parameters, custom_headers=None, raw=False, **operation_config): - """Lists the usage data for subscriptionId. - - :param parameters: Parameters supplied to the CreateOrUpdate Report - Config operation. - :type parameters: - ~azure.mgmt.consumption.models.ReportConfigDefinition - :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 UsageAnalysis - :rtype: - ~azure.mgmt.consumption.models.UsageAnalysisPaged[~azure.mgmt.consumption.models.UsageAnalysis] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.analyze_subscription_usage.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['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, 'ReportConfigDefinition') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.UsageAnalysisPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageAnalysisPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - analyze_subscription_usage.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/AnalyzeUsage'} - - def analyze_resource_group_usage( - self, resource_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Lists the usage data for subscriptionId and resource group. - - :param resource_group_name: Azure Resource Group Name. - :type resource_group_name: str - :param parameters: Parameters supplied to the CreateOrUpdate Report - Config operation. - :type parameters: - ~azure.mgmt.consumption.models.ReportConfigDefinition - :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 UsageAnalysis - :rtype: - ~azure.mgmt.consumption.models.UsageAnalysisPaged[~azure.mgmt.consumption.models.UsageAnalysis] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.analyze_resource_group_usage.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') - } - 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['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, 'ReportConfigDefinition') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.UsageAnalysisPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageAnalysisPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - analyze_resource_group_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Consumption/AnalyzeUsage'} - - def analyze_billing_account_usage( - self, billing_account_id, parameters, custom_headers=None, raw=False, **operation_config): - """Lists the usage data for billing account. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str - :param parameters: Parameters supplied to the CreateOrUpdate Report - Config operation. - :type parameters: - ~azure.mgmt.consumption.models.ReportConfigDefinition - :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 UsageAnalysis - :rtype: - ~azure.mgmt.consumption.models.UsageAnalysisPaged[~azure.mgmt.consumption.models.UsageAnalysis] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.analyze_billing_account_usage.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 = {} - 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['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, 'ReportConfigDefinition') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.UsageAnalysisPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.UsageAnalysisPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - analyze_billing_account_usage.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/AnalyzeUsage'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py index 13db64df7612..5e680cfd5cee 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py @@ -9,94 +9,100 @@ # regenerated. # -------------------------------------------------------------------------- -from .error_details import ErrorDetails -from .error_response import ErrorResponse, ErrorResponseException -from .operation_display import OperationDisplay -from .operation import Operation -from .resource import Resource from .meter_details import MeterDetails +from .usage_detail import UsageDetail +from .marketplace import Marketplace +from .balance_properties_new_purchases_details_item import BalancePropertiesNewPurchasesDetailsItem +from .balance_properties_adjustment_details_item import BalancePropertiesAdjustmentDetailsItem +from .balance import Balance +from .reservation_summary import ReservationSummary +from .reservation_detail import ReservationDetail +from .reservation_recommendation import ReservationRecommendation +from .tag import Tag +from .tags_result import TagsResult +from .budget_time_period import BudgetTimePeriod +from .filters import Filters +from .current_spend import CurrentSpend +from .notification import Notification +from .budget import Budget +from .cost_tag_properties import CostTagProperties +from .cost_tag import CostTag from .price_sheet_properties import PriceSheetProperties from .price_sheet_result import PriceSheetResult from .forecast_properties_confidence_levels_item import ForecastPropertiesConfidenceLevelsItem from .forecast import Forecast -from .usage_detail import UsageDetail -from .report_config_recurrence_period import ReportConfigRecurrencePeriod -from .report_config_schedule import ReportConfigSchedule -from .report_config_delivery_destination import ReportConfigDeliveryDestination -from .report_config_delivery_info import ReportConfigDeliveryInfo -from .report_config_time_period import ReportConfigTimePeriod -from .report_config_dataset_configuration import ReportConfigDatasetConfiguration -from .report_config_aggregation import ReportConfigAggregation -from .report_config_grouping import ReportConfigGrouping -from .report_config_comparison_expression import ReportConfigComparisonExpression -from .report_config_filter import ReportConfigFilter -from .report_config_dataset import ReportConfigDataset -from .report_config_definition import ReportConfigDefinition -from .report_config import ReportConfig -from .report_config_list_result import ReportConfigListResult -from .dimension import Dimension -from .usage_analysis_column import UsageAnalysisColumn -from .usage_analysis import UsageAnalysis +from .error_details import ErrorDetails +from .error_response import ErrorResponse, ErrorResponseException +from .operation_display import OperationDisplay +from .operation import Operation +from .resource import Resource +from .resource_attributes import ResourceAttributes +from .proxy_resource import ProxyResource from .query_options import QueryOptions from .usage_detail_paged import UsageDetailPaged +from .marketplace_paged import MarketplacePaged +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 .dimension_paged import DimensionPaged -from .usage_analysis_paged import UsageAnalysisPaged from .consumption_management_client_enums import ( + BillingFrequency, + CategoryType, + TimeGrainType, + OperatorType, Grain, ChargeType, Bound, - StatusType, - RecurrenceType, - FormatType, - TimeframeType, - GranularityType, - ReportConfigColumnType, + Datagrain, ) __all__ = [ - 'ErrorDetails', - 'ErrorResponse', 'ErrorResponseException', - 'OperationDisplay', - 'Operation', - 'Resource', 'MeterDetails', + 'UsageDetail', + 'Marketplace', + 'BalancePropertiesNewPurchasesDetailsItem', + 'BalancePropertiesAdjustmentDetailsItem', + 'Balance', + 'ReservationSummary', + 'ReservationDetail', + 'ReservationRecommendation', + 'Tag', + 'TagsResult', + 'BudgetTimePeriod', + 'Filters', + 'CurrentSpend', + 'Notification', + 'Budget', + 'CostTagProperties', + 'CostTag', 'PriceSheetProperties', 'PriceSheetResult', 'ForecastPropertiesConfidenceLevelsItem', 'Forecast', - 'UsageDetail', - 'ReportConfigRecurrencePeriod', - 'ReportConfigSchedule', - 'ReportConfigDeliveryDestination', - 'ReportConfigDeliveryInfo', - 'ReportConfigTimePeriod', - 'ReportConfigDatasetConfiguration', - 'ReportConfigAggregation', - 'ReportConfigGrouping', - 'ReportConfigComparisonExpression', - 'ReportConfigFilter', - 'ReportConfigDataset', - 'ReportConfigDefinition', - 'ReportConfig', - 'ReportConfigListResult', - 'Dimension', - 'UsageAnalysisColumn', - 'UsageAnalysis', + 'ErrorDetails', + 'ErrorResponse', 'ErrorResponseException', + 'OperationDisplay', + 'Operation', + 'Resource', + 'ResourceAttributes', + 'ProxyResource', 'QueryOptions', 'UsageDetailPaged', + 'MarketplacePaged', + 'ReservationSummaryPaged', + 'ReservationDetailPaged', + 'ReservationRecommendationPaged', + 'BudgetPaged', 'ForecastPaged', 'OperationPaged', - 'DimensionPaged', - 'UsageAnalysisPaged', + 'BillingFrequency', + 'CategoryType', + 'TimeGrainType', + 'OperatorType', 'Grain', 'ChargeType', 'Bound', - 'StatusType', - 'RecurrenceType', - 'FormatType', - 'TimeframeType', - 'GranularityType', - 'ReportConfigColumnType', + 'Datagrain', ] diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/balance.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/balance.py new file mode 100644 index 000000000000..25629579ae55 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/balance.py @@ -0,0 +1,128 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class Balance(Resource): + """A balance resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar currency: The ISO currency in which the meter is charged, for + example, USD. + :vartype currency: str + :ivar beginning_balance: The beginning balance for the billing period. + :vartype beginning_balance: decimal.Decimal + :ivar ending_balance: The ending balance for the billing period (for open + periods this will be updated daily). + :vartype ending_balance: decimal.Decimal + :ivar new_purchases: Total new purchase amount. + :vartype new_purchases: decimal.Decimal + :ivar adjustments: Total adjustment amount. + :vartype adjustments: decimal.Decimal + :ivar utilized: Total Commitment usage. + :vartype utilized: decimal.Decimal + :ivar service_overage: Overage for Azure services. + :vartype service_overage: decimal.Decimal + :ivar charges_billed_separately: Charges Billed separately. + :vartype charges_billed_separately: decimal.Decimal + :ivar total_overage: serviceOverage + chargesBilledSeparately. + :vartype total_overage: decimal.Decimal + :ivar total_usage: Azure service commitment + total Overage. + :vartype total_usage: decimal.Decimal + :ivar azure_marketplace_service_charges: Total charges for Azure + Marketplace. + :vartype azure_marketplace_service_charges: decimal.Decimal + :param billing_frequency: The billing frequency. Possible values include: + 'Month', 'Quarter', 'Year' + :type billing_frequency: str or + ~azure.mgmt.consumption.models.BillingFrequency + :ivar price_hidden: Price is hidden or not. + :vartype price_hidden: bool + :ivar new_purchases_details: List of new purchases. + :vartype new_purchases_details: + list[~azure.mgmt.consumption.models.BalancePropertiesNewPurchasesDetailsItem] + :ivar adjustment_details: List of Adjustments (Promo credit, SIE credit + etc.). + :vartype adjustment_details: + list[~azure.mgmt.consumption.models.BalancePropertiesAdjustmentDetailsItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + 'currency': {'readonly': True}, + 'beginning_balance': {'readonly': True}, + 'ending_balance': {'readonly': True}, + 'new_purchases': {'readonly': True}, + 'adjustments': {'readonly': True}, + 'utilized': {'readonly': True}, + 'service_overage': {'readonly': True}, + 'charges_billed_separately': {'readonly': True}, + 'total_overage': {'readonly': True}, + 'total_usage': {'readonly': True}, + 'azure_marketplace_service_charges': {'readonly': True}, + 'price_hidden': {'readonly': True}, + 'new_purchases_details': {'readonly': True}, + 'adjustment_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'currency': {'key': 'properties.currency', 'type': 'str'}, + 'beginning_balance': {'key': 'properties.beginningBalance', 'type': 'decimal'}, + 'ending_balance': {'key': 'properties.endingBalance', 'type': 'decimal'}, + 'new_purchases': {'key': 'properties.newPurchases', 'type': 'decimal'}, + 'adjustments': {'key': 'properties.adjustments', 'type': 'decimal'}, + 'utilized': {'key': 'properties.utilized', 'type': 'decimal'}, + 'service_overage': {'key': 'properties.serviceOverage', 'type': 'decimal'}, + 'charges_billed_separately': {'key': 'properties.chargesBilledSeparately', 'type': 'decimal'}, + 'total_overage': {'key': 'properties.totalOverage', 'type': 'decimal'}, + 'total_usage': {'key': 'properties.totalUsage', 'type': 'decimal'}, + 'azure_marketplace_service_charges': {'key': 'properties.azureMarketplaceServiceCharges', 'type': 'decimal'}, + 'billing_frequency': {'key': 'properties.billingFrequency', 'type': 'str'}, + 'price_hidden': {'key': 'properties.priceHidden', 'type': 'bool'}, + 'new_purchases_details': {'key': 'properties.newPurchasesDetails', 'type': '[BalancePropertiesNewPurchasesDetailsItem]'}, + 'adjustment_details': {'key': 'properties.adjustmentDetails', 'type': '[BalancePropertiesAdjustmentDetailsItem]'}, + } + + def __init__(self, billing_frequency=None): + super(Balance, self).__init__() + self.currency = None + self.beginning_balance = None + self.ending_balance = None + self.new_purchases = None + self.adjustments = None + self.utilized = None + self.service_overage = None + self.charges_billed_separately = None + self.total_overage = None + self.total_usage = None + self.azure_marketplace_service_charges = None + self.billing_frequency = billing_frequency + self.price_hidden = None + self.new_purchases_details = None + self.adjustment_details = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_list_result.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/balance_properties_adjustment_details_item.py similarity index 61% rename from azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_list_result.py rename to azure-mgmt-consumption/azure/mgmt/consumption/models/balance_properties_adjustment_details_item.py index 0429bca41135..8826f2fc4cea 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_list_result.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/balance_properties_adjustment_details_item.py @@ -12,25 +12,29 @@ from msrest.serialization import Model -class ReportConfigListResult(Model): - """Result of listing report configs. It contains a list of available report - configurations in the scope provided. +class BalancePropertiesAdjustmentDetailsItem(Model): + """BalancePropertiesAdjustmentDetailsItem. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of report configs. - :vartype value: list[~azure.mgmt.consumption.models.ReportConfig] + :ivar name: the name of new adjustment. + :vartype name: str + :ivar value: the value of new adjustment. + :vartype value: decimal.Decimal """ _validation = { + 'name': {'readonly': True}, 'value': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ReportConfig]'}, + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'decimal'}, } def __init__(self): - super(ReportConfigListResult, self).__init__() + super(BalancePropertiesAdjustmentDetailsItem, self).__init__() + self.name = None self.value = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_aggregation.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/balance_properties_new_purchases_details_item.py similarity index 55% rename from azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_aggregation.py rename to azure-mgmt-consumption/azure/mgmt/consumption/models/balance_properties_new_purchases_details_item.py index 7debf4cae669..6fff54e26448 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_aggregation.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/balance_properties_new_purchases_details_item.py @@ -12,31 +12,29 @@ from msrest.serialization import Model -class ReportConfigAggregation(Model): - """The aggregation expression to be used in the report. +class BalancePropertiesNewPurchasesDetailsItem(Model): + """BalancePropertiesNewPurchasesDetailsItem. Variables are only populated by the server, and will be ignored when sending a request. - :param name: The name of the column to aggregate. - :type name: str - :ivar function: The name of the aggregation function to use. Default - value: "Sum" . - :vartype function: str + :ivar name: the name of new purchase. + :vartype name: str + :ivar value: the value of new purchase. + :vartype value: decimal.Decimal """ _validation = { - 'name': {'required': True}, - 'function': {'required': True, 'constant': True}, + 'name': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'function': {'key': 'function', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'decimal'}, } - function = "Sum" - - def __init__(self, name): - super(ReportConfigAggregation, self).__init__() - self.name = name + def __init__(self): + super(BalancePropertiesNewPurchasesDetailsItem, self).__init__() + self.name = None + self.value = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/budget.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/budget.py new file mode 100644 index 000000000000..f6485d49266d --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/budget.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class Budget(ProxyResource): + """A budget resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenarion, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + :param category: The category of the budget, whether the budget tracks + cost or usage. Possible values include: 'Cost', 'Usage' + :type category: str or ~azure.mgmt.consumption.models.CategoryType + :param amount: The total amount of cost to track with the budget + :type amount: decimal.Decimal + :param time_grain: The time covered by a budget. Tracking of the amount + will be reset based on the time grain. Possible values include: 'Monthly', + 'Quarterly', 'Annually' + :type time_grain: str or ~azure.mgmt.consumption.models.TimeGrainType + :param time_period: Has start and end date of the budget. The start date + must be first of the month and should be less than the end date. Budget + start date must be on or after June 1, 2017. Future start date should not + be more than three months. Past start date should be selected within the + timegrain preiod. There are no restrictions on the end date. + :type time_period: ~azure.mgmt.consumption.models.BudgetTimePeriod + :param filters: May be used to filter budgets by resource group, resource, + or meter. + :type filters: ~azure.mgmt.consumption.models.Filters + :ivar current_spend: The current amount of cost which is being tracked for + a budget. + :vartype current_spend: ~azure.mgmt.consumption.models.CurrentSpend + :param notifications: Dictionary of notifications associated with the + budget. Budget can have up to five notifications. + :type notifications: dict[str, + ~azure.mgmt.consumption.models.Notification] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'category': {'required': True}, + 'amount': {'required': True}, + 'time_grain': {'required': True}, + 'time_period': {'required': True}, + 'current_spend': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'category': {'key': 'properties.category', 'type': 'str'}, + 'amount': {'key': 'properties.amount', 'type': 'decimal'}, + 'time_grain': {'key': 'properties.timeGrain', 'type': 'str'}, + 'time_period': {'key': 'properties.timePeriod', 'type': 'BudgetTimePeriod'}, + 'filters': {'key': 'properties.filters', 'type': 'Filters'}, + 'current_spend': {'key': 'properties.currentSpend', 'type': 'CurrentSpend'}, + 'notifications': {'key': 'properties.notifications', 'type': '{Notification}'}, + } + + def __init__(self, category, amount, time_grain, time_period, e_tag=None, filters=None, notifications=None): + super(Budget, self).__init__(e_tag=e_tag) + self.category = category + self.amount = amount + self.time_grain = time_grain + self.time_period = time_period + self.filters = filters + self.current_spend = None + self.notifications = notifications diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/dimension_paged.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/budget_paged.py similarity index 70% rename from azure-mgmt-consumption/azure/mgmt/consumption/models/dimension_paged.py rename to azure-mgmt-consumption/azure/mgmt/consumption/models/budget_paged.py index ec7fba922493..2668382253e2 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/dimension_paged.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/budget_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class DimensionPaged(Paged): +class BudgetPaged(Paged): """ - A paging container for iterating over a list of :class:`Dimension ` object + A paging container for iterating over a list of :class:`Budget ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Dimension]'} + 'current_page': {'key': 'value', 'type': '[Budget]'} } def __init__(self, *args, **kwargs): - super(DimensionPaged, self).__init__(*args, **kwargs) + super(BudgetPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/budget_time_period.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/budget_time_period.py new file mode 100644 index 000000000000..2b1c0e78418a --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/budget_time_period.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class BudgetTimePeriod(Model): + """The start and end date for a budget. + + :param start_date: The start date for the budget. + :type start_date: datetime + :param end_date: The end date for the budget. If not provided, we default + this to 10 years from the start date. + :type end_date: datetime + """ + + _validation = { + 'start_date': {'required': True}, + } + + _attribute_map = { + 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, + } + + def __init__(self, start_date, end_date=None): + super(BudgetTimePeriod, self).__init__() + self.start_date = start_date + self.end_date = end_date diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/consumption_management_client_enums.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/consumption_management_client_enums.py index a4942d7b0117..4fc7842fb175 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/consumption_management_client_enums.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/consumption_management_client_enums.py @@ -12,58 +12,53 @@ from enum import Enum -class Grain(Enum): +class BillingFrequency(Enum): - daily = "Daily" - monthly = "Monthly" - yearly = "Yearly" + month = "Month" + quarter = "Quarter" + year = "Year" -class ChargeType(Enum): +class CategoryType(Enum): - actual = "Actual" - forecast = "Forecast" + cost = "Cost" + usage = "Usage" -class Bound(Enum): +class TimeGrainType(Enum): - upper = "Upper" - lower = "Lower" + monthly = "Monthly" + quarterly = "Quarterly" + annually = "Annually" -class StatusType(Enum): +class OperatorType(Enum): - active = "Active" - inactive = "Inactive" + equal_to = "EqualTo" + greater_than = "GreaterThan" + greater_than_or_equal_to = "GreaterThanOrEqualTo" -class RecurrenceType(Enum): +class Grain(Enum): daily = "Daily" - weekly = "Weekly" monthly = "Monthly" - annually = "Annually" - - -class FormatType(Enum): - - csv = "Csv" + yearly = "Yearly" -class TimeframeType(Enum): +class ChargeType(Enum): - week_to_date = "WeekToDate" - month_to_date = "MonthToDate" - year_to_date = "YearToDate" - custom = "Custom" + actual = "Actual" + forecast = "Forecast" -class GranularityType(Enum): +class Bound(Enum): - daily = "Daily" + upper = "Upper" + lower = "Lower" -class ReportConfigColumnType(Enum): +class Datagrain(Enum): - tag = "Tag" - dimension = "Dimension" + daily_grain = "daily" + monthly_grain = "monthly" diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/usage_analysis.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/cost_tag.py similarity index 54% rename from azure-mgmt-consumption/azure/mgmt/consumption/models/usage_analysis.py rename to azure-mgmt-consumption/azure/mgmt/consumption/models/cost_tag.py index 9400a55b9d01..83660969aa07 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/usage_analysis.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/cost_tag.py @@ -9,11 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .resource import Resource +from .proxy_resource import ProxyResource -class UsageAnalysis(Resource): - """UsageAnalysis. +class CostTag(ProxyResource): + """A cost tag resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -24,35 +24,28 @@ class UsageAnalysis(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :param next_link: - :type next_link: str - :param columns: Array of columns - :type columns: list[~azure.mgmt.consumption.models.UsageAnalysisColumn] - :param rows: - :type rows: list[list[object]] + :param e_tag: eTag of the resource. To handle concurrent update scenarion, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + :param cost_tags: Cost tags. + :type cost_tags: list[~azure.mgmt.consumption.models.CostTagProperties] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, - 'columns': {'key': 'properties.columns', 'type': '[UsageAnalysisColumn]'}, - 'rows': {'key': 'properties.rows', 'type': '[[object]]'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'cost_tags': {'key': 'properties.costTags', 'type': '[CostTagProperties]'}, } - def __init__(self, next_link=None, columns=None, rows=None): - super(UsageAnalysis, self).__init__() - self.next_link = next_link - self.columns = columns - self.rows = rows + def __init__(self, e_tag=None, cost_tags=None): + super(CostTag, self).__init__(e_tag=e_tag) + self.cost_tags = cost_tags diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/usage_analysis_column.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/cost_tag_properties.py similarity index 59% rename from azure-mgmt-consumption/azure/mgmt/consumption/models/usage_analysis_column.py rename to azure-mgmt-consumption/azure/mgmt/consumption/models/cost_tag_properties.py index f56886d66c73..d9bf9a2fe730 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/usage_analysis_column.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/cost_tag_properties.py @@ -12,21 +12,17 @@ from msrest.serialization import Model -class UsageAnalysisColumn(Model): - """UsageAnalysisColumn. +class CostTagProperties(Model): + """The properties of the cost tag. - :param name: - :type name: str - :param type: - :type type: str + :param key: Cost tag key. + :type key: str """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, } - def __init__(self, name=None, type=None): - super(UsageAnalysisColumn, self).__init__() - self.name = name - self.type = type + def __init__(self, key=None): + super(CostTagProperties, self).__init__() + self.key = key diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/current_spend.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/current_spend.py new file mode 100644 index 000000000000..839c286b1040 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/current_spend.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CurrentSpend(Model): + """The current amount of cost which is being tracked for a budget. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar amount: The total amount of cost which is being tracked by the + budget. + :vartype amount: decimal.Decimal + :ivar unit: The unit of measure for the budget amount. + :vartype unit: str + """ + + _validation = { + 'amount': {'readonly': True}, + 'unit': {'readonly': True}, + } + + _attribute_map = { + 'amount': {'key': 'amount', 'type': 'decimal'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__(self): + super(CurrentSpend, self).__init__() + self.amount = None + self.unit = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/dimension.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/dimension.py deleted file mode 100644 index 5eecf20913ef..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/dimension.py +++ /dev/null @@ -1,70 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource import Resource - - -class Dimension(Resource): - """Dimension. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :param data: - :type data: list[str] - :param total: - :type total: int - :param category: - :type category: str - :param usage_start: - :type usage_start: datetime - :param usage_end: - :type usage_end: datetime - :param next_link: - :type next_link: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'data': {'key': 'properties.data', 'type': '[str]'}, - 'total': {'key': 'properties.total', 'type': 'int'}, - 'category': {'key': 'properties.category', 'type': 'str'}, - 'usage_start': {'key': 'properties.usageStart', 'type': 'iso-8601'}, - 'usage_end': {'key': 'properties.usageEnd', 'type': 'iso-8601'}, - 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, - } - - def __init__(self, data=None, total=None, category=None, usage_start=None, usage_end=None, next_link=None): - super(Dimension, self).__init__() - self.data = data - self.total = total - self.category = category - self.usage_start = usage_start - self.usage_end = usage_end - self.next_link = next_link diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/filters.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/filters.py new file mode 100644 index 000000000000..c111e55dca96 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/filters.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Filters(Model): + """May be used to filter budgets by resource group, resource, or meter. + + :param resource_groups: The list of filters on resource groups, allowed at + subscription level only. + :type resource_groups: list[str] + :param resources: The list of filters on resources. + :type resources: list[str] + :param meters: The list of filters on meters (GUID), mandatory for budgets + of usage category. + :type meters: list[str] + :param tags: The dictionary of filters on tags. + :type tags: dict[str, list[str]] + """ + + _validation = { + 'resource_groups': {'max_items': 10, 'min_items': 0}, + 'resources': {'max_items': 10, 'min_items': 0}, + 'meters': {'max_items': 10, 'min_items': 0}, + } + + _attribute_map = { + 'resource_groups': {'key': 'resourceGroups', 'type': '[str]'}, + 'resources': {'key': 'resources', 'type': '[str]'}, + 'meters': {'key': 'meters', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': '{[str]}'}, + } + + def __init__(self, resource_groups=None, resources=None, meters=None, tags=None): + super(Filters, self).__init__() + self.resource_groups = resource_groups + self.resources = resources + self.meters = meters + self.tags = tags diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/marketplace.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/marketplace.py new file mode 100644 index 000000000000..c4d0affc442e --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/marketplace.py @@ -0,0 +1,174 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class Marketplace(Resource): + """An marketplace resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar billing_period_id: The id of the billing period resource that the + usage belongs to. + :vartype billing_period_id: str + :ivar usage_start: The start of the date time range covered by the usage + detail. + :vartype usage_start: datetime + :ivar usage_end: The end of the date time range covered by the usage + detail. + :vartype usage_end: datetime + :ivar resource_rate: The marketplace resource rate. + :vartype resource_rate: decimal.Decimal + :ivar offer_name: The type of offer. + :vartype offer_name: str + :ivar resource_group: The name of resource group. + :vartype resource_group: str + :ivar order_number: The order number. + :vartype order_number: str + :ivar instance_name: The name of the resource instance that the usage is + about. + :vartype instance_name: str + :ivar instance_id: The uri of the resource instance that the usage is + about. + :vartype instance_id: str + :ivar currency: The ISO currency in which the meter is charged, for + example, USD. + :vartype currency: str + :ivar consumed_quantity: The quantity of usage. + :vartype consumed_quantity: decimal.Decimal + :ivar unit_of_measure: The unit of measure. + :vartype unit_of_measure: str + :ivar pretax_cost: The amount of cost before tax. + :vartype pretax_cost: decimal.Decimal + :ivar is_estimated: The estimated usage is subject to change. + :vartype is_estimated: bool + :ivar meter_id: The meter id (GUID). + :vartype meter_id: str + :ivar subscription_guid: Subscription guid. + :vartype subscription_guid: str + :ivar subscription_name: Subscription name. + :vartype subscription_name: str + :ivar account_name: Account name. + :vartype account_name: str + :ivar department_name: Department name. + :vartype department_name: str + :ivar consumed_service: Consumed service name. + :vartype consumed_service: str + :ivar cost_center: The cost center of this department if it is a + department and a costcenter exists + :vartype cost_center: str + :ivar additional_properties: Additional details of this usage item. By + default this is not populated, unless it's specified in $expand. + :vartype additional_properties: str + :ivar publisher_name: The name of publisher. + :vartype publisher_name: str + :ivar plan_name: The name of plan. + :vartype plan_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + 'billing_period_id': {'readonly': True}, + 'usage_start': {'readonly': True}, + 'usage_end': {'readonly': True}, + 'resource_rate': {'readonly': True}, + 'offer_name': {'readonly': True}, + 'resource_group': {'readonly': True}, + 'order_number': {'readonly': True}, + 'instance_name': {'readonly': True}, + 'instance_id': {'readonly': True}, + 'currency': {'readonly': True}, + 'consumed_quantity': {'readonly': True}, + 'unit_of_measure': {'readonly': True}, + 'pretax_cost': {'readonly': True}, + 'is_estimated': {'readonly': True}, + 'meter_id': {'readonly': True}, + 'subscription_guid': {'readonly': True}, + 'subscription_name': {'readonly': True}, + 'account_name': {'readonly': True}, + 'department_name': {'readonly': True}, + 'consumed_service': {'readonly': True}, + 'cost_center': {'readonly': True}, + 'additional_properties': {'readonly': True}, + 'publisher_name': {'readonly': True}, + 'plan_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'billing_period_id': {'key': 'properties.billingPeriodId', 'type': 'str'}, + 'usage_start': {'key': 'properties.usageStart', 'type': 'iso-8601'}, + 'usage_end': {'key': 'properties.usageEnd', 'type': 'iso-8601'}, + 'resource_rate': {'key': 'properties.resourceRate', 'type': 'decimal'}, + 'offer_name': {'key': 'properties.offerName', 'type': 'str'}, + 'resource_group': {'key': 'properties.resourceGroup', 'type': 'str'}, + 'order_number': {'key': 'properties.orderNumber', 'type': 'str'}, + 'instance_name': {'key': 'properties.instanceName', 'type': 'str'}, + 'instance_id': {'key': 'properties.instanceId', 'type': 'str'}, + 'currency': {'key': 'properties.currency', 'type': 'str'}, + 'consumed_quantity': {'key': 'properties.consumedQuantity', 'type': 'decimal'}, + 'unit_of_measure': {'key': 'properties.unitOfMeasure', 'type': 'str'}, + 'pretax_cost': {'key': 'properties.pretaxCost', 'type': 'decimal'}, + 'is_estimated': {'key': 'properties.isEstimated', 'type': 'bool'}, + 'meter_id': {'key': 'properties.meterId', 'type': 'str'}, + 'subscription_guid': {'key': 'properties.subscriptionGuid', 'type': 'str'}, + 'subscription_name': {'key': 'properties.subscriptionName', 'type': 'str'}, + 'account_name': {'key': 'properties.accountName', 'type': 'str'}, + 'department_name': {'key': 'properties.departmentName', 'type': 'str'}, + 'consumed_service': {'key': 'properties.consumedService', 'type': 'str'}, + 'cost_center': {'key': 'properties.costCenter', 'type': 'str'}, + 'additional_properties': {'key': 'properties.additionalProperties', 'type': 'str'}, + 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, + 'plan_name': {'key': 'properties.planName', 'type': 'str'}, + } + + def __init__(self): + super(Marketplace, self).__init__() + self.billing_period_id = None + self.usage_start = None + self.usage_end = None + self.resource_rate = None + self.offer_name = None + self.resource_group = None + self.order_number = None + self.instance_name = None + self.instance_id = None + self.currency = None + self.consumed_quantity = None + self.unit_of_measure = None + self.pretax_cost = None + self.is_estimated = None + self.meter_id = None + self.subscription_guid = None + self.subscription_name = None + self.account_name = None + self.department_name = None + self.consumed_service = None + self.cost_center = None + self.additional_properties = None + self.publisher_name = None + self.plan_name = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/usage_analysis_paged.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/marketplace_paged.py similarity index 68% rename from azure-mgmt-consumption/azure/mgmt/consumption/models/usage_analysis_paged.py rename to azure-mgmt-consumption/azure/mgmt/consumption/models/marketplace_paged.py index 194f3027fcd7..d360761aca55 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/usage_analysis_paged.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/marketplace_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class UsageAnalysisPaged(Paged): +class MarketplacePaged(Paged): """ - A paging container for iterating over a list of :class:`UsageAnalysis ` object + A paging container for iterating over a list of :class:`Marketplace ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[UsageAnalysis]'} + 'current_page': {'key': 'value', 'type': '[Marketplace]'} } def __init__(self, *args, **kwargs): - super(UsageAnalysisPaged, self).__init__(*args, **kwargs) + super(MarketplacePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/meter_details.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/meter_details.py index c6806291332d..0224ceb9da7e 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/meter_details.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/meter_details.py @@ -37,6 +37,10 @@ class MeterDetails(Model): :vartype total_included_quantity: decimal.Decimal :ivar pretax_standard_rate: The pretax listing price. :vartype pretax_standard_rate: decimal.Decimal + :ivar service_name: The name of the service. + :vartype service_name: str + :ivar service_tier: The service tier. + :vartype service_tier: str """ _validation = { @@ -47,6 +51,8 @@ class MeterDetails(Model): 'meter_location': {'readonly': True}, 'total_included_quantity': {'readonly': True}, 'pretax_standard_rate': {'readonly': True}, + 'service_name': {'readonly': True}, + 'service_tier': {'readonly': True}, } _attribute_map = { @@ -57,6 +63,8 @@ class MeterDetails(Model): 'meter_location': {'key': 'meterLocation', 'type': 'str'}, 'total_included_quantity': {'key': 'totalIncludedQuantity', 'type': 'decimal'}, 'pretax_standard_rate': {'key': 'pretaxStandardRate', 'type': 'decimal'}, + 'service_name': {'key': 'serviceName', 'type': 'str'}, + 'service_tier': {'key': 'serviceTier', 'type': 'str'}, } def __init__(self): @@ -68,3 +76,5 @@ def __init__(self): self.meter_location = None self.total_included_quantity = None self.pretax_standard_rate = None + self.service_name = None + self.service_tier = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/notification.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/notification.py new file mode 100644 index 000000000000..61e1ca0ed34d --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/notification.py @@ -0,0 +1,62 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Notification(Model): + """The notification associated with a budget. + + :param enabled: The notification is enabled or not. + :type enabled: bool + :param operator: The comparison operator. Possible values include: + 'EqualTo', 'GreaterThan', 'GreaterThanOrEqualTo' + :type operator: str or ~azure.mgmt.consumption.models.OperatorType + :param threshold: Threshold value associated with a notification. + Notification is sent when the cost exceeded the threshold. It is always + percent and has to be between 0 and 1000. + :type threshold: decimal.Decimal + :param contact_emails: Email addresses to send the budget notification to + when the threshold is exceeded. + :type contact_emails: list[str] + :param contact_roles: Contact roles to send the budget notification to + when the threshold is exceeded. + :type contact_roles: list[str] + :param contact_groups: Action groups to send the budget notification to + when the threshold is exceeded. + :type contact_groups: list[str] + """ + + _validation = { + 'enabled': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + 'contact_emails': {'required': True, 'max_items': 50, 'min_items': 1}, + 'contact_groups': {'max_items': 50, 'min_items': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'decimal'}, + 'contact_emails': {'key': 'contactEmails', 'type': '[str]'}, + 'contact_roles': {'key': 'contactRoles', 'type': '[str]'}, + 'contact_groups': {'key': 'contactGroups', 'type': '[str]'}, + } + + def __init__(self, enabled, operator, threshold, contact_emails, contact_roles=None, contact_groups=None): + super(Notification, self).__init__() + self.enabled = enabled + self.operator = operator + self.threshold = threshold + self.contact_emails = contact_emails + self.contact_roles = contact_roles + self.contact_groups = contact_groups diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/proxy_resource.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/proxy_resource.py new file mode 100644 index 000000000000..f6a9a40d22d5 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/proxy_resource.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ProxyResource(Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenarion, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + } + + def __init__(self, e_tag=None): + super(ProxyResource, self).__init__() + self.id = None + self.name = None + self.type = None + self.e_tag = e_tag diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config.py deleted file mode 100644 index d6de1c48d9ec..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource import Resource - - -class ReportConfig(Resource): - """A report config resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :param schedule: Has schedule information for the report config. - :type schedule: ~azure.mgmt.consumption.models.ReportConfigSchedule - :param format: The format of the report being delivered. Possible values - include: 'Csv' - :type format: str or ~azure.mgmt.consumption.models.FormatType - :param delivery_info: Has delivery information for the report config. - :type delivery_info: - ~azure.mgmt.consumption.models.ReportConfigDeliveryInfo - :param definition: Has definition for the report config. - :type definition: ~azure.mgmt.consumption.models.ReportConfigDefinition - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'tags': {'readonly': True}, - 'delivery_info': {'required': True}, - 'definition': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'schedule': {'key': 'properties.schedule', 'type': 'ReportConfigSchedule'}, - 'format': {'key': 'properties.format', 'type': 'str'}, - 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ReportConfigDeliveryInfo'}, - 'definition': {'key': 'properties.definition', 'type': 'ReportConfigDefinition'}, - } - - def __init__(self, delivery_info, definition, schedule=None, format=None): - super(ReportConfig, self).__init__() - self.schedule = schedule - self.format = format - self.delivery_info = delivery_info - self.definition = definition diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_comparison_expression.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_comparison_expression.py deleted file mode 100644 index 48c56a8b2ef9..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_comparison_expression.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReportConfigComparisonExpression(Model): - """The comparison expression to be used in the report. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param name: The name of the column to use in comaprison. - :type name: str - :ivar operator: The operator to use for comparison. Default value: "In" . - :vartype operator: str - :param values: Array of values to use for comparison - :type values: list[str] - """ - - _validation = { - 'name': {'required': True}, - 'operator': {'required': True, 'constant': True}, - 'values': {'required': True, 'min_items': 1}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - } - - operator = "In" - - def __init__(self, name, values): - super(ReportConfigComparisonExpression, self).__init__() - self.name = name - self.values = values diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_dataset.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_dataset.py deleted file mode 100644 index ee34f641f753..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_dataset.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReportConfigDataset(Model): - """The definition of data present in the report. - - :param granularity: The granularity of rows in the report. Possible values - include: 'Daily' - :type granularity: str or ~azure.mgmt.consumption.models.GranularityType - :param configuration: Has configuration information for the data in the - report. The configuration will be ignored if aggregation and grouping are - provided. - :type configuration: - ~azure.mgmt.consumption.models.ReportConfigDatasetConfiguration - :param aggregation: Dictionary of aggregation expression to use in the - report. The key of each item in the dictionary is the alias for the - aggregated column. Report can have upto 2 aggregation clauses. - :type aggregation: dict[str, - ~azure.mgmt.consumption.models.ReportConfigAggregation] - :param grouping: Array of group by expression to use in the report. Report - can have upto 2 group by clauses. - :type grouping: list[~azure.mgmt.consumption.models.ReportConfigGrouping] - :param filter: Has filter expression to use in the report. - :type filter: ~azure.mgmt.consumption.models.ReportConfigFilter - """ - - _validation = { - 'grouping': {'max_items': 2}, - } - - _attribute_map = { - 'granularity': {'key': 'granularity', 'type': 'str'}, - 'configuration': {'key': 'configuration', 'type': 'ReportConfigDatasetConfiguration'}, - 'aggregation': {'key': 'aggregation', 'type': '{ReportConfigAggregation}'}, - 'grouping': {'key': 'grouping', 'type': '[ReportConfigGrouping]'}, - 'filter': {'key': 'filter', 'type': 'ReportConfigFilter'}, - } - - def __init__(self, granularity=None, configuration=None, aggregation=None, grouping=None, filter=None): - super(ReportConfigDataset, self).__init__() - self.granularity = granularity - self.configuration = configuration - self.aggregation = aggregation - self.grouping = grouping - self.filter = filter diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_definition.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_definition.py deleted file mode 100644 index e31d628af408..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_definition.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReportConfigDefinition(Model): - """The definition of a report config. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar type: The type of the report. Default value: "Usage" . - :vartype type: str - :param timeframe: The time frame for pulling data for the report. If - custom, then a specific time period must be provided. Possible values - include: 'WeekToDate', 'MonthToDate', 'YearToDate', 'Custom' - :type timeframe: str or ~azure.mgmt.consumption.models.TimeframeType - :param time_period: Has time period for pulling data for the report. - :type time_period: ~azure.mgmt.consumption.models.ReportConfigTimePeriod - :param dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.consumption.models.ReportConfigDataset - """ - - _validation = { - 'type': {'required': True, 'constant': True}, - 'timeframe': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'timeframe': {'key': 'timeframe', 'type': 'str'}, - 'time_period': {'key': 'timePeriod', 'type': 'ReportConfigTimePeriod'}, - 'dataset': {'key': 'dataset', 'type': 'ReportConfigDataset'}, - } - - type = "Usage" - - def __init__(self, timeframe, time_period=None, dataset=None): - super(ReportConfigDefinition, self).__init__() - self.timeframe = timeframe - self.time_period = time_period - self.dataset = dataset diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_delivery_destination.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_delivery_destination.py deleted file mode 100644 index ed86b4a6a1ee..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_delivery_destination.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReportConfigDeliveryDestination(Model): - """The destination information for the delivery of the report. - - :param resource_id: The resource id of the storage account where reports - will be delivered. - :type resource_id: str - :param container: The name of the container where reports will be - uploaded. - :type container: str - :param root_folder_path: The name of the directory where reports will be - uploaded. - :type root_folder_path: str - """ - - _validation = { - 'resource_id': {'required': True}, - 'container': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'container': {'key': 'container', 'type': 'str'}, - 'root_folder_path': {'key': 'rootFolderPath', 'type': 'str'}, - } - - def __init__(self, resource_id, container, root_folder_path=None): - super(ReportConfigDeliveryDestination, self).__init__() - self.resource_id = resource_id - self.container = container - self.root_folder_path = root_folder_path diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_delivery_info.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_delivery_info.py deleted file mode 100644 index 4c2fb15809b8..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_delivery_info.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReportConfigDeliveryInfo(Model): - """The delivery information associated with a report config. - - :param destination: Has destination for the report being delivered. - :type destination: - ~azure.mgmt.consumption.models.ReportConfigDeliveryDestination - """ - - _validation = { - 'destination': {'required': True}, - } - - _attribute_map = { - 'destination': {'key': 'destination', 'type': 'ReportConfigDeliveryDestination'}, - } - - def __init__(self, destination): - super(ReportConfigDeliveryInfo, self).__init__() - self.destination = destination diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_filter.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_filter.py deleted file mode 100644 index 0c6f19dbec89..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_filter.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReportConfigFilter(Model): - """The filter expression to be used in the report. - - :param and_property: The logical "AND" expression. Must have atleast 2 - items. - :type and_property: - list[~azure.mgmt.consumption.models.ReportConfigFilter] - :param or_property: The logical "OR" expression. Must have atleast 2 - items. - :type or_property: list[~azure.mgmt.consumption.models.ReportConfigFilter] - :param not_property: The logical "NOT" expression. - :type not_property: ~azure.mgmt.consumption.models.ReportConfigFilter - :param dimension: Has comparison expression for a dimension - :type dimension: - ~azure.mgmt.consumption.models.ReportConfigComparisonExpression - :param tag: Has comparison expression for a tag - :type tag: ~azure.mgmt.consumption.models.ReportConfigComparisonExpression - """ - - _validation = { - 'and_property': {'min_items': 2}, - 'or_property': {'min_items': 2}, - } - - _attribute_map = { - 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, - 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, - 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, - 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, - } - - def __init__(self, and_property=None, or_property=None, not_property=None, dimension=None, tag=None): - super(ReportConfigFilter, self).__init__() - self.and_property = and_property - self.or_property = or_property - self.not_property = not_property - self.dimension = dimension - self.tag = tag diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_grouping.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_grouping.py deleted file mode 100644 index dd1304ba969f..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_grouping.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReportConfigGrouping(Model): - """The group by expression to be used in the report. - - :param column_type: Has type of the column to group. Possible values - include: 'Tag', 'Dimension' - :type column_type: str or - ~azure.mgmt.consumption.models.ReportConfigColumnType - :param name: The name of the column to group. - :type name: str - """ - - _validation = { - 'column_type': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'column_type': {'key': 'columnType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, column_type, name): - super(ReportConfigGrouping, self).__init__() - self.column_type = column_type - self.name = name diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_recurrence_period.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_recurrence_period.py deleted file mode 100644 index 8d84293cbbb7..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_recurrence_period.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReportConfigRecurrencePeriod(Model): - """The start and end date for recurrence schedule. - - :param from_property: The start date of recurrence. - :type from_property: datetime - :param to: The end date of recurrence. If not provided, we default this to - 10 years from the start date. - :type to: datetime - """ - - _validation = { - 'from_property': {'required': True}, - } - - _attribute_map = { - 'from_property': {'key': 'from', 'type': 'iso-8601'}, - 'to': {'key': 'to', 'type': 'iso-8601'}, - } - - def __init__(self, from_property, to=None): - super(ReportConfigRecurrencePeriod, self).__init__() - self.from_property = from_property - self.to = to diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_schedule.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_schedule.py deleted file mode 100644 index 98a9196c1512..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_schedule.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReportConfigSchedule(Model): - """The schedule associated with a report config. - - :param status: The status of the schedule. Whether active or not. If - inactive, the report's scheduled execution is paused. Possible values - include: 'Active', 'Inactive' - :type status: str or ~azure.mgmt.consumption.models.StatusType - :param recurrence: The schedule recurrence. Possible values include: - 'Daily', 'Weekly', 'Monthly', 'Annually' - :type recurrence: str or ~azure.mgmt.consumption.models.RecurrenceType - :param recurrence_period: Has start and end date of the recurrence. The - start date must be in future. If present, the end date must be greater - than start date. - :type recurrence_period: - ~azure.mgmt.consumption.models.ReportConfigRecurrencePeriod - """ - - _validation = { - 'recurrence': {'required': True}, - 'recurrence_period': {'required': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'recurrence': {'key': 'recurrence', 'type': 'str'}, - 'recurrence_period': {'key': 'recurrencePeriod', 'type': 'ReportConfigRecurrencePeriod'}, - } - - def __init__(self, recurrence, recurrence_period, status=None): - super(ReportConfigSchedule, self).__init__() - self.status = status - self.recurrence = recurrence - self.recurrence_period = recurrence_period diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_time_period.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_time_period.py deleted file mode 100644 index d2291e922323..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_time_period.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReportConfigTimePeriod(Model): - """The start and end date for pulling data for the report. - - :param from_property: The start date to pull data from. - :type from_property: datetime - :param to: The end date to pull data to. - :type to: datetime - """ - - _validation = { - 'from_property': {'required': True}, - 'to': {'required': True}, - } - - _attribute_map = { - 'from_property': {'key': 'from', 'type': 'iso-8601'}, - 'to': {'key': 'to', 'type': 'iso-8601'}, - } - - def __init__(self, from_property, to): - super(ReportConfigTimePeriod, self).__init__() - self.from_property = from_property - self.to = to diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_detail.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_detail.py new file mode 100644 index 000000000000..620cb95c530c --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_detail.py @@ -0,0 +1,97 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class ReservationDetail(Resource): + """reservation detail resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar reservation_order_id: The reservation order ID is the identifier for + a reservation purchase. Each reservation order ID represents a single + purchase transaction. A reservation order contains reservations. The + reservation order specifies the VM size and region for the reservations. + :vartype reservation_order_id: str + :ivar reservation_id: The reservation ID is the identifier of a + reservation within a reservation order. Each reservation is the grouping + for applying the benefit scope and also specifies the number of instances + to which the reservation benefit can be applied to. + :vartype reservation_id: str + :ivar sku_name: This is the ARM Sku name. It can be used to join with the + servicetype field in additoinalinfo in usage records. + :vartype sku_name: str + :ivar reserved_hours: This is the total hours reserved for the day. E.g. + if reservation for 1 instance was made on 1 PM, this will be 11 hours for + that day and 24 hours from subsequent days. + :vartype reserved_hours: decimal.Decimal + :ivar usage_date: The date on which consumption occurred. + :vartype usage_date: datetime + :ivar used_hours: This is the total hours used by the instance. + :vartype used_hours: decimal.Decimal + :ivar instance_id: This identifier is the name of the resource or the + fully qualified Resource ID. + :vartype instance_id: str + :ivar total_reserved_quantity: This is the total count of instances that + are reserved for the reservationid. + :vartype total_reserved_quantity: decimal.Decimal + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + 'reservation_order_id': {'readonly': True}, + 'reservation_id': {'readonly': True}, + 'sku_name': {'readonly': True}, + 'reserved_hours': {'readonly': True}, + 'usage_date': {'readonly': True}, + 'used_hours': {'readonly': True}, + 'instance_id': {'readonly': True}, + 'total_reserved_quantity': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'reservation_order_id': {'key': 'properties.reservationOrderId', 'type': 'str'}, + 'reservation_id': {'key': 'properties.reservationId', 'type': 'str'}, + 'sku_name': {'key': 'properties.skuName', 'type': 'str'}, + 'reserved_hours': {'key': 'properties.reservedHours', 'type': 'decimal'}, + 'usage_date': {'key': 'properties.usageDate', 'type': 'iso-8601'}, + 'used_hours': {'key': 'properties.usedHours', 'type': 'decimal'}, + 'instance_id': {'key': 'properties.instanceId', 'type': 'str'}, + 'total_reserved_quantity': {'key': 'properties.totalReservedQuantity', 'type': 'decimal'}, + } + + def __init__(self): + super(ReservationDetail, self).__init__() + self.reservation_order_id = None + self.reservation_id = None + self.sku_name = None + self.reserved_hours = None + self.usage_date = None + self.used_hours = None + self.instance_id = None + self.total_reserved_quantity = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_detail_paged.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_detail_paged.py new file mode 100644 index 000000000000..5b596c3df721 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_detail_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ReservationDetailPaged(Paged): + """ + A paging container for iterating over a list of :class:`ReservationDetail ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ReservationDetail]'} + } + + def __init__(self, *args, **kwargs): + + super(ReservationDetailPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_recommendation.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_recommendation.py new file mode 100644 index 000000000000..3d4653ce6ef9 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_recommendation.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ReservationRecommendation(Model): + """Reservation recommendation resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: Resource location + :vartype location: str + :ivar sku: Resource sku + :vartype sku: str + :ivar look_back_period: The number of days of usage to look back for + recommendation. + :vartype look_back_period: str + :ivar meter_id: The meter id (GUID) + :vartype meter_id: str + :ivar term: RI recommendations in one or three year terms. + :vartype term: str + :ivar cost_with_no_reserved_instances: The total amount of cost without + reserved instances. + :vartype cost_with_no_reserved_instances: decimal.Decimal + :ivar recommended_quantity: Recomended quality for reserved instances. + :vartype recommended_quantity: decimal.Decimal + :ivar total_cost_with_reserved_instances: The total amount of cost with + reserved instances. + :vartype total_cost_with_reserved_instances: decimal.Decimal + :ivar net_savings: Total estimated savings with reserved instances. + :vartype net_savings: decimal.Decimal + :ivar first_usage_date: The usage date for looking back. + :vartype first_usage_date: datetime + :ivar scope: Shared or single recommendation. + :vartype scope: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + 'location': {'readonly': True}, + 'sku': {'readonly': True}, + 'look_back_period': {'readonly': True}, + 'meter_id': {'readonly': True}, + 'term': {'readonly': True}, + 'cost_with_no_reserved_instances': {'readonly': True}, + 'recommended_quantity': {'readonly': True}, + 'total_cost_with_reserved_instances': {'readonly': True}, + 'net_savings': {'readonly': True}, + 'first_usage_date': {'readonly': True}, + 'scope': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'look_back_period': {'key': 'properties.lookBackPeriod', 'type': 'str'}, + 'meter_id': {'key': 'properties.meterId', 'type': 'str'}, + 'term': {'key': 'properties.term', 'type': 'str'}, + 'cost_with_no_reserved_instances': {'key': 'properties.costWithNoReservedInstances', 'type': 'decimal'}, + 'recommended_quantity': {'key': 'properties.recommendedQuantity', 'type': 'decimal'}, + 'total_cost_with_reserved_instances': {'key': 'properties.totalCostWithReservedInstances', 'type': 'decimal'}, + 'net_savings': {'key': 'properties.netSavings', 'type': 'decimal'}, + 'first_usage_date': {'key': 'properties.firstUsageDate', 'type': 'iso-8601'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + } + + def __init__(self): + super(ReservationRecommendation, self).__init__() + self.id = None + self.name = None + self.type = None + self.tags = None + self.location = None + self.sku = None + self.look_back_period = None + self.meter_id = None + self.term = None + self.cost_with_no_reserved_instances = None + self.recommended_quantity = None + self.total_cost_with_reserved_instances = None + self.net_savings = None + self.first_usage_date = None + self.scope = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_recommendation_paged.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_recommendation_paged.py new file mode 100644 index 000000000000..db7d155ade36 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_recommendation_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ReservationRecommendationPaged(Paged): + """ + A paging container for iterating over a list of :class:`ReservationRecommendation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ReservationRecommendation]'} + } + + def __init__(self, *args, **kwargs): + + super(ReservationRecommendationPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_summary.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_summary.py new file mode 100644 index 000000000000..a9c41b04f734 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_summary.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class ReservationSummary(Resource): + """reservation summary resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar reservation_order_id: The reservation order ID is the identifier for + a reservation purchase. Each reservation order ID represents a single + purchase transaction. A reservation order contains reservations. The + reservation order specifies the VM size and region for the reservations. + :vartype reservation_order_id: str + :ivar reservation_id: The reservation ID is the identifier of a + reservation within a reservation order. Each reservation is the grouping + for applying the benefit scope and also specifies the number of instances + to which the reservation benefit can be applied to. + :vartype reservation_id: str + :ivar sku_name: This is the ARM Sku name. It can be used to join with the + servicetype field in additoinalinfo in usage records. + :vartype sku_name: str + :ivar reserved_hours: This is the total hours reserved. E.g. if + reservation for 1 instance was made on 1 PM, this will be 11 hours for + that day and 24 hours from subsequent days + :vartype reserved_hours: decimal.Decimal + :ivar usage_date: Data corresponding to the utilization record. If the + grain of data is monthly, it will be first day of month. + :vartype usage_date: datetime + :ivar used_hours: Total used hours by the reservation + :vartype used_hours: decimal.Decimal + :ivar min_utilization_percentage: This is the minimum hourly utilization + in the usage time (day or month). E.g. if usage record corresponds to + 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field + will return 10% for that day + :vartype min_utilization_percentage: decimal.Decimal + :ivar avg_utilization_percentage: This is average utilization for the + entire time range. (day or month depending on the grain) + :vartype avg_utilization_percentage: decimal.Decimal + :ivar max_utilization_percentage: This is the maximum hourly utilization + in the usage time (day or month). E.g. if usage record corresponds to + 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field + will return 100% for that day. + :vartype max_utilization_percentage: decimal.Decimal + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + 'reservation_order_id': {'readonly': True}, + 'reservation_id': {'readonly': True}, + 'sku_name': {'readonly': True}, + 'reserved_hours': {'readonly': True}, + 'usage_date': {'readonly': True}, + 'used_hours': {'readonly': True}, + 'min_utilization_percentage': {'readonly': True}, + 'avg_utilization_percentage': {'readonly': True}, + 'max_utilization_percentage': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'reservation_order_id': {'key': 'properties.reservationOrderId', 'type': 'str'}, + 'reservation_id': {'key': 'properties.reservationId', 'type': 'str'}, + 'sku_name': {'key': 'properties.skuName', 'type': 'str'}, + 'reserved_hours': {'key': 'properties.reservedHours', 'type': 'decimal'}, + 'usage_date': {'key': 'properties.usageDate', 'type': 'iso-8601'}, + 'used_hours': {'key': 'properties.usedHours', 'type': 'decimal'}, + 'min_utilization_percentage': {'key': 'properties.minUtilizationPercentage', 'type': 'decimal'}, + 'avg_utilization_percentage': {'key': 'properties.avgUtilizationPercentage', 'type': 'decimal'}, + 'max_utilization_percentage': {'key': 'properties.maxUtilizationPercentage', 'type': 'decimal'}, + } + + def __init__(self): + super(ReservationSummary, self).__init__() + self.reservation_order_id = None + self.reservation_id = None + self.sku_name = None + self.reserved_hours = None + self.usage_date = None + self.used_hours = None + self.min_utilization_percentage = None + self.avg_utilization_percentage = None + self.max_utilization_percentage = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_summary_paged.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_summary_paged.py new file mode 100644 index 000000000000..5b2e1ee931ae --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/reservation_summary_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ReservationSummaryPaged(Paged): + """ + A paging container for iterating over a list of :class:`ReservationSummary ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ReservationSummary]'} + } + + def __init__(self, *args, **kwargs): + + super(ReservationSummaryPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/resource_attributes.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/resource_attributes.py new file mode 100644 index 000000000000..ecfb70e1b03c --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/resource_attributes.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ResourceAttributes(Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar location: Resource location + :vartype location: str + :ivar sku: Resource sku + :vartype sku: str + """ + + _validation = { + 'location': {'readonly': True}, + 'sku': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + } + + def __init__(self): + super(ResourceAttributes, self).__init__() + self.location = None + self.sku = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_dataset_configuration.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/tag.py similarity index 53% rename from azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_dataset_configuration.py rename to azure-mgmt-consumption/azure/mgmt/consumption/models/tag.py index 6c17fe70fbc5..d1403dabeb28 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/report_config_dataset_configuration.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/tag.py @@ -12,19 +12,17 @@ from msrest.serialization import Model -class ReportConfigDatasetConfiguration(Model): - """The configuration of dataset in the report. +class Tag(Model): + """The tag resource. - :param columns: Array of column names to be included in the report. Any - valid report column name is allowed. If not provided, then report includes - all columns. - :type columns: list[str] + :param key: Tag key. + :type key: str """ _attribute_map = { - 'columns': {'key': 'columns', 'type': '[str]'}, + 'key': {'key': 'key', 'type': 'str'}, } - def __init__(self, columns=None): - super(ReportConfigDatasetConfiguration, self).__init__() - self.columns = columns + def __init__(self, key=None): + super(Tag, self).__init__() + self.key = key diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/tags_result.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/tags_result.py new file mode 100644 index 000000000000..ca150692b832 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/tags_result.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class TagsResult(ProxyResource): + """A resource listing all tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenarion, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + :param tags: A list of Tag. + :type tags: list[~azure.mgmt.consumption.models.Tag] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'tags': {'key': 'properties.tags', 'type': '[Tag]'}, + } + + def __init__(self, e_tag=None, tags=None): + super(TagsResult, self).__init__(e_tag=e_tag) + self.tags = tags diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/models/usage_detail.py b/azure-mgmt-consumption/azure/mgmt/consumption/models/usage_detail.py index 70b9ada119b1..c99c21c04dd4 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/models/usage_detail.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/models/usage_detail.py @@ -86,6 +86,8 @@ class UsageDetail(Resource): :vartype offer_id: str :ivar charges_billed_separately: Charges billed separately :vartype charges_billed_separately: bool + :ivar location: Resource Location + :vartype location: str :ivar additional_properties: Additional details of this usage item. By default this is not populated, unless it's specified in $expand. :vartype additional_properties: str @@ -121,6 +123,7 @@ class UsageDetail(Resource): 'resource_guid': {'readonly': True}, 'offer_id': {'readonly': True}, 'charges_billed_separately': {'readonly': True}, + 'location': {'readonly': True}, 'additional_properties': {'readonly': True}, } @@ -154,6 +157,7 @@ class UsageDetail(Resource): 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, 'offer_id': {'key': 'properties.offerId', 'type': 'str'}, 'charges_billed_separately': {'key': 'properties.chargesBilledSeparately', 'type': 'bool'}, + 'location': {'key': 'properties.location', 'type': 'str'}, 'additional_properties': {'key': 'properties.additionalProperties', 'type': 'str'}, } @@ -184,4 +188,5 @@ def __init__(self): self.resource_guid = None self.offer_id = None self.charges_billed_separately = None + self.location = None self.additional_properties = None diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/__init__.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/__init__.py index 45a433eb2980..47d457068d0a 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/__init__.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/__init__.py @@ -9,22 +9,30 @@ # regenerated. # -------------------------------------------------------------------------- -from .price_sheet_operations import PriceSheetOperations from .usage_details_operations import UsageDetailsOperations +from .marketplaces_operations import MarketplacesOperations +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 .cost_tags_operations import CostTagsOperations +from .tags_operations import TagsOperations from .forecasts_operations import ForecastsOperations from .operations import Operations -from .report_config_operations import ReportConfigOperations -from .billing_account_dimensions_operations import BillingAccountDimensionsOperations -from .subscription_dimensions_operations import SubscriptionDimensionsOperations -from .resource_group_dimensions_operations import ResourceGroupDimensionsOperations __all__ = [ - 'PriceSheetOperations', 'UsageDetailsOperations', + 'MarketplacesOperations', + 'BalancesOperations', + 'ReservationsSummariesOperations', + 'ReservationsDetailsOperations', + 'ReservationRecommendationsOperations', + 'BudgetsOperations', + 'PriceSheetOperations', + 'CostTagsOperations', + 'TagsOperations', 'ForecastsOperations', 'Operations', - 'ReportConfigOperations', - 'BillingAccountDimensionsOperations', - 'SubscriptionDimensionsOperations', - 'ResourceGroupDimensionsOperations', ] diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/balances_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/balances_operations.py new file mode 100644 index 000000000000..70a5427261ba --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/balances_operations.py @@ -0,0 +1,156 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class BalancesOperations(object): + """BalancesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-30" + + self.config = config + + def get_by_billing_account( + self, billing_account_id, custom_headers=None, raw=False, **operation_config): + """Gets the balances for a scope by billingAccountId. Balances are + available via this API only for May 1, 2014 or later. + + :param billing_account_id: BillingAccount ID + :type billing_account_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Balance or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.consumption.models.Balance or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Balance', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances'} + + def get_for_billing_period_by_billing_account( + self, billing_account_id, billing_period_name, custom_headers=None, raw=False, **operation_config): + """Gets the balances for a scope by billing period and billingAccountId. + Balances 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 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: Balance or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.consumption.models.Balance or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Balance', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_for_billing_period_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/balances'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/billing_account_dimensions_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/billing_account_dimensions_operations.py deleted file mode 100644 index 5f6ac6a32107..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/billing_account_dimensions_operations.py +++ /dev/null @@ -1,127 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class BillingAccountDimensionsOperations(object): - """BillingAccountDimensionsOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-05-31. Constant value: "2018-05-31". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-05-31" - - self.config = config - - def list( - self, billing_account_id, filter=None, expand=None, skiptoken=None, top=None, custom_headers=None, raw=False, **operation_config): - """Lists the dimensions by billingAccount Id. - - :param billing_account_id: BillingAccount ID - :type billing_account_id: str - :param filter: May be used to filter dimensions by - properties/category, properties/usageStart, properties/usageEnd. - Supported operators are 'eq','lt', 'gt', 'le', 'ge'. - :type filter: str - :param expand: May be used to expand the properties/data within a - dimension dategory. By default, data is not included when listing - dimensions. - :type expand: 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 dimension data. - :type top: int - :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 Dimension - :rtype: - ~azure.mgmt.consumption.models.DimensionPaged[~azure.mgmt.consumption.models.Dimension] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_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') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, '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) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.DimensionPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.DimensionPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/dimensions'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/report_config_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/budgets_operations.py similarity index 65% rename from azure-mgmt-consumption/azure/mgmt/consumption/operations/report_config_operations.py rename to azure-mgmt-consumption/azure/mgmt/consumption/operations/budgets_operations.py index 48bf02278fee..bb991a4d655c 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/report_config_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/budgets_operations.py @@ -15,14 +15,14 @@ from .. import models -class ReportConfigOperations(object): - """ReportConfigOperations operations. +class BudgetsOperations(object): + """BudgetsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-05-31. Constant value: "2018-05-31". + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". """ models = models @@ -32,68 +32,77 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-05-31" + self.api_version = "2018-06-30" self.config = config def list( self, custom_headers=None, raw=False, **operation_config): - """Lists all report configs for a subscription. + """Lists all budgets for a subscription. :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: ReportConfigListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.ReportConfigListResult or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of Budget + :rtype: + ~azure.mgmt.consumption.models.BudgetPaged[~azure.mgmt.consumption.models.Budget] :raises: :class:`ErrorResponseException` """ - # 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') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ReportConfigListResult', response) + 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 = {} + 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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.BudgetPaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(deserialized, response) + 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/reportconfigs'} + 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 report configs for a resource group under a subscription. + """Lists all budgets for a resource group under a subscription. :param resource_group_name: Azure Resource Group Name. :type resource_group_name: str @@ -102,66 +111,75 @@ def list_by_resource_group_name( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: ReportConfigListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.ReportConfigListResult or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of Budget + :rtype: + ~azure.mgmt.consumption.models.BudgetPaged[~azure.mgmt.consumption.models.Budget] :raises: :class:`ErrorResponseException` """ - # 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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ReportConfigListResult', response) + 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') + } + 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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.BudgetPaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(deserialized, response) + header_dict = {} + client_raw_response = models.BudgetPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized - list_by_resource_group_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/reportconfigs'} + list_by_resource_group_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets'} def get( - self, report_config_name, custom_headers=None, raw=False, **operation_config): - """Gets the report config for a subscription by report config name. + self, budget_name, custom_headers=None, raw=False, **operation_config): + """Gets the budget for a subscription by budget name. - :param report_config_name: Report Config Name. - :type report_config_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: ReportConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.ReportConfig or + :return: Budget or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.consumption.models.Budget or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` @@ -170,7 +188,7 @@ def get( url = self.get.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'reportConfigName': self._serialize.url("report_config_name", report_config_name, 'str') + 'budgetName': self._serialize.url("budget_name", budget_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -198,34 +216,33 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReportConfig', response) + deserialized = self._deserialize('Budget', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/reportconfigs/{reportConfigName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}'} def create_or_update( - self, report_config_name, parameters, custom_headers=None, raw=False, **operation_config): - """The operation to create or update a report config. 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 report_config_name: Report Config Name. - :type report_config_name: str - :param parameters: Parameters supplied to the CreateOrUpdate Report - Config operation. - :type parameters: ~azure.mgmt.consumption.models.ReportConfig + self, 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 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: ReportConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.ReportConfig or + :return: Budget or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.consumption.models.Budget or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` @@ -234,7 +251,7 @@ def create_or_update( url = self.create_or_update.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'reportConfigName': self._serialize.url("report_config_name", report_config_name, 'str') + 'budgetName': self._serialize.url("budget_name", budget_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -253,7 +270,7 @@ def create_or_update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'ReportConfig') + body_content = self._serialize.body(parameters, 'Budget') # Construct and send request request = self._client.put(url, query_parameters) @@ -266,23 +283,23 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReportConfig', response) + deserialized = self._deserialize('Budget', response) if response.status_code == 201: - deserialized = self._deserialize('ReportConfig', response) + deserialized = self._deserialize('Budget', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/reportconfigs/{reportConfigName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}'} def delete( - self, report_config_name, custom_headers=None, raw=False, **operation_config): - """The operation to delete a report. + self, budget_name, custom_headers=None, raw=False, **operation_config): + """The operation to delete a budget. - :param report_config_name: Report Config Name. - :type report_config_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 @@ -297,7 +314,7 @@ def delete( url = self.delete.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'reportConfigName': self._serialize.url("report_config_name", report_config_name, 'str') + 'budgetName': self._serialize.url("budget_name", budget_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -325,24 +342,24 @@ def delete( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/reportconfigs/{reportConfigName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}'} def get_by_resource_group_name( - self, resource_group_name, report_config_name, custom_headers=None, raw=False, **operation_config): - """Gets the report config for a resource group under a subscription by - report config 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 report_config_name: Report Config Name. - :type report_config_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: ReportConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.ReportConfig or + :return: Budget or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.consumption.models.Budget or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` @@ -352,7 +369,7 @@ def get_by_resource_group_name( 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'), - 'reportConfigName': self._serialize.url("report_config_name", report_config_name, 'str') + 'budgetName': self._serialize.url("budget_name", budget_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -380,36 +397,35 @@ def get_by_resource_group_name( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReportConfig', response) + 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/reportconfigs/{reportConfigName}'} + 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, report_config_name, parameters, custom_headers=None, raw=False, **operation_config): - """The operation to create or update a report config. 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. + 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 report_config_name: Report Config Name. - :type report_config_name: str - :param parameters: Parameters supplied to the CreateOrUpdate Report - Config operation. - :type parameters: ~azure.mgmt.consumption.models.ReportConfig + :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: ReportConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.consumption.models.ReportConfig or + :return: Budget or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.consumption.models.Budget or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` @@ -419,7 +435,7 @@ def create_or_update_by_resource_group_name( 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'), - 'reportConfigName': self._serialize.url("report_config_name", report_config_name, 'str') + 'budgetName': self._serialize.url("budget_name", budget_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -438,7 +454,7 @@ def create_or_update_by_resource_group_name( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'ReportConfig') + body_content = self._serialize.body(parameters, 'Budget') # Construct and send request request = self._client.put(url, query_parameters) @@ -451,25 +467,25 @@ def create_or_update_by_resource_group_name( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReportConfig', response) + deserialized = self._deserialize('Budget', response) if response.status_code == 201: - deserialized = self._deserialize('ReportConfig', response) + 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/reportconfigs/{reportConfigName}'} + 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, report_config_name, custom_headers=None, raw=False, **operation_config): - """The operation to delete a report config. + 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 report_config_name: Report Config Name. - :type report_config_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 @@ -485,7 +501,7 @@ def delete_by_resource_group_name( 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'), - 'reportConfigName': self._serialize.url("report_config_name", report_config_name, 'str') + 'budgetName': self._serialize.url("budget_name", budget_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -513,4 +529,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/reportconfigs/{reportConfigName}'} + delete_by_resource_group_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets/{budgetName}'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/cost_tags_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/cost_tags_operations.py new file mode 100644 index 000000000000..dc24f048b996 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/cost_tags_operations.py @@ -0,0 +1,169 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class CostTagsOperations(object): + """CostTagsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-30" + + self.config = config + + def get( + self, billing_account_id, custom_headers=None, raw=False, **operation_config): + """Get cost tags for a billing account. + + :param billing_account_id: BillingAccount ID + :type billing_account_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CostTag or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.consumption.models.CostTag or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CostTag', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costTags'} + + def create_or_update( + self, billing_account_id, e_tag=None, cost_tags=None, custom_headers=None, raw=False, **operation_config): + """The operation to create or update cost tags assiciated with a billing + account. 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 billing_account_id: BillingAccount ID + :type billing_account_id: str + :param e_tag: eTag of the resource. To handle concurrent update + scenarion, this field will be used to determine whether the user is + updating the latest version or not. + :type e_tag: str + :param cost_tags: Cost tags. + :type cost_tags: + list[~azure.mgmt.consumption.models.CostTagProperties] + :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: CostTag or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.consumption.models.CostTag or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.CostTag(e_tag=e_tag, cost_tags=cost_tags) + + # Construct URL + url = self.create_or_update.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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'CostTag') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('CostTag', response) + if response.status_code == 201: + deserialized = self._deserialize('CostTag', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costTags'} 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 ed7ebe2d2bf3..48f844f73961 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-05-31. Constant value: "2018-05-31". + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". """ 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-05-31" + self.api_version = "2018-06-30" 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 new file mode 100644 index 000000000000..74828b1035f0 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/marketplaces_operations.py @@ -0,0 +1,748 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class MarketplacesOperations(object): + """MarketplacesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-30" + + 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. + + :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.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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + 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 + subscripotionId. 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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + 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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + 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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + 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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + 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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + 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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + 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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + 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'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/operations.py index f38eb9dc6124..235ddad54ce1 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-05-31. Constant value: "2018-05-31". + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". """ 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-05-31" + self.api_version = "2018-06-30" 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 2416932bb74a..dce64523c429 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-05-31. Constant value: "2018-05-31". + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". """ 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-05-31" + self.api_version = "2018-06-30" self.config = config diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/subscription_dimensions_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservation_recommendations_operations.py similarity index 62% rename from azure-mgmt-consumption/azure/mgmt/consumption/operations/subscription_dimensions_operations.py rename to azure-mgmt-consumption/azure/mgmt/consumption/operations/reservation_recommendations_operations.py index 49a53e34f677..b3a3ed064eba 100644 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/subscription_dimensions_operations.py +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservation_recommendations_operations.py @@ -15,14 +15,14 @@ from .. import models -class SubscriptionDimensionsOperations(object): - """SubscriptionDimensionsOperations operations. +class ReservationRecommendationsOperations(object): + """ReservationRecommendationsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-05-31. Constant value: "2018-05-31". + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". """ models = models @@ -32,38 +32,25 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-05-31" + self.api_version = "2018-06-30" self.config = config def list( - self, filter=None, expand=None, skiptoken=None, top=None, custom_headers=None, raw=False, **operation_config): - """Lists the dimensions by subscription Id. + self, filter=None, custom_headers=None, raw=False, **operation_config): + """List of recomendations for purchasing reserved instances. - :param filter: May be used to filter dimensions by - properties/category, properties/usageStart, properties/usageEnd. - Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + :param filter: May be used to filter reservationRecommendations by + properties/scope and properties/lookBackPeriod. :type filter: str - :param expand: May be used to expand the properties/data within a - dimension dategory. By default, data is not included when listing - dimensions. - :type expand: 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 dimension data. - :type top: int :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 Dimension + :return: An iterator like instance of ReservationRecommendation :rtype: - ~azure.mgmt.consumption.models.DimensionPaged[~azure.mgmt.consumption.models.Dimension] + ~azure.mgmt.consumption.models.ReservationRecommendationPaged[~azure.mgmt.consumption.models.ReservationRecommendation] :raises: :class:`ErrorResponseException` """ @@ -79,15 +66,9 @@ def internal_paging(next_link=None, raw=False): # 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') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, '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') else: url = next_link @@ -114,12 +95,12 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.DimensionPaged(internal_paging, self._deserialize.dependencies) + deserialized = models.ReservationRecommendationPaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.DimensionPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = models.ReservationRecommendationPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/dimensions'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/reservationRecommendations'} 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 new file mode 100644 index 000000000000..b97ebd76c8b6 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_details_operations.py @@ -0,0 +1,182 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ReservationsDetailsOperations(object): + """ReservationsDetailsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-30" + + self.config = config + + def list_by_reservation_order( + self, reservation_order_id, filter, custom_headers=None, raw=False, **operation_config): + """Lists the reservations details for provided date range. + + :param reservation_order_id: Order Id of the reservation + :type reservation_order_id: str + :param filter: Filter reservation details by date range. The + properties/UsageDate for start date and end date. The filter supports + 'le' and 'ge' + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ReservationDetail + :rtype: + ~azure.mgmt.consumption.models.ReservationDetailPaged[~azure.mgmt.consumption.models.ReservationDetail] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_reservation_order.metadata['url'] + path_format_arguments = { + 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['$filter'] = self._serialize.query("filter", filter, '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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.ReservationDetailPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ReservationDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_reservation_order.metadata = {'url': '/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.Consumption/reservationDetails'} + + def list_by_reservation_order_and_reservation( + self, reservation_order_id, reservation_id, filter, custom_headers=None, raw=False, **operation_config): + """Lists the reservations details for provided date range. + + :param reservation_order_id: Order Id of the reservation + :type reservation_order_id: str + :param reservation_id: Id of the reservation + :type reservation_id: str + :param filter: Filter reservation details by date range. The + properties/UsageDate for start date and end date. The filter supports + 'le' and 'ge' + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ReservationDetail + :rtype: + ~azure.mgmt.consumption.models.ReservationDetailPaged[~azure.mgmt.consumption.models.ReservationDetail] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_reservation_order_and_reservation.metadata['url'] + path_format_arguments = { + 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), + 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['$filter'] = self._serialize.query("filter", filter, '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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.ReservationDetailPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ReservationDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_reservation_order_and_reservation.metadata = {'url': '/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.Consumption/reservationDetails'} 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 new file mode 100644 index 000000000000..763057876e9b --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/reservations_summaries_operations.py @@ -0,0 +1,190 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ReservationsSummariesOperations(object): + """ReservationsSummariesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-30" + + self.config = config + + def list_by_reservation_order( + self, reservation_order_id, grain, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the reservations summaries for daily or monthly grain. + + :param reservation_order_id: Order Id of the reservation + :type reservation_order_id: str + :param grain: Can be daily or monthly. Possible values include: + 'DailyGrain', 'MonthlyGrain' + :type grain: str or ~azure.mgmt.consumption.models.Datagrain + :param filter: Required only for daily grain. The properties/UsageDate + for start date and end date. The filter supports 'le' and 'ge' + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ReservationSummary + :rtype: + ~azure.mgmt.consumption.models.ReservationSummaryPaged[~azure.mgmt.consumption.models.ReservationSummary] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_reservation_order.metadata['url'] + path_format_arguments = { + 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['grain'] = self._serialize.query("grain", grain, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, '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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.ReservationSummaryPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ReservationSummaryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_reservation_order.metadata = {'url': '/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.Consumption/reservationSummaries'} + + def list_by_reservation_order_and_reservation( + self, reservation_order_id, reservation_id, grain, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the reservations summaries for daily or monthly grain. + + :param reservation_order_id: Order Id of the reservation + :type reservation_order_id: str + :param reservation_id: Id of the reservation + :type reservation_id: str + :param grain: Can be daily or monthly. Possible values include: + 'DailyGrain', 'MonthlyGrain' + :type grain: str or ~azure.mgmt.consumption.models.Datagrain + :param filter: Required only for daily grain. The properties/UsageDate + for start date and end date. The filter supports 'le' and 'ge' + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ReservationSummary + :rtype: + ~azure.mgmt.consumption.models.ReservationSummaryPaged[~azure.mgmt.consumption.models.ReservationSummary] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_reservation_order_and_reservation.metadata['url'] + path_format_arguments = { + 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), + 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['grain'] = self._serialize.query("grain", grain, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, '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['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.ReservationSummaryPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ReservationSummaryPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_reservation_order_and_reservation.metadata = {'url': '/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.Consumption/reservationSummaries'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/resource_group_dimensions_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/resource_group_dimensions_operations.py deleted file mode 100644 index 8dcc597bcb77..000000000000 --- a/azure-mgmt-consumption/azure/mgmt/consumption/operations/resource_group_dimensions_operations.py +++ /dev/null @@ -1,128 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class ResourceGroupDimensionsOperations(object): - """ResourceGroupDimensionsOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2018-05-31. Constant value: "2018-05-31". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-05-31" - - self.config = config - - def list( - self, resource_group_name, filter=None, expand=None, skiptoken=None, top=None, custom_headers=None, raw=False, **operation_config): - """Lists the dimensions by resource group Id. - - :param resource_group_name: Azure Resource Group Name. - :type resource_group_name: str - :param filter: May be used to filter dimensions by - properties/category, properties/usageStart, properties/usageEnd. - Supported operators are 'eq','lt', 'gt', 'le', 'ge'. - :type filter: str - :param expand: May be used to expand the properties/data within a - dimension dategory. By default, data is not included when listing - dimensions. - :type expand: 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 dimension data. - :type top: int - :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 Dimension - :rtype: - ~azure.mgmt.consumption.models.DimensionPaged[~azure.mgmt.consumption.models.Dimension] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, '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) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.DimensionPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.DimensionPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/dimensions'} diff --git a/azure-mgmt-consumption/azure/mgmt/consumption/operations/tags_operations.py b/azure-mgmt-consumption/azure/mgmt/consumption/operations/tags_operations.py new file mode 100644 index 000000000000..5c22ea253a73 --- /dev/null +++ b/azure-mgmt-consumption/azure/mgmt/consumption/operations/tags_operations.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class TagsOperations(object): + """TagsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-30" + + 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 + :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: TagsResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.consumption.models.TagsResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TagsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/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 7e9e93d6f9fd..00a00df3dad6 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-05-31. Constant value: "2018-05-31". + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". """ 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-05-31" + self.api_version = "2018-06-30" self.config = config