Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.dimensions_operations import DimensionsOperations
from .operations.query_operations import QueryOperations
from .operations.exports_operations import ExportsOperations
from .operations.budgets_operations import BudgetsOperations
from .operations.budget_operations import BudgetOperations
from .operations.operations import Operations
from . import models

Expand All @@ -28,18 +27,14 @@ class CostManagementClientConfiguration(AzureConfiguration):
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):
self, credentials, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

Expand All @@ -49,7 +44,6 @@ def __init__(
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id


class CostManagementClient(SDKClient):
Expand All @@ -58,39 +52,33 @@ class CostManagementClient(SDKClient):
:ivar config: Configuration for client.
:vartype config: CostManagementClientConfiguration

:ivar dimensions: Dimensions operations
:vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations
:ivar query: Query operations
:vartype query: azure.mgmt.costmanagement.operations.QueryOperations
:ivar exports: Exports operations
:vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations
:ivar budgets: Budgets operations
:vartype budgets: azure.mgmt.costmanagement.operations.BudgetsOperations
:ivar budget: Budget operations
:vartype budget: azure.mgmt.costmanagement.operations.BudgetOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.costmanagement.operations.Operations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):
self, credentials, base_url=None):

self.config = CostManagementClientConfiguration(credentials, subscription_id, base_url)
self.config = CostManagementClientConfiguration(credentials, base_url)
super(CostManagementClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2019-01-01'
self.api_version = '2019-05-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.dimensions = DimensionsOperations(
self.budgets = BudgetsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.query = QueryOperations(
self._client, self.config, self._serialize, self._deserialize)
self.exports = ExportsOperations(
self.budget = BudgetOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
122 changes: 34 additions & 88 deletions azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,111 +10,57 @@
# --------------------------------------------------------------------------

try:
from .error_base_py3 import ErrorBase
from .error_details_py3 import ErrorDetails
from .error_response_py3 import ErrorResponse, ErrorResponseException
from .resource_py3 import Resource
from .dimension_py3 import Dimension
from .query_column_py3 import QueryColumn
from .query_py3 import Query
from .budget_time_period_py3 import BudgetTimePeriod
from .report_config_comparison_expression_py3 import ReportConfigComparisonExpression
from .report_config_filter_py3 import ReportConfigFilter
from .current_spend_py3 import CurrentSpend
from .notification_py3 import Notification
from .budget_model_py3 import BudgetModel
from .proxy_resource_py3 import ProxyResource
from .operation_display_py3 import OperationDisplay
from .operation_py3 import Operation
from .query_time_period_py3 import QueryTimePeriod
from .query_dataset_configuration_py3 import QueryDatasetConfiguration
from .query_aggregation_py3 import QueryAggregation
from .query_grouping_py3 import QueryGrouping
from .query_sorting_configuration_py3 import QuerySortingConfiguration
from .query_comparison_expression_py3 import QueryComparisonExpression
from .query_filter_py3 import QueryFilter
from .query_dataset_py3 import QueryDataset
from .query_definition_py3 import QueryDefinition
from .export_recurrence_period_py3 import ExportRecurrencePeriod
from .export_schedule_py3 import ExportSchedule
from .export_py3 import Export
from .export_list_result_py3 import ExportListResult
from .export_delivery_destination_py3 import ExportDeliveryDestination
from .export_delivery_info_py3 import ExportDeliveryInfo
from .common_export_properties_py3 import CommonExportProperties
from .export_execution_py3 import ExportExecution
from .export_execution_list_result_py3 import ExportExecutionListResult
except (SyntaxError, ImportError):
from .error_base import ErrorBase
from .error_details import ErrorDetails
from .error_response import ErrorResponse, ErrorResponseException
from .resource import Resource
from .dimension import Dimension
from .query_column import QueryColumn
from .query import Query
from .budget_time_period import BudgetTimePeriod
from .report_config_comparison_expression import ReportConfigComparisonExpression
from .report_config_filter import ReportConfigFilter
from .current_spend import CurrentSpend
from .notification import Notification
from .budget_model import BudgetModel
from .proxy_resource import ProxyResource
from .operation_display import OperationDisplay
from .operation import Operation
from .query_time_period import QueryTimePeriod
from .query_dataset_configuration import QueryDatasetConfiguration
from .query_aggregation import QueryAggregation
from .query_grouping import QueryGrouping
from .query_sorting_configuration import QuerySortingConfiguration
from .query_comparison_expression import QueryComparisonExpression
from .query_filter import QueryFilter
from .query_dataset import QueryDataset
from .query_definition import QueryDefinition
from .export_recurrence_period import ExportRecurrencePeriod
from .export_schedule import ExportSchedule
from .export import Export
from .export_list_result import ExportListResult
from .export_delivery_destination import ExportDeliveryDestination
from .export_delivery_info import ExportDeliveryInfo
from .common_export_properties import CommonExportProperties
from .export_execution import ExportExecution
from .export_execution_list_result import ExportExecutionListResult
from .dimension_paged import DimensionPaged
from .query_paged import QueryPaged
from .budget_model_paged import BudgetModelPaged
from .operation_paged import OperationPaged
from .cost_management_client_enums import (
TimeframeType,
GranularityType,
QueryColumnType,
SortDirection,
StatusType,
RecurrenceType,
FormatType,
ExecutionType,
ExecutionStatus,
CategoryType,
TimeGrainType,
OperatorType,
NotificationOperatorType,
)

__all__ = [
'ErrorBase',
'ErrorDetails',
'ErrorResponse', 'ErrorResponseException',
'Resource',
'Dimension',
'QueryColumn',
'Query',
'BudgetTimePeriod',
'ReportConfigComparisonExpression',
'ReportConfigFilter',
'CurrentSpend',
'Notification',
'BudgetModel',
'ProxyResource',
'OperationDisplay',
'Operation',
'QueryTimePeriod',
'QueryDatasetConfiguration',
'QueryAggregation',
'QueryGrouping',
'QuerySortingConfiguration',
'QueryComparisonExpression',
'QueryFilter',
'QueryDataset',
'QueryDefinition',
'ExportRecurrencePeriod',
'ExportSchedule',
'Export',
'ExportListResult',
'ExportDeliveryDestination',
'ExportDeliveryInfo',
'CommonExportProperties',
'ExportExecution',
'ExportExecutionListResult',
'DimensionPaged',
'QueryPaged',
'BudgetModelPaged',
'OperationPaged',
'TimeframeType',
'GranularityType',
'QueryColumnType',
'SortDirection',
'StatusType',
'RecurrenceType',
'FormatType',
'ExecutionType',
'ExecutionStatus',
'CategoryType',
'TimeGrainType',
'OperatorType',
'NotificationOperatorType',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# 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 BudgetModel(ProxyResource):
"""A budget resource.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

: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 scenario,
this field will be used to determine whether the user is updating the
latest version or not.
:type e_tag: str
:param category: Required. The category of the budget, whether the budget
tracks cost or usage. Possible values include: 'Cost', 'Usage'
:type category: str or ~azure.mgmt.costmanagement.models.CategoryType
:param amount: Required. The total amount of cost to track with the budget
:type amount: decimal.Decimal
:param time_grain: Required. 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.costmanagement.models.TimeGrainType
:param time_period: Required. 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 period. There are no restrictions on the end
date.
:type time_period: ~azure.mgmt.costmanagement.models.BudgetTimePeriod
:param filter: May be used to filter budgets.
:type filter: ~azure.mgmt.costmanagement.models.ReportConfigFilter
:ivar current_spend: The current amount of cost which is being tracked for
a budget.
:vartype current_spend: ~azure.mgmt.costmanagement.models.CurrentSpend
:param notifications: Dictionary of notifications associated with the
budget. Budget can have up to five notifications.
:type notifications: dict[str,
~azure.mgmt.costmanagement.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'},
'filter': {'key': 'properties.filter', 'type': 'ReportConfigFilter'},
'current_spend': {'key': 'properties.currentSpend', 'type': 'CurrentSpend'},
'notifications': {'key': 'properties.notifications', 'type': '{Notification}'},
}

def __init__(self, **kwargs):
super(BudgetModel, self).__init__(**kwargs)
self.category = kwargs.get('category', None)
self.amount = kwargs.get('amount', None)
self.time_grain = kwargs.get('time_grain', None)
self.time_period = kwargs.get('time_period', None)
self.filter = kwargs.get('filter', None)
self.current_spend = None
self.notifications = kwargs.get('notifications', None)
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
from msrest.paging import Paged


class QueryPaged(Paged):
class BudgetModelPaged(Paged):
"""
A paging container for iterating over a list of :class:`Query <azure.mgmt.costmanagement.models.Query>` object
A paging container for iterating over a list of :class:`BudgetModel <azure.mgmt.costmanagement.models.BudgetModel>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[Query]'}
'current_page': {'key': 'value', 'type': '[BudgetModel]'}
}

def __init__(self, *args, **kwargs):

super(QueryPaged, self).__init__(*args, **kwargs)
super(BudgetModelPaged, self).__init__(*args, **kwargs)
Loading