diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/MANIFEST.in b/sdk/costmanagement/azure-mgmt-costmanagement/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/MANIFEST.in +++ b/sdk/costmanagement/azure-mgmt-costmanagement/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json new file mode 100644 index 000000000000..73df2f058812 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "V2", + "use": "@microsoft.azure/autorest.python@~4.0.71", + "commit": "3c244ae1bf08078b636b02a84aa334acaf225b87", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/cost-management/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2", + "readme": "specification/cost-management/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py index 526f8dda9266..d554beb62922 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py @@ -13,10 +13,15 @@ from msrest import Serializer, Deserializer from ._configuration import CostManagementClientConfiguration +from .operations import SettingsOperations +from .operations import ViewsOperations +from .operations import AlertsOperations +from .operations import ForecastOperations from .operations import DimensionsOperations from .operations import QueryOperations -from .operations import ExportsOperations +from .operations import GenerateReservationDetailsReportOperations from .operations import Operations +from .operations import ExportsOperations from . import models @@ -26,14 +31,24 @@ class CostManagementClient(SDKClient): :ivar config: Configuration for client. :vartype config: CostManagementClientConfiguration + :ivar settings: Settings operations + :vartype settings: azure.mgmt.costmanagement.operations.SettingsOperations + :ivar views: Views operations + :vartype views: azure.mgmt.costmanagement.operations.ViewsOperations + :ivar alerts: Alerts operations + :vartype alerts: azure.mgmt.costmanagement.operations.AlertsOperations + :ivar forecast: Forecast operations + :vartype forecast: azure.mgmt.costmanagement.operations.ForecastOperations :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 generate_reservation_details_report: GenerateReservationDetailsReport operations + :vartype generate_reservation_details_report: azure.mgmt.costmanagement.operations.GenerateReservationDetailsReportOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.costmanagement.operations.Operations + :ivar exports: Exports operations + :vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -54,11 +69,21 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.settings = SettingsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.views = ViewsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.alerts = AlertsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.forecast = ForecastOperations( + self._client, self.config, self._serialize, self._deserialize) self.dimensions = DimensionsOperations( self._client, self.config, self._serialize, self._deserialize) self.query = QueryOperations( self._client, self.config, self._serialize, self._deserialize) - self.exports = ExportsOperations( + self.generate_reservation_details_report = GenerateReservationDetailsReportOperations( self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) + self.exports = ExportsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py index f9cce82b9bb8..15c8a6771a91 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py @@ -10,11 +10,18 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import Alert + from ._models_py3 import AlertPropertiesDefinition + from ._models_py3 import AlertPropertiesDetails + from ._models_py3 import AlertsResult + from ._models_py3 import CacheItem from ._models_py3 import CommonExportProperties from ._models_py3 import Dimension + from ._models_py3 import DismissAlertPayload from ._models_py3 import ErrorDetails from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import Export + from ._models_py3 import ExportDefinition from ._models_py3 import ExportDeliveryDestination from ._models_py3 import ExportDeliveryInfo from ._models_py3 import ExportExecution @@ -22,8 +29,14 @@ from ._models_py3 import ExportListResult from ._models_py3 import ExportRecurrencePeriod from ._models_py3 import ExportSchedule + from ._models_py3 import ForecastDefinition + from ._models_py3 import KpiProperties from ._models_py3 import Operation from ._models_py3 import OperationDisplay + from ._models_py3 import OperationStatus + from ._models_py3 import PivotProperties + from ._models_py3 import ProxyResource + from ._models_py3 import ProxySettingResource from ._models_py3 import QueryAggregation from ._models_py3 import QueryColumn from ._models_py3 import QueryComparisonExpression @@ -34,13 +47,31 @@ from ._models_py3 import QueryGrouping from ._models_py3 import QueryResult from ._models_py3 import QueryTimePeriod + from ._models_py3 import ReportConfigAggregation + from ._models_py3 import ReportConfigComparisonExpression + from ._models_py3 import ReportConfigDataset + from ._models_py3 import ReportConfigDatasetConfiguration + from ._models_py3 import ReportConfigFilter + from ._models_py3 import ReportConfigGrouping + from ._models_py3 import ReportConfigSorting + from ._models_py3 import ReportConfigTimePeriod from ._models_py3 import Resource + from ._models_py3 import Setting + from ._models_py3 import Status + from ._models_py3 import View except (SyntaxError, ImportError): + from ._models import Alert + from ._models import AlertPropertiesDefinition + from ._models import AlertPropertiesDetails + from ._models import AlertsResult + from ._models import CacheItem from ._models import CommonExportProperties from ._models import Dimension + from ._models import DismissAlertPayload from ._models import ErrorDetails from ._models import ErrorResponse, ErrorResponseException from ._models import Export + from ._models import ExportDefinition from ._models import ExportDeliveryDestination from ._models import ExportDeliveryInfo from ._models import ExportExecution @@ -48,8 +79,14 @@ from ._models import ExportListResult from ._models import ExportRecurrencePeriod from ._models import ExportSchedule + from ._models import ForecastDefinition + from ._models import KpiProperties from ._models import Operation from ._models import OperationDisplay + from ._models import OperationStatus + from ._models import PivotProperties + from ._models import ProxyResource + from ._models import ProxySettingResource from ._models import QueryAggregation from ._models import QueryColumn from ._models import QueryComparisonExpression @@ -60,27 +97,67 @@ from ._models import QueryGrouping from ._models import QueryResult from ._models import QueryTimePeriod + from ._models import ReportConfigAggregation + from ._models import ReportConfigComparisonExpression + from ._models import ReportConfigDataset + from ._models import ReportConfigDatasetConfiguration + from ._models import ReportConfigFilter + from ._models import ReportConfigGrouping + from ._models import ReportConfigSorting + from ._models import ReportConfigTimePeriod from ._models import Resource + from ._models import Setting + from ._models import Status + from ._models import View from ._paged_models import DimensionPaged from ._paged_models import OperationPaged +from ._paged_models import SettingPaged +from ._paged_models import ViewPaged from ._cost_management_client_enums import ( - ExportType, - TimeframeType, + ReportTimeframeType, + ReportGranularityType, + ReportConfigColumnType, + OperatorType, + ChartType, + AccumulatedType, + MetricType, + KpiTypeType, + PivotTypeType, + AlertType, + AlertCategory, + AlertCriteria, + AlertSource, + AlertTimeGrainType, + AlertOperator, + AlertStatus, + ForecastType, + ForecastTimeframeType, GranularityType, QueryColumnType, + ExportType, + TimeframeType, + OperationStatusType, StatusType, RecurrenceType, FormatType, ExecutionType, ExecutionStatus, + ExternalCloudProviderType, ) __all__ = [ + 'Alert', + 'AlertPropertiesDefinition', + 'AlertPropertiesDetails', + 'AlertsResult', + 'CacheItem', 'CommonExportProperties', 'Dimension', + 'DismissAlertPayload', 'ErrorDetails', 'ErrorResponse', 'ErrorResponseException', 'Export', + 'ExportDefinition', 'ExportDeliveryDestination', 'ExportDeliveryInfo', 'ExportExecution', @@ -88,8 +165,14 @@ 'ExportListResult', 'ExportRecurrencePeriod', 'ExportSchedule', + 'ForecastDefinition', + 'KpiProperties', 'Operation', 'OperationDisplay', + 'OperationStatus', + 'PivotProperties', + 'ProxyResource', + 'ProxySettingResource', 'QueryAggregation', 'QueryColumn', 'QueryComparisonExpression', @@ -100,16 +183,49 @@ 'QueryGrouping', 'QueryResult', 'QueryTimePeriod', + 'ReportConfigAggregation', + 'ReportConfigComparisonExpression', + 'ReportConfigDataset', + 'ReportConfigDatasetConfiguration', + 'ReportConfigFilter', + 'ReportConfigGrouping', + 'ReportConfigSorting', + 'ReportConfigTimePeriod', 'Resource', + 'Setting', + 'Status', + 'View', + 'SettingPaged', + 'ViewPaged', 'DimensionPaged', 'OperationPaged', - 'ExportType', - 'TimeframeType', + 'ReportTimeframeType', + 'ReportGranularityType', + 'ReportConfigColumnType', + 'OperatorType', + 'ChartType', + 'AccumulatedType', + 'MetricType', + 'KpiTypeType', + 'PivotTypeType', + 'AlertType', + 'AlertCategory', + 'AlertCriteria', + 'AlertSource', + 'AlertTimeGrainType', + 'AlertOperator', + 'AlertStatus', + 'ForecastType', + 'ForecastTimeframeType', 'GranularityType', 'QueryColumnType', + 'ExportType', + 'TimeframeType', + 'OperationStatusType', 'StatusType', 'RecurrenceType', 'FormatType', 'ExecutionType', 'ExecutionStatus', + 'ExternalCloudProviderType', ] diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py index d447d8444908..fae21dadc0c0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py @@ -12,14 +12,147 @@ from enum import Enum -class ExportType(str, Enum): +class ReportTimeframeType(str, Enum): + + week_to_date = "WeekToDate" + month_to_date = "MonthToDate" + year_to_date = "YearToDate" + custom = "Custom" + + +class ReportGranularityType(str, Enum): + + daily = "Daily" + monthly = "Monthly" + + +class ReportConfigColumnType(str, Enum): + + tag = "Tag" + dimension = "Dimension" + + +class OperatorType(str, Enum): + + in_enum = "In" + contains = "Contains" + + +class ChartType(str, Enum): + + area = "Area" + line = "Line" + stacked_column = "StackedColumn" + grouped_column = "GroupedColumn" + table = "Table" + + +class AccumulatedType(str, Enum): + + true = "true" + false = "false" + + +class MetricType(str, Enum): + + actual_cost = "ActualCost" + amortized_cost = "AmortizedCost" + ahub = "AHUB" + + +class KpiTypeType(str, Enum): + + forecast = "Forecast" + budget = "Budget" + + +class PivotTypeType(str, Enum): + + dimension = "Dimension" + tag_key = "TagKey" + + +class AlertType(str, Enum): + + budget = "Budget" + invoice = "Invoice" + credit = "Credit" + quota = "Quota" + general = "General" + x_cloud = "xCloud" + budget_forecast = "BudgetForecast" + + +class AlertCategory(str, Enum): + + cost = "Cost" + usage = "Usage" + billing = "Billing" + system = "System" + + +class AlertCriteria(str, Enum): + + cost_threshold_exceeded = "CostThresholdExceeded" + usage_threshold_exceeded = "UsageThresholdExceeded" + credit_threshold_approaching = "CreditThresholdApproaching" + credit_threshold_reached = "CreditThresholdReached" + quota_threshold_approaching = "QuotaThresholdApproaching" + quota_threshold_reached = "QuotaThresholdReached" + multi_currency = "MultiCurrency" + forecast_cost_threshold_exceeded = "ForecastCostThresholdExceeded" + forecast_usage_threshold_exceeded = "ForecastUsageThresholdExceeded" + invoice_due_date_approaching = "InvoiceDueDateApproaching" + invoice_due_date_reached = "InvoiceDueDateReached" + cross_cloud_new_data_available = "CrossCloudNewDataAvailable" + cross_cloud_collection_error = "CrossCloudCollectionError" + general_threshold_error = "GeneralThresholdError" + + +class AlertSource(str, Enum): + + preset = "Preset" + user = "User" + + +class AlertTimeGrainType(str, Enum): + + none = "None" + monthly = "Monthly" + quarterly = "Quarterly" + annually = "Annually" + billing_month = "BillingMonth" + billing_quarter = "BillingQuarter" + billing_annual = "BillingAnnual" + + +class AlertOperator(str, Enum): + + none = "None" + equal_to = "EqualTo" + greater_than = "GreaterThan" + greater_than_or_equal_to = "GreaterThanOrEqualTo" + less_than = "LessThan" + less_than_or_equal_to = "LessThanOrEqualTo" + + +class AlertStatus(str, Enum): + + none = "None" + active = "Active" + overridden = "Overridden" + resolved = "Resolved" + dismissed = "Dismissed" + + +class ForecastType(str, Enum): usage = "Usage" actual_cost = "ActualCost" amortized_cost = "AmortizedCost" -class TimeframeType(str, Enum): +class ForecastTimeframeType(str, Enum): month_to_date = "MonthToDate" billing_month_to_date = "BillingMonthToDate" @@ -40,6 +173,30 @@ class QueryColumnType(str, Enum): dimension = "Dimension" +class ExportType(str, Enum): + + usage = "Usage" + actual_cost = "ActualCost" + amortized_cost = "AmortizedCost" + + +class TimeframeType(str, Enum): + + month_to_date = "MonthToDate" + billing_month_to_date = "BillingMonthToDate" + the_last_month = "TheLastMonth" + the_last_billing_month = "TheLastBillingMonth" + week_to_date = "WeekToDate" + custom = "Custom" + + +class OperationStatusType(str, Enum): + + running = "Running" + completed = "Completed" + failed = "Failed" + + class StatusType(str, Enum): active = "Active" @@ -74,3 +231,9 @@ class ExecutionStatus(str, Enum): timeout = "Timeout" new_data_not_available = "NewDataNotAvailable" data_not_available = "DataNotAvailable" + + +class ExternalCloudProviderType(str, Enum): + + external_subscriptions = "externalSubscriptions" + external_billing_accounts = "externalBillingAccounts" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py index b06344b3295c..c31aa5b5cd5a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py @@ -13,48 +13,46 @@ from msrest.exceptions import HttpOperationError -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class CommonExportProperties(Model): - """The common properties of the export. +class Resource(Model): + """The Resource model definition. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when + sending a request. - :param format: The format of the export being delivered. Possible values - include: 'Csv' - :type format: str or ~azure.mgmt.costmanagement.models.FormatType - :param delivery_info: Required. Has delivery information for the export. - :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Required. Has definition for the export. - :type definition: ~azure.mgmt.costmanagement.models.QueryDefinition + :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] """ _validation = { - 'delivery_info': {'required': True}, - 'definition': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, } _attribute_map = { - 'format': {'key': 'format', 'type': 'str'}, - 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'definition', 'type': 'QueryDefinition'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__(self, **kwargs): - super(CommonExportProperties, self).__init__(**kwargs) - self.format = kwargs.get('format', None) - self.delivery_info = kwargs.get('delivery_info', None) - self.definition = kwargs.get('definition', None) + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = None -class Resource(Model): - """The Resource model definition. +class Alert(Resource): + """An individual alert. Variables are only populated by the server, and will be ignored when sending a request. @@ -67,6 +65,31 @@ class Resource(Model): :vartype type: str :ivar tags: Resource tags. :vartype tags: dict[str, str] + :param definition: defines the type of alert + :type definition: + ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition + :param description: Alert description + :type description: str + :param source: Source of alert. Possible values include: 'Preset', 'User' + :type source: str or ~azure.mgmt.costmanagement.models.AlertSource + :param details: Alert details + :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param cost_entity_id: related budget + :type cost_entity_id: str + :param status: alert status. Possible values include: 'None', 'Active', + 'Overridden', 'Resolved', 'Dismissed' + :type status: str or ~azure.mgmt.costmanagement.models.AlertStatus + :param creation_time: dateTime in which alert was created + :type creation_time: str + :param close_time: dateTime in which alert was closed + :type close_time: str + :param modification_time: dateTime in which alert was last modified + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was + last modified + :type status_modification_time: str """ _validation = { @@ -81,14 +104,267 @@ class Resource(Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, } def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = None + super(Alert, self).__init__(**kwargs) + self.definition = kwargs.get('definition', None) + self.description = kwargs.get('description', None) + self.source = kwargs.get('source', None) + self.details = kwargs.get('details', None) + self.cost_entity_id = kwargs.get('cost_entity_id', None) + self.status = kwargs.get('status', None) + self.creation_time = kwargs.get('creation_time', None) + self.close_time = kwargs.get('close_time', None) + self.modification_time = kwargs.get('modification_time', None) + self.status_modification_user_name = kwargs.get('status_modification_user_name', None) + self.status_modification_time = kwargs.get('status_modification_time', None) + + +class AlertPropertiesDefinition(Model): + """defines the type of alert. + + :param type: type of alert. Possible values include: 'Budget', 'Invoice', + 'Credit', 'Quota', 'General', 'xCloud', 'BudgetForecast' + :type type: str or ~azure.mgmt.costmanagement.models.AlertType + :param category: Alert category. Possible values include: 'Cost', 'Usage', + 'Billing', 'System' + :type category: str or ~azure.mgmt.costmanagement.models.AlertCategory + :param criteria: Criteria that triggered alert. Possible values include: + 'CostThresholdExceeded', 'UsageThresholdExceeded', + 'CreditThresholdApproaching', 'CreditThresholdReached', + 'QuotaThresholdApproaching', 'QuotaThresholdReached', 'MultiCurrency', + 'ForecastCostThresholdExceeded', 'ForecastUsageThresholdExceeded', + 'InvoiceDueDateApproaching', 'InvoiceDueDateReached', + 'CrossCloudNewDataAvailable', 'CrossCloudCollectionError', + 'GeneralThresholdError' + :type criteria: str or ~azure.mgmt.costmanagement.models.AlertCriteria + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AlertPropertiesDefinition, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.category = kwargs.get('category', None) + self.criteria = kwargs.get('criteria', None) + + +class AlertPropertiesDetails(Model): + """Alert details. + + :param time_grain_type: Type of timegrain cadence. Possible values + include: 'None', 'Monthly', 'Quarterly', 'Annually', 'BillingMonth', + 'BillingQuarter', 'BillingAnnual' + :type time_grain_type: str or + ~azure.mgmt.costmanagement.models.AlertTimeGrainType + :param period_start_date: datetime of periodStartDate + :type period_start_date: str + :param triggered_by: notificationId that triggered this alert + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by + :type meter_filter: list[object] + :param tag_filter: tags to filter by + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which + activated this alert + :type threshold: decimal.Decimal + :param operator: operator used to compare currentSpend with amount. + Possible values include: 'None', 'EqualTo', 'GreaterThan', + 'GreaterThanOrEqualTo', 'LessThan', 'LessThanOrEqualTo' + :type operator: str or ~azure.mgmt.costmanagement.models.AlertOperator + :param amount: budget threshold amount + :type amount: decimal.Decimal + :param unit: unit of currency being used + :type unit: str + :param current_spend: current spend + :type current_spend: decimal.Decimal + :param contact_emails: list of emails to contact + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to + :type contact_groups: list[str] + :param contact_roles: list of contact roles + :type contact_roles: list[str] + :param overriding_alert: overriding alert + :type overriding_alert: str + """ + + _attribute_map = { + 'time_grain_type': {'key': 'timeGrainType', 'type': 'str'}, + 'period_start_date': {'key': 'periodStartDate', 'type': 'str'}, + 'triggered_by': {'key': 'triggeredBy', 'type': 'str'}, + 'resource_group_filter': {'key': 'resourceGroupFilter', 'type': '[object]'}, + 'resource_filter': {'key': 'resourceFilter', 'type': '[object]'}, + 'meter_filter': {'key': 'meterFilter', 'type': '[object]'}, + 'tag_filter': {'key': 'tagFilter', 'type': 'object'}, + 'threshold': {'key': 'threshold', 'type': 'decimal'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'amount': {'key': 'amount', 'type': 'decimal'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_spend': {'key': 'currentSpend', 'type': 'decimal'}, + 'contact_emails': {'key': 'contactEmails', 'type': '[str]'}, + 'contact_groups': {'key': 'contactGroups', 'type': '[str]'}, + 'contact_roles': {'key': 'contactRoles', 'type': '[str]'}, + 'overriding_alert': {'key': 'overridingAlert', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AlertPropertiesDetails, self).__init__(**kwargs) + self.time_grain_type = kwargs.get('time_grain_type', None) + self.period_start_date = kwargs.get('period_start_date', None) + self.triggered_by = kwargs.get('triggered_by', None) + self.resource_group_filter = kwargs.get('resource_group_filter', None) + self.resource_filter = kwargs.get('resource_filter', None) + self.meter_filter = kwargs.get('meter_filter', None) + self.tag_filter = kwargs.get('tag_filter', None) + self.threshold = kwargs.get('threshold', None) + self.operator = kwargs.get('operator', None) + self.amount = kwargs.get('amount', None) + self.unit = kwargs.get('unit', None) + self.current_spend = kwargs.get('current_spend', None) + self.contact_emails = kwargs.get('contact_emails', None) + self.contact_groups = kwargs.get('contact_groups', None) + self.contact_roles = kwargs.get('contact_roles', None) + self.overriding_alert = kwargs.get('overriding_alert', None) + + +class AlertsResult(Model): + """Result of alerts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: List of alerts. + :vartype value: list[~azure.mgmt.costmanagement.models.Alert] + :ivar next_link: URL to get the next set of alerts results if there are + any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Alert]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AlertsResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CacheItem(Model): + """CacheItem. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID used by Resource Manager to uniquely + identify the scope. + :type id: str + :param name: Required. Display name for the scope. + :type name: str + :param channel: Required. Indicates the account type. Allowed values + include: EA, PAYG, Modern, Internal, Unknown. + :type channel: str + :param subchannel: Required. Indicates the type of modern account. Allowed + values include: Individual, Enterprise, Partner, Indirect, NotApplicable + :type subchannel: str + :param parent: Resource ID of the parent scope. For instance, + subscription's resource ID for a resource group or a management group + resource ID for a subscription. + :type parent: str + :param status: Indicates the status of the scope. Status only applies to + subscriptions and billing accounts. + :type status: str + """ + + _validation = { + 'id': {'required': True}, + 'name': {'required': True}, + 'channel': {'required': True}, + 'subchannel': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'channel': {'key': 'channel', 'type': 'str'}, + 'subchannel': {'key': 'subchannel', 'type': 'str'}, + 'parent': {'key': 'parent', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CacheItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.channel = kwargs.get('channel', None) + self.subchannel = kwargs.get('subchannel', None) + self.parent = kwargs.get('parent', None) + self.status = kwargs.get('status', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class CommonExportProperties(Model): + """The common properties of the export. + + All required parameters must be populated in order to send to Azure. + + :param format: The format of the export being delivered. Possible values + include: 'Csv' + :type format: str or ~azure.mgmt.costmanagement.models.FormatType + :param delivery_info: Required. Has delivery information for the export. + :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo + :param definition: Required. Has definition for the export. + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition + """ + + _validation = { + 'delivery_info': {'required': True}, + 'definition': {'required': True}, + } + + _attribute_map = { + 'format': {'key': 'format', 'type': 'str'}, + 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, + 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, + } + + def __init__(self, **kwargs): + super(CommonExportProperties, self).__init__(**kwargs) + self.format = kwargs.get('format', None) + self.delivery_info = kwargs.get('delivery_info', None) + self.definition = kwargs.get('definition', None) class Dimension(Resource): @@ -169,6 +445,65 @@ def __init__(self, **kwargs): self.next_link = None +class DismissAlertPayload(Model): + """The request payload to update an alert. + + :param definition: defines the type of alert + :type definition: + ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition + :param description: Alert description + :type description: str + :param source: Source of alert. Possible values include: 'Preset', 'User' + :type source: str or ~azure.mgmt.costmanagement.models.AlertSource + :param details: Alert details + :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param cost_entity_id: related budget + :type cost_entity_id: str + :param status: alert status. Possible values include: 'None', 'Active', + 'Overridden', 'Resolved', 'Dismissed' + :type status: str or ~azure.mgmt.costmanagement.models.AlertStatus + :param creation_time: dateTime in which alert was created + :type creation_time: str + :param close_time: dateTime in which alert was closed + :type close_time: str + :param modification_time: dateTime in which alert was last modified + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was + last modified + :type status_modification_time: str + """ + + _attribute_map = { + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DismissAlertPayload, self).__init__(**kwargs) + self.definition = kwargs.get('definition', None) + self.description = kwargs.get('description', None) + self.source = kwargs.get('source', None) + self.details = kwargs.get('details', None) + self.cost_entity_id = kwargs.get('cost_entity_id', None) + self.status = kwargs.get('status', None) + self.creation_time = kwargs.get('creation_time', None) + self.close_time = kwargs.get('close_time', None) + self.modification_time = kwargs.get('modification_time', None) + self.status_modification_user_name = kwargs.get('status_modification_user_name', None) + self.status_modification_time = kwargs.get('status_modification_time', None) + + class ErrorDetails(Model): """The details of the error. @@ -200,6 +535,12 @@ def __init__(self, **kwargs): class ErrorResponse(Model): """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + Some Error responses: + * 429 TooManyRequests - Request is throttled. Retry after waiting for the + time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" + header. + * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after + waiting for the time specified in the "Retry-After" header. :param error: The details of the error. :type error: ~azure.mgmt.costmanagement.models.ErrorDetails @@ -226,7 +567,46 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) -class Export(Resource): +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 scenario, + 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, **kwargs): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.e_tag = kwargs.get('e_tag', None) + + +class Export(ProxyResource): """A export resource. Variables are only populated by the server, and will be ignored when @@ -240,15 +620,17 @@ class Export(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, 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 format: The format of the export being delivered. Possible values include: 'Csv' :type format: str or ~azure.mgmt.costmanagement.models.FormatType :param delivery_info: Required. Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo :param definition: Required. Has definition for the export. - :type definition: ~azure.mgmt.costmanagement.models.QueryDefinition + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -257,7 +639,6 @@ class Export(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, 'delivery_info': {'required': True}, 'definition': {'required': True}, } @@ -266,10 +647,10 @@ class Export(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, 'format': {'key': 'properties.format', 'type': 'str'}, 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'properties.definition', 'type': 'QueryDefinition'}, + 'definition': {'key': 'properties.definition', 'type': 'ExportDefinition'}, 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, } @@ -281,6 +662,45 @@ def __init__(self, **kwargs): self.schedule = kwargs.get('schedule', None) +class ExportDefinition(Model): + """The definition of a query. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of the query. Possible values include: + 'Usage', 'ActualCost', 'AmortizedCost' + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: Required. The time frame for pulling data for the query. + If custom, then a specific time period must be provided. Possible values + include: 'MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom' + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param data_set: Has definition for data in this query. + :type data_set: ~azure.mgmt.costmanagement.models.QueryDataset + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'QueryDataset'}, + } + + def __init__(self, **kwargs): + super(ExportDefinition, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.timeframe = kwargs.get('timeframe', None) + self.time_period = kwargs.get('time_period', None) + self.data_set = kwargs.get('data_set', None) + + class ExportDeliveryDestination(Model): """The destination information for the delivery of the export. To allow access to a storage account, you must register the account's subscription with the @@ -529,30 +949,105 @@ def __init__(self, **kwargs): self.recurrence_period = kwargs.get('recurrence_period', None) -class Operation(Model): - """A Cost management REST API operation. +class ForecastDefinition(Model): + """The definition of a forecast. - 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 name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + :param type: Required. The type of the forecast. Possible values include: + 'Usage', 'ActualCost', 'AmortizedCost' + :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :param timeframe: Required. The time frame for pulling data for the + forecast. If custom, then a specific time period must be provided. + Possible values include: 'MonthToDate', 'BillingMonthToDate', + 'TheLastMonth', 'TheLastBillingMonth', 'WeekToDate', 'Custom' + :type timeframe: str or + ~azure.mgmt.costmanagement.models.ForecastTimeframeType + :param time_period: Has time period for pulling data for the forecast. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param dataset: Has definition for data in this forecast. + :type dataset: ~azure.mgmt.costmanagement.models.QueryDataset + :param include_actual_cost: a boolean determining if actualCost will be + included + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if + FreshPartialCost will be included + :type include_fresh_partial_cost: bool """ _validation = { - 'name': {'readonly': True}, + 'type': {'required': True}, + 'timeframe': {'required': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'dataset': {'key': 'dataset', 'type': 'QueryDataset'}, + 'include_actual_cost': {'key': 'includeActualCost', 'type': 'bool'}, + 'include_fresh_partial_cost': {'key': 'includeFreshPartialCost', 'type': 'bool'}, } def __init__(self, **kwargs): - super(Operation, self).__init__(**kwargs) - self.name = None + super(ForecastDefinition, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.timeframe = kwargs.get('timeframe', None) + self.time_period = kwargs.get('time_period', None) + self.dataset = kwargs.get('dataset', None) + self.include_actual_cost = kwargs.get('include_actual_cost', None) + self.include_fresh_partial_cost = kwargs.get('include_fresh_partial_cost', None) + + +class KpiProperties(Model): + """Each KPI must contain a 'type' and 'enabled' key. + + :param type: KPI type (Forecast, Budget). Possible values include: + 'Forecast', 'Budget' + :type type: str or ~azure.mgmt.costmanagement.models.KpiTypeType + :param id: ID of resource related to metric (budget). + :type id: str + :param enabled: show the KPI in the UI? + :type enabled: bool + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(KpiProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.id = kwargs.get('id', None) + self.enabled = kwargs.get('enabled', None) + + +class Operation(Model): + """A Cost management REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = None self.display = kwargs.get('display', None) @@ -590,6 +1085,89 @@ def __init__(self, **kwargs): self.operation = None +class OperationStatus(Model): + """The status of the long running operation. + + :param status: The status of the long running operation. + :type status: ~azure.mgmt.costmanagement.models.Status + :param report_url: The URL to download the generated report. + :type report_url: str + :param valid_until: The time at which report URL becomes invalid. + :type valid_until: datetime + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'Status'}, + 'report_url': {'key': 'properties.reportUrl', 'type': 'str'}, + 'valid_until': {'key': 'properties.validUntil', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(OperationStatus, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.report_url = kwargs.get('report_url', None) + self.valid_until = kwargs.get('valid_until', None) + + +class PivotProperties(Model): + """Each pivot must contain a 'type' and 'name'. + + :param type: Data type to show in view. Possible values include: + 'Dimension', 'TagKey' + :type type: str or ~azure.mgmt.costmanagement.models.PivotTypeType + :param name: Data field to show in view. + :type name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PivotProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + + +class ProxySettingResource(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 kind: Resource kind. + :vartype kind: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'readonly': True, 'max_length': 10}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProxySettingResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.kind = None + self.type = None + + class QueryAggregation(Model): """The aggregation expression to be used in the query. @@ -790,13 +1368,11 @@ class QueryFilter(Model): :param or_property: The logical "OR" expression. Must have at least 2 items. :type or_property: list[~azure.mgmt.costmanagement.models.QueryFilter] - :param not_property: The logical "NOT" expression. - :type not_property: ~azure.mgmt.costmanagement.models.QueryFilter - :param dimension: Has comparison expression for a dimension - :type dimension: + :param dimensions: Has comparison expression for a dimension + :type dimensions: ~azure.mgmt.costmanagement.models.QueryComparisonExpression - :param tag: Has comparison expression for a tag - :type tag: ~azure.mgmt.costmanagement.models.QueryComparisonExpression + :param tags: Has comparison expression for a tag + :type tags: ~azure.mgmt.costmanagement.models.QueryComparisonExpression """ _validation = { @@ -807,18 +1383,16 @@ class QueryFilter(Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[QueryFilter]'}, 'or_property': {'key': 'or', 'type': '[QueryFilter]'}, - 'not_property': {'key': 'not', 'type': 'QueryFilter'}, - 'dimension': {'key': 'dimension', 'type': 'QueryComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'QueryComparisonExpression'}, + 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, } def __init__(self, **kwargs): super(QueryFilter, self).__init__(**kwargs) self.and_property = kwargs.get('and_property', None) self.or_property = kwargs.get('or_property', None) - self.not_property = kwargs.get('not_property', None) - self.dimension = kwargs.get('dimension', None) - self.tag = kwargs.get('tag', None) + self.dimensions = kwargs.get('dimensions', None) + self.tags = kwargs.get('tags', None) class QueryGrouping(Model): @@ -864,6 +1438,14 @@ class QueryResult(Resource): :vartype type: str :ivar tags: Resource tags. :vartype tags: dict[str, 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 + :ivar location: Resource location + :vartype location: str + :ivar sku: Resource SKU + :vartype sku: str :param next_link: The link (url) to the next page of results. :type next_link: str :param columns: Array of columns @@ -877,6 +1459,8 @@ class QueryResult(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'tags': {'readonly': True}, + 'location': {'readonly': True}, + 'sku': {'readonly': True}, } _attribute_map = { @@ -884,6 +1468,9 @@ class QueryResult(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, 'columns': {'key': 'properties.columns', 'type': '[QueryColumn]'}, 'rows': {'key': 'properties.rows', 'type': '[[object]]'}, @@ -891,6 +1478,9 @@ class QueryResult(Resource): def __init__(self, **kwargs): super(QueryResult, self).__init__(**kwargs) + self.e_tag = kwargs.get('e_tag', None) + self.location = None + self.sku = None self.next_link = kwargs.get('next_link', None) self.columns = kwargs.get('columns', None) self.rows = kwargs.get('rows', None) @@ -921,3 +1511,478 @@ def __init__(self, **kwargs): super(QueryTimePeriod, self).__init__(**kwargs) self.from_property = kwargs.get('from_property', None) self.to = kwargs.get('to', None) + + +class ReportConfigAggregation(Model): + """The aggregation expression to be used in the report. + + 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. + + :param name: Required. The name of the column to aggregate. + :type name: str + :ivar function: Required. The name of the aggregation function to use. + Default value: "Sum" . + :vartype function: str + """ + + _validation = { + 'name': {'required': True}, + 'function': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function': {'key': 'function', 'type': 'str'}, + } + + function = "Sum" + + def __init__(self, **kwargs): + super(ReportConfigAggregation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class ReportConfigComparisonExpression(Model): + """The comparison expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to use in comparison. + :type name: str + :param operator: Required. The operator to use for comparison. Possible + values include: 'In', 'Contains' + :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType + :param values: Required. Array of values to use for comparison + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(ReportConfigComparisonExpression, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.operator = kwargs.get('operator', None) + self.values = kwargs.get('values', None) + + +class ReportConfigDataset(Model): + """The definition of data present in the report. + + :param granularity: The granularity of rows in the report. Possible values + include: 'Daily', 'Monthly' + :type granularity: str or + ~azure.mgmt.costmanagement.models.ReportGranularityType + :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.costmanagement.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 up to 2 aggregation clauses. + :type aggregation: dict[str, + ~azure.mgmt.costmanagement.models.ReportConfigAggregation] + :param grouping: Array of group by expression to use in the report. Report + can have up to 2 group by clauses. + :type grouping: + list[~azure.mgmt.costmanagement.models.ReportConfigGrouping] + :param sorting: Array of order by expression to use in the report. + :type sorting: list[~azure.mgmt.costmanagement.models.ReportConfigSorting] + :param filter: Has filter expression to use in the report. + :type filter: ~azure.mgmt.costmanagement.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]'}, + 'sorting': {'key': 'sorting', 'type': '[ReportConfigSorting]'}, + 'filter': {'key': 'filter', 'type': 'ReportConfigFilter'}, + } + + def __init__(self, **kwargs): + super(ReportConfigDataset, self).__init__(**kwargs) + self.granularity = kwargs.get('granularity', None) + self.configuration = kwargs.get('configuration', None) + self.aggregation = kwargs.get('aggregation', None) + self.grouping = kwargs.get('grouping', None) + self.sorting = kwargs.get('sorting', None) + self.filter = kwargs.get('filter', None) + + +class ReportConfigDatasetConfiguration(Model): + """The configuration of dataset in the report. + + :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] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(ReportConfigDatasetConfiguration, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + + +class ReportConfigFilter(Model): + """The filter expression to be used in the report. + + :param and_property: The logical "AND" expression. Must have at least 2 + items. + :type and_property: + list[~azure.mgmt.costmanagement.models.ReportConfigFilter] + :param or_property: The logical "OR" expression. Must have at least 2 + items. + :type or_property: + list[~azure.mgmt.costmanagement.models.ReportConfigFilter] + :param dimensions: Has comparison expression for a dimension + :type dimensions: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tags: Has comparison expression for a tag + :type tags: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tag_key: Has comparison expression for a tag key + :type tag_key: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tag_value: Has comparison expression for a tag value + :type tag_value: + ~azure.mgmt.costmanagement.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]'}, + 'dimensions': {'key': 'dimensions', 'type': 'ReportConfigComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'ReportConfigComparisonExpression'}, + 'tag_key': {'key': 'tagKey', 'type': 'ReportConfigComparisonExpression'}, + 'tag_value': {'key': 'tagValue', 'type': 'ReportConfigComparisonExpression'}, + } + + def __init__(self, **kwargs): + super(ReportConfigFilter, self).__init__(**kwargs) + self.and_property = kwargs.get('and_property', None) + self.or_property = kwargs.get('or_property', None) + self.dimensions = kwargs.get('dimensions', None) + self.tags = kwargs.get('tags', None) + self.tag_key = kwargs.get('tag_key', None) + self.tag_value = kwargs.get('tag_value', None) + + +class ReportConfigGrouping(Model): + """The group by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Has type of the column to group. Possible values + include: 'Tag', 'Dimension' + :type type: str or + ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :param name: Required. The name of the column to group. This version + supports subscription lowest possible grain. + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ReportConfigGrouping, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + + +class ReportConfigSorting(Model): + """The order by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param direction: Direction of sort. Possible values include: 'Ascending', + 'Descending' + :type direction: str or ~azure.mgmt.costmanagement.models.enum + :param name: Required. The name of the column to sort. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'direction': {'key': 'direction', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ReportConfigSorting, self).__init__(**kwargs) + self.direction = kwargs.get('direction', None) + self.name = kwargs.get('name', None) + + +class ReportConfigTimePeriod(Model): + """The start and end date for pulling data for the report. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date to pull data from. + :type from_property: datetime + :param to: Required. 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, **kwargs): + super(ReportConfigTimePeriod, self).__init__(**kwargs) + self.from_property = kwargs.get('from_property', None) + self.to = kwargs.get('to', None) + + +class Setting(ProxySettingResource): + """State of the myscope setting. + + 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 kind: Resource kind. + :vartype kind: str + :ivar type: Resource type. + :vartype type: str + :param scope: Required. Sets the default scope the current user will see + when they sign into Azure Cost Management in the Azure portal. + :type scope: str + :param start_on: Indicates what scope Cost Management in the Azure portal + should default to. Allowed values: LastUsed. Possible values include: + 'LastUsed', 'ScopePicker', 'SpecificScope' + :type start_on: str or ~azure.mgmt.costmanagement.models.enum + :param cache: + :type cache: list[~azure.mgmt.costmanagement.models.CacheItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'readonly': True, 'max_length': 10}, + 'type': {'readonly': True}, + 'scope': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'start_on': {'key': 'properties.startOn', 'type': 'str'}, + 'cache': {'key': 'properties.cache', 'type': '[CacheItem]'}, + } + + def __init__(self, **kwargs): + super(Setting, self).__init__(**kwargs) + self.scope = kwargs.get('scope', None) + self.start_on = kwargs.get('start_on', None) + self.cache = kwargs.get('cache', None) + + +class Status(Model): + """The status of the long running operation. + + :param status: The status of the long running operation. Possible values + include: 'Running', 'Completed', 'Failed' + :type status: str or ~azure.mgmt.costmanagement.models.OperationStatusType + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Status, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + + +class View(ProxyResource): + """States and configurations of Cost Analysis. + + 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 display_name: User input name of the view. Required. + :type display_name: str + :param scope: Cost Management scope to save the view on. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + Management Group scope, + '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for ExternalBillingAccount scope, and + '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for ExternalSubscription scope. + :type scope: str + :ivar created_on: Date the user created this view. + :vartype created_on: datetime + :ivar modified_on: Date when the user last modified this view. + :vartype modified_on: datetime + :ivar date_range: Selected date range for viewing cost in. + :vartype date_range: str + :ivar currency: Selected currency. + :vartype currency: str + :ivar view_type: Required. The type of the report. Usage represents actual + usage, forecast represents forecasted data and UsageAndForecast represents + both usage and forecasted data. Actual usage and forecasted data can be + differentiated based on dates. Default value: "Usage" . + :vartype view_type: str + :param timeframe: Required. 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.costmanagement.models.ReportTimeframeType + :param time_period: Has time period for pulling data for the report. + :type time_period: + ~azure.mgmt.costmanagement.models.ReportConfigTimePeriod + :param data_set: Has definition for data in this report config. + :type data_set: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :ivar include_monetary_commitment: Include monetary commitment + :vartype include_monetary_commitment: bool + :param chart: Chart type of the main view in Cost Analysis. Required. + Possible values include: 'Area', 'Line', 'StackedColumn', 'GroupedColumn', + 'Table' + :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :param accumulated: Show costs accumulated over time. Possible values + include: 'true', 'false' + :type accumulated: str or + ~azure.mgmt.costmanagement.models.AccumulatedType + :param metric: Metric to use when displaying costs. Possible values + include: 'ActualCost', 'AmortizedCost', 'AHUB' + :type metric: str or ~azure.mgmt.costmanagement.models.MetricType + :param kpis: List of KPIs to show in Cost Analysis UI. + :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :param pivots: Configuration of 3 sub-views in the Cost Analysis UI. + :type pivots: list[~azure.mgmt.costmanagement.models.PivotProperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_on': {'readonly': True}, + 'modified_on': {'readonly': True}, + 'date_range': {'readonly': True}, + 'currency': {'readonly': True}, + 'view_type': {'required': True, 'constant': True}, + 'timeframe': {'required': True}, + 'include_monetary_commitment': {'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'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, + 'date_range': {'key': 'properties.dateRange', 'type': 'str'}, + 'currency': {'key': 'properties.currency', 'type': 'str'}, + 'view_type': {'key': 'properties.query.type', 'type': 'str'}, + 'timeframe': {'key': 'properties.query.timeframe', 'type': 'str'}, + 'time_period': {'key': 'properties.query.timePeriod', 'type': 'ReportConfigTimePeriod'}, + 'data_set': {'key': 'properties.query.dataSet', 'type': 'ReportConfigDataset'}, + 'include_monetary_commitment': {'key': 'properties.query.includeMonetaryCommitment', 'type': 'bool'}, + 'chart': {'key': 'properties.chart', 'type': 'str'}, + 'accumulated': {'key': 'properties.accumulated', 'type': 'str'}, + 'metric': {'key': 'properties.metric', 'type': 'str'}, + 'kpis': {'key': 'properties.kpis', 'type': '[KpiProperties]'}, + 'pivots': {'key': 'properties.pivots', 'type': '[PivotProperties]'}, + } + + view_type = "Usage" + + def __init__(self, **kwargs): + super(View, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.scope = kwargs.get('scope', None) + self.created_on = None + self.modified_on = None + self.date_range = None + self.currency = None + self.timeframe = kwargs.get('timeframe', None) + self.time_period = kwargs.get('time_period', None) + self.data_set = kwargs.get('data_set', None) + self.include_monetary_commitment = None + self.chart = kwargs.get('chart', None) + self.accumulated = kwargs.get('accumulated', None) + self.metric = kwargs.get('metric', None) + self.kpis = kwargs.get('kpis', None) + self.pivots = kwargs.get('pivots', None) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py index 01cef7145aec..5eeb0ef9571f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py @@ -13,48 +13,46 @@ from msrest.exceptions import HttpOperationError -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class CommonExportProperties(Model): - """The common properties of the export. +class Resource(Model): + """The Resource model definition. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when + sending a request. - :param format: The format of the export being delivered. Possible values - include: 'Csv' - :type format: str or ~azure.mgmt.costmanagement.models.FormatType - :param delivery_info: Required. Has delivery information for the export. - :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Required. Has definition for the export. - :type definition: ~azure.mgmt.costmanagement.models.QueryDefinition + :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] """ _validation = { - 'delivery_info': {'required': True}, - 'definition': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, } _attribute_map = { - 'format': {'key': 'format', 'type': 'str'}, - 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'definition', 'type': 'QueryDefinition'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, delivery_info, definition, format=None, **kwargs) -> None: - super(CommonExportProperties, self).__init__(**kwargs) - self.format = format - self.delivery_info = delivery_info - self.definition = definition + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = None -class Resource(Model): - """The Resource model definition. +class Alert(Resource): + """An individual alert. Variables are only populated by the server, and will be ignored when sending a request. @@ -67,6 +65,31 @@ class Resource(Model): :vartype type: str :ivar tags: Resource tags. :vartype tags: dict[str, str] + :param definition: defines the type of alert + :type definition: + ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition + :param description: Alert description + :type description: str + :param source: Source of alert. Possible values include: 'Preset', 'User' + :type source: str or ~azure.mgmt.costmanagement.models.AlertSource + :param details: Alert details + :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param cost_entity_id: related budget + :type cost_entity_id: str + :param status: alert status. Possible values include: 'None', 'Active', + 'Overridden', 'Resolved', 'Dismissed' + :type status: str or ~azure.mgmt.costmanagement.models.AlertStatus + :param creation_time: dateTime in which alert was created + :type creation_time: str + :param close_time: dateTime in which alert was closed + :type close_time: str + :param modification_time: dateTime in which alert was last modified + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was + last modified + :type status_modification_time: str """ _validation = { @@ -81,14 +104,267 @@ class Resource(Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + } + + def __init__(self, *, definition=None, description: str=None, source=None, details=None, cost_entity_id: str=None, status=None, creation_time: str=None, close_time: str=None, modification_time: str=None, status_modification_user_name: str=None, status_modification_time: str=None, **kwargs) -> None: + super(Alert, self).__init__(**kwargs) + self.definition = definition + self.description = description + self.source = source + self.details = details + self.cost_entity_id = cost_entity_id + self.status = status + self.creation_time = creation_time + self.close_time = close_time + self.modification_time = modification_time + self.status_modification_user_name = status_modification_user_name + self.status_modification_time = status_modification_time + + +class AlertPropertiesDefinition(Model): + """defines the type of alert. + + :param type: type of alert. Possible values include: 'Budget', 'Invoice', + 'Credit', 'Quota', 'General', 'xCloud', 'BudgetForecast' + :type type: str or ~azure.mgmt.costmanagement.models.AlertType + :param category: Alert category. Possible values include: 'Cost', 'Usage', + 'Billing', 'System' + :type category: str or ~azure.mgmt.costmanagement.models.AlertCategory + :param criteria: Criteria that triggered alert. Possible values include: + 'CostThresholdExceeded', 'UsageThresholdExceeded', + 'CreditThresholdApproaching', 'CreditThresholdReached', + 'QuotaThresholdApproaching', 'QuotaThresholdReached', 'MultiCurrency', + 'ForecastCostThresholdExceeded', 'ForecastUsageThresholdExceeded', + 'InvoiceDueDateApproaching', 'InvoiceDueDateReached', + 'CrossCloudNewDataAvailable', 'CrossCloudCollectionError', + 'GeneralThresholdError' + :type criteria: str or ~azure.mgmt.costmanagement.models.AlertCriteria + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'str'}, + } + + def __init__(self, *, type=None, category=None, criteria=None, **kwargs) -> None: + super(AlertPropertiesDefinition, self).__init__(**kwargs) + self.type = type + self.category = category + self.criteria = criteria + + +class AlertPropertiesDetails(Model): + """Alert details. + + :param time_grain_type: Type of timegrain cadence. Possible values + include: 'None', 'Monthly', 'Quarterly', 'Annually', 'BillingMonth', + 'BillingQuarter', 'BillingAnnual' + :type time_grain_type: str or + ~azure.mgmt.costmanagement.models.AlertTimeGrainType + :param period_start_date: datetime of periodStartDate + :type period_start_date: str + :param triggered_by: notificationId that triggered this alert + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by + :type meter_filter: list[object] + :param tag_filter: tags to filter by + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which + activated this alert + :type threshold: decimal.Decimal + :param operator: operator used to compare currentSpend with amount. + Possible values include: 'None', 'EqualTo', 'GreaterThan', + 'GreaterThanOrEqualTo', 'LessThan', 'LessThanOrEqualTo' + :type operator: str or ~azure.mgmt.costmanagement.models.AlertOperator + :param amount: budget threshold amount + :type amount: decimal.Decimal + :param unit: unit of currency being used + :type unit: str + :param current_spend: current spend + :type current_spend: decimal.Decimal + :param contact_emails: list of emails to contact + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to + :type contact_groups: list[str] + :param contact_roles: list of contact roles + :type contact_roles: list[str] + :param overriding_alert: overriding alert + :type overriding_alert: str + """ + + _attribute_map = { + 'time_grain_type': {'key': 'timeGrainType', 'type': 'str'}, + 'period_start_date': {'key': 'periodStartDate', 'type': 'str'}, + 'triggered_by': {'key': 'triggeredBy', 'type': 'str'}, + 'resource_group_filter': {'key': 'resourceGroupFilter', 'type': '[object]'}, + 'resource_filter': {'key': 'resourceFilter', 'type': '[object]'}, + 'meter_filter': {'key': 'meterFilter', 'type': '[object]'}, + 'tag_filter': {'key': 'tagFilter', 'type': 'object'}, + 'threshold': {'key': 'threshold', 'type': 'decimal'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'amount': {'key': 'amount', 'type': 'decimal'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_spend': {'key': 'currentSpend', 'type': 'decimal'}, + 'contact_emails': {'key': 'contactEmails', 'type': '[str]'}, + 'contact_groups': {'key': 'contactGroups', 'type': '[str]'}, + 'contact_roles': {'key': 'contactRoles', 'type': '[str]'}, + 'overriding_alert': {'key': 'overridingAlert', 'type': 'str'}, + } + + def __init__(self, *, time_grain_type=None, period_start_date: str=None, triggered_by: str=None, resource_group_filter=None, resource_filter=None, meter_filter=None, tag_filter=None, threshold=None, operator=None, amount=None, unit: str=None, current_spend=None, contact_emails=None, contact_groups=None, contact_roles=None, overriding_alert: str=None, **kwargs) -> None: + super(AlertPropertiesDetails, self).__init__(**kwargs) + self.time_grain_type = time_grain_type + self.period_start_date = period_start_date + self.triggered_by = triggered_by + self.resource_group_filter = resource_group_filter + self.resource_filter = resource_filter + self.meter_filter = meter_filter + self.tag_filter = tag_filter + self.threshold = threshold + self.operator = operator + self.amount = amount + self.unit = unit + self.current_spend = current_spend + self.contact_emails = contact_emails + self.contact_groups = contact_groups + self.contact_roles = contact_roles + self.overriding_alert = overriding_alert + + +class AlertsResult(Model): + """Result of alerts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: List of alerts. + :vartype value: list[~azure.mgmt.costmanagement.models.Alert] + :ivar next_link: URL to get the next set of alerts results if there are + any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Alert]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = None + super(AlertsResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CacheItem(Model): + """CacheItem. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID used by Resource Manager to uniquely + identify the scope. + :type id: str + :param name: Required. Display name for the scope. + :type name: str + :param channel: Required. Indicates the account type. Allowed values + include: EA, PAYG, Modern, Internal, Unknown. + :type channel: str + :param subchannel: Required. Indicates the type of modern account. Allowed + values include: Individual, Enterprise, Partner, Indirect, NotApplicable + :type subchannel: str + :param parent: Resource ID of the parent scope. For instance, + subscription's resource ID for a resource group or a management group + resource ID for a subscription. + :type parent: str + :param status: Indicates the status of the scope. Status only applies to + subscriptions and billing accounts. + :type status: str + """ + + _validation = { + 'id': {'required': True}, + 'name': {'required': True}, + 'channel': {'required': True}, + 'subchannel': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'channel': {'key': 'channel', 'type': 'str'}, + 'subchannel': {'key': 'subchannel', 'type': 'str'}, + 'parent': {'key': 'parent', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, *, id: str, name: str, channel: str, subchannel: str, parent: str=None, status: str=None, **kwargs) -> None: + super(CacheItem, self).__init__(**kwargs) + self.id = id + self.name = name + self.channel = channel + self.subchannel = subchannel + self.parent = parent + self.status = status + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class CommonExportProperties(Model): + """The common properties of the export. + + All required parameters must be populated in order to send to Azure. + + :param format: The format of the export being delivered. Possible values + include: 'Csv' + :type format: str or ~azure.mgmt.costmanagement.models.FormatType + :param delivery_info: Required. Has delivery information for the export. + :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo + :param definition: Required. Has definition for the export. + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition + """ + + _validation = { + 'delivery_info': {'required': True}, + 'definition': {'required': True}, + } + + _attribute_map = { + 'format': {'key': 'format', 'type': 'str'}, + 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, + 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, + } + + def __init__(self, *, delivery_info, definition, format=None, **kwargs) -> None: + super(CommonExportProperties, self).__init__(**kwargs) + self.format = format + self.delivery_info = delivery_info + self.definition = definition class Dimension(Resource): @@ -169,6 +445,65 @@ def __init__(self, *, data=None, **kwargs) -> None: self.next_link = None +class DismissAlertPayload(Model): + """The request payload to update an alert. + + :param definition: defines the type of alert + :type definition: + ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition + :param description: Alert description + :type description: str + :param source: Source of alert. Possible values include: 'Preset', 'User' + :type source: str or ~azure.mgmt.costmanagement.models.AlertSource + :param details: Alert details + :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param cost_entity_id: related budget + :type cost_entity_id: str + :param status: alert status. Possible values include: 'None', 'Active', + 'Overridden', 'Resolved', 'Dismissed' + :type status: str or ~azure.mgmt.costmanagement.models.AlertStatus + :param creation_time: dateTime in which alert was created + :type creation_time: str + :param close_time: dateTime in which alert was closed + :type close_time: str + :param modification_time: dateTime in which alert was last modified + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was + last modified + :type status_modification_time: str + """ + + _attribute_map = { + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + } + + def __init__(self, *, definition=None, description: str=None, source=None, details=None, cost_entity_id: str=None, status=None, creation_time: str=None, close_time: str=None, modification_time: str=None, status_modification_user_name: str=None, status_modification_time: str=None, **kwargs) -> None: + super(DismissAlertPayload, self).__init__(**kwargs) + self.definition = definition + self.description = description + self.source = source + self.details = details + self.cost_entity_id = cost_entity_id + self.status = status + self.creation_time = creation_time + self.close_time = close_time + self.modification_time = modification_time + self.status_modification_user_name = status_modification_user_name + self.status_modification_time = status_modification_time + + class ErrorDetails(Model): """The details of the error. @@ -200,6 +535,12 @@ def __init__(self, **kwargs) -> None: class ErrorResponse(Model): """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + Some Error responses: + * 429 TooManyRequests - Request is throttled. Retry after waiting for the + time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" + header. + * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after + waiting for the time specified in the "Retry-After" header. :param error: The details of the error. :type error: ~azure.mgmt.costmanagement.models.ErrorDetails @@ -226,7 +567,46 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) -class Export(Resource): +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 scenario, + 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: str=None, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.e_tag = e_tag + + +class Export(ProxyResource): """A export resource. Variables are only populated by the server, and will be ignored when @@ -240,15 +620,17 @@ class Export(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, 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 format: The format of the export being delivered. Possible values include: 'Csv' :type format: str or ~azure.mgmt.costmanagement.models.FormatType :param delivery_info: Required. Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo :param definition: Required. Has definition for the export. - :type definition: ~azure.mgmt.costmanagement.models.QueryDefinition + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -257,7 +639,6 @@ class Export(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, 'delivery_info': {'required': True}, 'definition': {'required': True}, } @@ -266,21 +647,60 @@ class Export(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, 'format': {'key': 'properties.format', 'type': 'str'}, 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'properties.definition', 'type': 'QueryDefinition'}, + 'definition': {'key': 'properties.definition', 'type': 'ExportDefinition'}, 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, } - def __init__(self, *, delivery_info, definition, format=None, schedule=None, **kwargs) -> None: - super(Export, self).__init__(**kwargs) + def __init__(self, *, delivery_info, definition, e_tag: str=None, format=None, schedule=None, **kwargs) -> None: + super(Export, self).__init__(e_tag=e_tag, **kwargs) self.format = format self.delivery_info = delivery_info self.definition = definition self.schedule = schedule +class ExportDefinition(Model): + """The definition of a query. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of the query. Possible values include: + 'Usage', 'ActualCost', 'AmortizedCost' + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: Required. The time frame for pulling data for the query. + If custom, then a specific time period must be provided. Possible values + include: 'MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom' + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param data_set: Has definition for data in this query. + :type data_set: ~azure.mgmt.costmanagement.models.QueryDataset + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'QueryDataset'}, + } + + def __init__(self, *, type, timeframe, time_period=None, data_set=None, **kwargs) -> None: + super(ExportDefinition, self).__init__(**kwargs) + self.type = type + self.timeframe = timeframe + self.time_period = time_period + self.data_set = data_set + + class ExportDeliveryDestination(Model): """The destination information for the delivery of the export. To allow access to a storage account, you must register the account's subscription with the @@ -529,34 +949,109 @@ def __init__(self, *, recurrence, status=None, recurrence_period=None, **kwargs) self.recurrence_period = recurrence_period -class Operation(Model): - """A Cost management REST API operation. +class ForecastDefinition(Model): + """The definition of a forecast. - 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 name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + :param type: Required. The type of the forecast. Possible values include: + 'Usage', 'ActualCost', 'AmortizedCost' + :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :param timeframe: Required. The time frame for pulling data for the + forecast. If custom, then a specific time period must be provided. + Possible values include: 'MonthToDate', 'BillingMonthToDate', + 'TheLastMonth', 'TheLastBillingMonth', 'WeekToDate', 'Custom' + :type timeframe: str or + ~azure.mgmt.costmanagement.models.ForecastTimeframeType + :param time_period: Has time period for pulling data for the forecast. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param dataset: Has definition for data in this forecast. + :type dataset: ~azure.mgmt.costmanagement.models.QueryDataset + :param include_actual_cost: a boolean determining if actualCost will be + included + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if + FreshPartialCost will be included + :type include_fresh_partial_cost: bool """ _validation = { - 'name': {'readonly': True}, + 'type': {'required': True}, + 'timeframe': {'required': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'dataset': {'key': 'dataset', 'type': 'QueryDataset'}, + 'include_actual_cost': {'key': 'includeActualCost', 'type': 'bool'}, + 'include_fresh_partial_cost': {'key': 'includeFreshPartialCost', 'type': 'bool'}, } - def __init__(self, *, display=None, **kwargs) -> None: - super(Operation, self).__init__(**kwargs) - self.name = None - self.display = display - - -class OperationDisplay(Model): + def __init__(self, *, type, timeframe, time_period=None, dataset=None, include_actual_cost: bool=None, include_fresh_partial_cost: bool=None, **kwargs) -> None: + super(ForecastDefinition, self).__init__(**kwargs) + self.type = type + self.timeframe = timeframe + self.time_period = time_period + self.dataset = dataset + self.include_actual_cost = include_actual_cost + self.include_fresh_partial_cost = include_fresh_partial_cost + + +class KpiProperties(Model): + """Each KPI must contain a 'type' and 'enabled' key. + + :param type: KPI type (Forecast, Budget). Possible values include: + 'Forecast', 'Budget' + :type type: str or ~azure.mgmt.costmanagement.models.KpiTypeType + :param id: ID of resource related to metric (budget). + :type id: str + :param enabled: show the KPI in the UI? + :type enabled: bool + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__(self, *, type=None, id: str=None, enabled: bool=None, **kwargs) -> None: + super(KpiProperties, self).__init__(**kwargs) + self.type = type + self.id = id + self.enabled = enabled + + +class Operation(Model): + """A Cost management REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(Model): """The object that represents the operation. Variables are only populated by the server, and will be ignored when @@ -590,6 +1085,89 @@ def __init__(self, **kwargs) -> None: self.operation = None +class OperationStatus(Model): + """The status of the long running operation. + + :param status: The status of the long running operation. + :type status: ~azure.mgmt.costmanagement.models.Status + :param report_url: The URL to download the generated report. + :type report_url: str + :param valid_until: The time at which report URL becomes invalid. + :type valid_until: datetime + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'Status'}, + 'report_url': {'key': 'properties.reportUrl', 'type': 'str'}, + 'valid_until': {'key': 'properties.validUntil', 'type': 'iso-8601'}, + } + + def __init__(self, *, status=None, report_url: str=None, valid_until=None, **kwargs) -> None: + super(OperationStatus, self).__init__(**kwargs) + self.status = status + self.report_url = report_url + self.valid_until = valid_until + + +class PivotProperties(Model): + """Each pivot must contain a 'type' and 'name'. + + :param type: Data type to show in view. Possible values include: + 'Dimension', 'TagKey' + :type type: str or ~azure.mgmt.costmanagement.models.PivotTypeType + :param name: Data field to show in view. + :type name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, type=None, name: str=None, **kwargs) -> None: + super(PivotProperties, self).__init__(**kwargs) + self.type = type + self.name = name + + +class ProxySettingResource(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 kind: Resource kind. + :vartype kind: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'readonly': True, 'max_length': 10}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ProxySettingResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.kind = None + self.type = None + + class QueryAggregation(Model): """The aggregation expression to be used in the query. @@ -790,13 +1368,11 @@ class QueryFilter(Model): :param or_property: The logical "OR" expression. Must have at least 2 items. :type or_property: list[~azure.mgmt.costmanagement.models.QueryFilter] - :param not_property: The logical "NOT" expression. - :type not_property: ~azure.mgmt.costmanagement.models.QueryFilter - :param dimension: Has comparison expression for a dimension - :type dimension: + :param dimensions: Has comparison expression for a dimension + :type dimensions: ~azure.mgmt.costmanagement.models.QueryComparisonExpression - :param tag: Has comparison expression for a tag - :type tag: ~azure.mgmt.costmanagement.models.QueryComparisonExpression + :param tags: Has comparison expression for a tag + :type tags: ~azure.mgmt.costmanagement.models.QueryComparisonExpression """ _validation = { @@ -807,18 +1383,16 @@ class QueryFilter(Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[QueryFilter]'}, 'or_property': {'key': 'or', 'type': '[QueryFilter]'}, - 'not_property': {'key': 'not', 'type': 'QueryFilter'}, - 'dimension': {'key': 'dimension', 'type': 'QueryComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'QueryComparisonExpression'}, + 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, } - def __init__(self, *, and_property=None, or_property=None, not_property=None, dimension=None, tag=None, **kwargs) -> None: + def __init__(self, *, and_property=None, or_property=None, dimensions=None, tags=None, **kwargs) -> None: super(QueryFilter, self).__init__(**kwargs) self.and_property = and_property self.or_property = or_property - self.not_property = not_property - self.dimension = dimension - self.tag = tag + self.dimensions = dimensions + self.tags = tags class QueryGrouping(Model): @@ -864,6 +1438,14 @@ class QueryResult(Resource): :vartype type: str :ivar tags: Resource tags. :vartype tags: dict[str, 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 + :ivar location: Resource location + :vartype location: str + :ivar sku: Resource SKU + :vartype sku: str :param next_link: The link (url) to the next page of results. :type next_link: str :param columns: Array of columns @@ -877,6 +1459,8 @@ class QueryResult(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'tags': {'readonly': True}, + 'location': {'readonly': True}, + 'sku': {'readonly': True}, } _attribute_map = { @@ -884,13 +1468,19 @@ class QueryResult(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, 'columns': {'key': 'properties.columns', 'type': '[QueryColumn]'}, 'rows': {'key': 'properties.rows', 'type': '[[object]]'}, } - def __init__(self, *, next_link: str=None, columns=None, rows=None, **kwargs) -> None: + def __init__(self, *, e_tag: str=None, next_link: str=None, columns=None, rows=None, **kwargs) -> None: super(QueryResult, self).__init__(**kwargs) + self.e_tag = e_tag + self.location = None + self.sku = None self.next_link = next_link self.columns = columns self.rows = rows @@ -921,3 +1511,478 @@ def __init__(self, *, from_property, to, **kwargs) -> None: super(QueryTimePeriod, self).__init__(**kwargs) self.from_property = from_property self.to = to + + +class ReportConfigAggregation(Model): + """The aggregation expression to be used in the report. + + 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. + + :param name: Required. The name of the column to aggregate. + :type name: str + :ivar function: Required. The name of the aggregation function to use. + Default value: "Sum" . + :vartype function: str + """ + + _validation = { + 'name': {'required': True}, + 'function': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function': {'key': 'function', 'type': 'str'}, + } + + function = "Sum" + + def __init__(self, *, name: str, **kwargs) -> None: + super(ReportConfigAggregation, self).__init__(**kwargs) + self.name = name + + +class ReportConfigComparisonExpression(Model): + """The comparison expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to use in comparison. + :type name: str + :param operator: Required. The operator to use for comparison. Possible + values include: 'In', 'Contains' + :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType + :param values: Required. Array of values to use for comparison + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__(self, *, name: str, operator, values, **kwargs) -> None: + super(ReportConfigComparisonExpression, self).__init__(**kwargs) + self.name = name + self.operator = operator + self.values = values + + +class ReportConfigDataset(Model): + """The definition of data present in the report. + + :param granularity: The granularity of rows in the report. Possible values + include: 'Daily', 'Monthly' + :type granularity: str or + ~azure.mgmt.costmanagement.models.ReportGranularityType + :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.costmanagement.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 up to 2 aggregation clauses. + :type aggregation: dict[str, + ~azure.mgmt.costmanagement.models.ReportConfigAggregation] + :param grouping: Array of group by expression to use in the report. Report + can have up to 2 group by clauses. + :type grouping: + list[~azure.mgmt.costmanagement.models.ReportConfigGrouping] + :param sorting: Array of order by expression to use in the report. + :type sorting: list[~azure.mgmt.costmanagement.models.ReportConfigSorting] + :param filter: Has filter expression to use in the report. + :type filter: ~azure.mgmt.costmanagement.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]'}, + 'sorting': {'key': 'sorting', 'type': '[ReportConfigSorting]'}, + 'filter': {'key': 'filter', 'type': 'ReportConfigFilter'}, + } + + def __init__(self, *, granularity=None, configuration=None, aggregation=None, grouping=None, sorting=None, filter=None, **kwargs) -> None: + super(ReportConfigDataset, self).__init__(**kwargs) + self.granularity = granularity + self.configuration = configuration + self.aggregation = aggregation + self.grouping = grouping + self.sorting = sorting + self.filter = filter + + +class ReportConfigDatasetConfiguration(Model): + """The configuration of dataset in the report. + + :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] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__(self, *, columns=None, **kwargs) -> None: + super(ReportConfigDatasetConfiguration, self).__init__(**kwargs) + self.columns = columns + + +class ReportConfigFilter(Model): + """The filter expression to be used in the report. + + :param and_property: The logical "AND" expression. Must have at least 2 + items. + :type and_property: + list[~azure.mgmt.costmanagement.models.ReportConfigFilter] + :param or_property: The logical "OR" expression. Must have at least 2 + items. + :type or_property: + list[~azure.mgmt.costmanagement.models.ReportConfigFilter] + :param dimensions: Has comparison expression for a dimension + :type dimensions: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tags: Has comparison expression for a tag + :type tags: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tag_key: Has comparison expression for a tag key + :type tag_key: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tag_value: Has comparison expression for a tag value + :type tag_value: + ~azure.mgmt.costmanagement.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]'}, + 'dimensions': {'key': 'dimensions', 'type': 'ReportConfigComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'ReportConfigComparisonExpression'}, + 'tag_key': {'key': 'tagKey', 'type': 'ReportConfigComparisonExpression'}, + 'tag_value': {'key': 'tagValue', 'type': 'ReportConfigComparisonExpression'}, + } + + def __init__(self, *, and_property=None, or_property=None, dimensions=None, tags=None, tag_key=None, tag_value=None, **kwargs) -> None: + super(ReportConfigFilter, self).__init__(**kwargs) + self.and_property = and_property + self.or_property = or_property + self.dimensions = dimensions + self.tags = tags + self.tag_key = tag_key + self.tag_value = tag_value + + +class ReportConfigGrouping(Model): + """The group by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Has type of the column to group. Possible values + include: 'Tag', 'Dimension' + :type type: str or + ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :param name: Required. The name of the column to group. This version + supports subscription lowest possible grain. + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, type, name: str, **kwargs) -> None: + super(ReportConfigGrouping, self).__init__(**kwargs) + self.type = type + self.name = name + + +class ReportConfigSorting(Model): + """The order by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param direction: Direction of sort. Possible values include: 'Ascending', + 'Descending' + :type direction: str or ~azure.mgmt.costmanagement.models.enum + :param name: Required. The name of the column to sort. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'direction': {'key': 'direction', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str, direction=None, **kwargs) -> None: + super(ReportConfigSorting, self).__init__(**kwargs) + self.direction = direction + self.name = name + + +class ReportConfigTimePeriod(Model): + """The start and end date for pulling data for the report. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date to pull data from. + :type from_property: datetime + :param to: Required. 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, **kwargs) -> None: + super(ReportConfigTimePeriod, self).__init__(**kwargs) + self.from_property = from_property + self.to = to + + +class Setting(ProxySettingResource): + """State of the myscope setting. + + 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 kind: Resource kind. + :vartype kind: str + :ivar type: Resource type. + :vartype type: str + :param scope: Required. Sets the default scope the current user will see + when they sign into Azure Cost Management in the Azure portal. + :type scope: str + :param start_on: Indicates what scope Cost Management in the Azure portal + should default to. Allowed values: LastUsed. Possible values include: + 'LastUsed', 'ScopePicker', 'SpecificScope' + :type start_on: str or ~azure.mgmt.costmanagement.models.enum + :param cache: + :type cache: list[~azure.mgmt.costmanagement.models.CacheItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'readonly': True, 'max_length': 10}, + 'type': {'readonly': True}, + 'scope': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'start_on': {'key': 'properties.startOn', 'type': 'str'}, + 'cache': {'key': 'properties.cache', 'type': '[CacheItem]'}, + } + + def __init__(self, *, scope: str, start_on=None, cache=None, **kwargs) -> None: + super(Setting, self).__init__(**kwargs) + self.scope = scope + self.start_on = start_on + self.cache = cache + + +class Status(Model): + """The status of the long running operation. + + :param status: The status of the long running operation. Possible values + include: 'Running', 'Completed', 'Failed' + :type status: str or ~azure.mgmt.costmanagement.models.OperationStatusType + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, *, status=None, **kwargs) -> None: + super(Status, self).__init__(**kwargs) + self.status = status + + +class View(ProxyResource): + """States and configurations of Cost Analysis. + + 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 display_name: User input name of the view. Required. + :type display_name: str + :param scope: Cost Management scope to save the view on. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + Management Group scope, + '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for ExternalBillingAccount scope, and + '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for ExternalSubscription scope. + :type scope: str + :ivar created_on: Date the user created this view. + :vartype created_on: datetime + :ivar modified_on: Date when the user last modified this view. + :vartype modified_on: datetime + :ivar date_range: Selected date range for viewing cost in. + :vartype date_range: str + :ivar currency: Selected currency. + :vartype currency: str + :ivar view_type: Required. The type of the report. Usage represents actual + usage, forecast represents forecasted data and UsageAndForecast represents + both usage and forecasted data. Actual usage and forecasted data can be + differentiated based on dates. Default value: "Usage" . + :vartype view_type: str + :param timeframe: Required. 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.costmanagement.models.ReportTimeframeType + :param time_period: Has time period for pulling data for the report. + :type time_period: + ~azure.mgmt.costmanagement.models.ReportConfigTimePeriod + :param data_set: Has definition for data in this report config. + :type data_set: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :ivar include_monetary_commitment: Include monetary commitment + :vartype include_monetary_commitment: bool + :param chart: Chart type of the main view in Cost Analysis. Required. + Possible values include: 'Area', 'Line', 'StackedColumn', 'GroupedColumn', + 'Table' + :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :param accumulated: Show costs accumulated over time. Possible values + include: 'true', 'false' + :type accumulated: str or + ~azure.mgmt.costmanagement.models.AccumulatedType + :param metric: Metric to use when displaying costs. Possible values + include: 'ActualCost', 'AmortizedCost', 'AHUB' + :type metric: str or ~azure.mgmt.costmanagement.models.MetricType + :param kpis: List of KPIs to show in Cost Analysis UI. + :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :param pivots: Configuration of 3 sub-views in the Cost Analysis UI. + :type pivots: list[~azure.mgmt.costmanagement.models.PivotProperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_on': {'readonly': True}, + 'modified_on': {'readonly': True}, + 'date_range': {'readonly': True}, + 'currency': {'readonly': True}, + 'view_type': {'required': True, 'constant': True}, + 'timeframe': {'required': True}, + 'include_monetary_commitment': {'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'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, + 'date_range': {'key': 'properties.dateRange', 'type': 'str'}, + 'currency': {'key': 'properties.currency', 'type': 'str'}, + 'view_type': {'key': 'properties.query.type', 'type': 'str'}, + 'timeframe': {'key': 'properties.query.timeframe', 'type': 'str'}, + 'time_period': {'key': 'properties.query.timePeriod', 'type': 'ReportConfigTimePeriod'}, + 'data_set': {'key': 'properties.query.dataSet', 'type': 'ReportConfigDataset'}, + 'include_monetary_commitment': {'key': 'properties.query.includeMonetaryCommitment', 'type': 'bool'}, + 'chart': {'key': 'properties.chart', 'type': 'str'}, + 'accumulated': {'key': 'properties.accumulated', 'type': 'str'}, + 'metric': {'key': 'properties.metric', 'type': 'str'}, + 'kpis': {'key': 'properties.kpis', 'type': '[KpiProperties]'}, + 'pivots': {'key': 'properties.pivots', 'type': '[PivotProperties]'}, + } + + view_type = "Usage" + + def __init__(self, *, timeframe, e_tag: str=None, display_name: str=None, scope: str=None, time_period=None, data_set=None, chart=None, accumulated=None, metric=None, kpis=None, pivots=None, **kwargs) -> None: + super(View, self).__init__(e_tag=e_tag, **kwargs) + self.display_name = display_name + self.scope = scope + self.created_on = None + self.modified_on = None + self.date_range = None + self.currency = None + self.timeframe = timeframe + self.time_period = time_period + self.data_set = data_set + self.include_monetary_commitment = None + self.chart = chart + self.accumulated = accumulated + self.metric = metric + self.kpis = kpis + self.pivots = pivots diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_paged_models.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_paged_models.py index 7f38fa645767..49c05f499d30 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_paged_models.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_paged_models.py @@ -12,6 +12,32 @@ from msrest.paging import Paged +class SettingPaged(Paged): + """ + A paging container for iterating over a list of :class:`Setting ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Setting]'} + } + + def __init__(self, *args, **kwargs): + + super(SettingPaged, self).__init__(*args, **kwargs) +class ViewPaged(Paged): + """ + A paging container for iterating over a list of :class:`View ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[View]'} + } + + def __init__(self, *args, **kwargs): + + super(ViewPaged, self).__init__(*args, **kwargs) class DimensionPaged(Paged): """ A paging container for iterating over a list of :class:`Dimension ` object diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py index ed3adf92c621..d3cd52b5bcc0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py @@ -9,14 +9,24 @@ # regenerated. # -------------------------------------------------------------------------- +from ._settings_operations import SettingsOperations +from ._views_operations import ViewsOperations +from ._alerts_operations import AlertsOperations +from ._forecast_operations import ForecastOperations from ._dimensions_operations import DimensionsOperations from ._query_operations import QueryOperations -from ._exports_operations import ExportsOperations +from ._generate_reservation_details_report_operations import GenerateReservationDetailsReportOperations from ._operations import Operations +from ._exports_operations import ExportsOperations __all__ = [ + 'SettingsOperations', + 'ViewsOperations', + 'AlertsOperations', + 'ForecastOperations', 'DimensionsOperations', 'QueryOperations', - 'ExportsOperations', + 'GenerateReservationDetailsReportOperations', 'Operations', + 'ExportsOperations', ] diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py new file mode 100644 index 000000000000..1ecdad45dc5c --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py @@ -0,0 +1,338 @@ +# 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 AlertsOperations(object): + """AlertsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :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 2019-11-01. Constant value: "2019-11-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-11-01" + + self.config = config + + def list( + self, scope, custom_headers=None, raw=False, **operation_config): + """Lists the alerts for scope defined. + + :param scope: The scope associated with alerts operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} + for Management Group scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AlertsResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.AlertsResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AlertsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts'} + + def get( + self, scope, alert_id, custom_headers=None, raw=False, **operation_config): + """Gets the alert for the scope by alert ID. + + :param scope: The scope associated with alerts operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} + for Management Group scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param alert_id: Alert ID + :type alert_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: Alert or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.Alert or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'alertId': self._serialize.url("alert_id", alert_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Alert', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}'} + + def dismiss( + self, scope, alert_id, parameters, custom_headers=None, raw=False, **operation_config): + """Dismisses the specified alert. + + :param scope: The scope associated with alerts operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} + for Management Group scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param alert_id: Alert ID + :type alert_id: str + :param parameters: Parameters supplied to the Dismiss Alert operation. + :type parameters: + ~azure.mgmt.costmanagement.models.DismissAlertPayload + :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: Alert or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.Alert or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.dismiss.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'alertId': self._serialize.url("alert_id", alert_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'DismissAlertPayload') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Alert', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + dismiss.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}'} + + def list_external( + self, external_cloud_provider_type, external_cloud_provider_id, custom_headers=None, raw=False, **operation_config): + """Lists the Alerts for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type + associated with dimension/query operations. This includes + 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. Possible values + include: 'externalSubscriptions', 'externalBillingAccounts' + :type external_cloud_provider_type: str or + ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be + '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with + dimension/query operations. + :type external_cloud_provider_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: AlertsResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.AlertsResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_external.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_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['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AlertsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_external.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py index a753fb553a79..d98c8ea56b32 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py @@ -132,7 +132,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 204]: raise models.ErrorResponseException(self._deserialize, response) return response @@ -145,3 +145,105 @@ def internal_paging(next_link=None): return deserialized list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/dimensions'} + + def by_external_cloud_provider_type( + self, external_cloud_provider_type, external_cloud_provider_id, filter=None, expand=None, skiptoken=None, top=None, custom_headers=None, raw=False, **operation_config): + """Lists the dimensions by the external cloud provider type. + + :param external_cloud_provider_type: The external cloud provider type + associated with dimension/query operations. This includes + 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. Possible values + include: 'externalSubscriptions', 'externalBillingAccounts' + :type external_cloud_provider_type: str or + ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be + '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with + dimension/query operations. + :type external_cloud_provider_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 category. 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.costmanagement.models.DimensionPaged[~azure.mgmt.costmanagement.models.Dimension] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.by_external_cloud_provider_type.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_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['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DimensionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py new file mode 100644 index 000000000000..bcb53bc98430 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py @@ -0,0 +1,207 @@ +# 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 ForecastOperations(object): + """ForecastOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :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 2019-11-01. Constant value: "2019-11-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-11-01" + + self.config = config + + def usage( + self, scope, parameters, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the forecast charges for scope defined. + + :param scope: The scope associated with forecast operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} + for Management Group scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param parameters: Parameters supplied to the CreateOrUpdate Forecast + Config operation. + :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition + :param filter: May be used to filter forecasts by properties/usageDate + (Utc time), properties/chargeType or properties/grain. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. + :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: QueryResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.QueryResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.usage.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ForecastDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/forecast'} + + def external_cloud_provider_usage( + self, external_cloud_provider_type, external_cloud_provider_id, parameters, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the forecast charges for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type + associated with dimension/query operations. This includes + 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. Possible values + include: 'externalSubscriptions', 'externalBillingAccounts' + :type external_cloud_provider_type: str or + ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be + '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with + dimension/query operations. + :type external_cloud_provider_id: str + :param parameters: Parameters supplied to the CreateOrUpdate Forecast + Config operation. + :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition + :param filter: May be used to filter forecasts by properties/usageDate + (Utc time), properties/chargeType or properties/grain. The filter + supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + currently support 'ne', 'or', or 'not'. + :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: QueryResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.QueryResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.external_cloud_provider_usage.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ForecastDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + external_cloud_provider_usage.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py new file mode 100644 index 000000000000..5ecda6173a5e --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py @@ -0,0 +1,259 @@ +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class GenerateReservationDetailsReportOperations(object): + """GenerateReservationDetailsReportOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :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 2019-11-01. Constant value: "2019-11-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-11-01" + + self.config = config + + + def _by_billing_account_id_initial( + self, billing_account_id, start_date, end_date, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.by_billing_account_id.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['startDate'] = self._serialize.query("start_date", start_date, 'str') + query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def by_billing_account_id( + self, billing_account_id, start_date, end_date, custom_headers=None, raw=False, polling=True, **operation_config): + """Generates the reservations details report for provided date range + asynchronously based on enrollment id. + + :param billing_account_id: Enrollment ID (Legacy BillingAccount ID) + :type billing_account_id: str + :param start_date: Start Date + :type start_date: str + :param end_date: End Date + :type end_date: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns OperationStatus or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.costmanagement.models.OperationStatus] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.costmanagement.models.OperationStatus]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._by_billing_account_id_initial( + billing_account_id=billing_account_id, + start_date=start_date, + end_date=end_date, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + deserialized = self._deserialize('OperationStatus', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + by_billing_account_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} + + + def _by_billing_profile_id_initial( + self, billing_account_id, billing_profile_id, start_date, end_date, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.by_billing_profile_id.metadata['url'] + path_format_arguments = { + 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), + 'billingProfileId': self._serialize.url("billing_profile_id", billing_profile_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['startDate'] = self._serialize.query("start_date", start_date, 'str') + query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def by_billing_profile_id( + self, billing_account_id, billing_profile_id, start_date, end_date, custom_headers=None, raw=False, polling=True, **operation_config): + """Generates the reservations details report for provided date range + asynchronously by billing profile. + + :param billing_account_id: BillingAccount ID + :type billing_account_id: str + :param billing_profile_id: BillingProfile ID + :type billing_profile_id: str + :param start_date: Start Date + :type start_date: str + :param end_date: End Date + :type end_date: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns OperationStatus or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.costmanagement.models.OperationStatus] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.costmanagement.models.OperationStatus]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._by_billing_profile_id_initial( + billing_account_id=billing_account_id, + billing_profile_id=billing_profile_id, + start_date=start_date, + end_date=end_date, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'int', + } + deserialized = self._deserialize('OperationStatus', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + by_billing_profile_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py index 00191d7f0ddf..89d42b11f297 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py @@ -105,7 +105,7 @@ def usage( request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 204]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None @@ -118,3 +118,77 @@ def usage( return deserialized usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/query'} + + def usage_by_external_cloud_provider_type( + self, external_cloud_provider_type, external_cloud_provider_id, parameters, custom_headers=None, raw=False, **operation_config): + """Query the usage data for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type + associated with dimension/query operations. This includes + 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. Possible values + include: 'externalSubscriptions', 'externalBillingAccounts' + :type external_cloud_provider_type: str or + ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be + '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with + dimension/query operations. + :type external_cloud_provider_id: str + :param parameters: Parameters supplied to the CreateOrUpdate Query + Config operation. + :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition + :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: QueryResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.QueryResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.usage_by_external_cloud_provider_type.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_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['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'QueryDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + usage_by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_settings_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_settings_operations.py new file mode 100644 index 000000000000..ef446a472d83 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_settings_operations.py @@ -0,0 +1,268 @@ +# 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 SettingsOperations(object): + """SettingsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :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 2019-11-01. Constant value: "2019-11-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-11-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the settings that have been customized. + + :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 Setting + :rtype: + ~azure.mgmt.costmanagement.models.SettingPaged[~azure.mgmt.costmanagement.models.Setting] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SettingPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.CostManagement/settings'} + + def get( + self, setting_name, custom_headers=None, raw=False, **operation_config): + """Retrieves the current value for a specific setting. + + :param setting_name: Name of the setting. Allowed values: myscope + :type setting_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: Setting or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.Setting or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Setting', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} + + def create_or_update( + self, setting_name, parameters, custom_headers=None, raw=False, **operation_config): + """Sets a new value for a specific setting. + + :param setting_name: Name of the setting. Allowed values: myscope + :type setting_name: str + :param parameters: Body supplied to the CreateOrUpdate setting + operation. + :type parameters: ~azure.mgmt.costmanagement.models.Setting + :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: Setting or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.Setting or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Setting') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Setting', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} + + def delete( + self, setting_name, custom_headers=None, raw=False, **operation_config): + """Remove the current value for a specific setting and reverts back to the + default value, if applicable. + + :param setting_name: Name of the setting. Allowed values: myscope + :type setting_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py new file mode 100644 index 000000000000..13aecf161532 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py @@ -0,0 +1,594 @@ +# 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 ViewsOperations(object): + """ViewsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :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 2019-11-01. Constant value: "2019-11-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-11-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all views by tenant and object. + + :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 View + :rtype: + ~azure.mgmt.costmanagement.models.ViewPaged[~azure.mgmt.costmanagement.models.View] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ViewPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.CostManagement/views'} + + def list_by_scope( + self, scope, custom_headers=None, raw=False, **operation_config): + """Lists all views at the given scope. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for External Subscription scope. + :type scope: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of View + :rtype: + ~azure.mgmt.costmanagement.models.ViewPaged[~azure.mgmt.costmanagement.models.View] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ViewPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views'} + + def get( + self, view_name, custom_headers=None, raw=False, **operation_config): + """Gets the view by view name. + + :param view_name: View name + :type view_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: View or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.View or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + + def create_or_update( + self, view_name, parameters, custom_headers=None, raw=False, **operation_config): + """The operation to create or update a view. Update operation requires + latest eTag to be set in the request. You may obtain the latest eTag by + performing a get operation. Create operation does not require eTag. + + :param view_name: View name + :type view_name: str + :param parameters: Parameters supplied to the CreateOrUpdate View + operation. + :type parameters: ~azure.mgmt.costmanagement.models.View + :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: View or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.View or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'View') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', response) + if response.status_code == 201: + deserialized = self._deserialize('View', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + + def delete( + self, view_name, custom_headers=None, raw=False, **operation_config): + """The operation to delete a view. + + :param view_name: View name + :type view_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + + def get_by_scope( + self, scope, view_name, custom_headers=None, raw=False, **operation_config): + """Gets the view for the defined scope by view name. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for External Subscription scope. + :type scope: str + :param view_name: View name + :type view_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: View or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.View or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + + def create_or_update_by_scope( + self, scope, view_name, parameters, custom_headers=None, raw=False, **operation_config): + """The operation to create or update a view. Update operation requires + latest eTag to be set in the request. You may obtain the latest eTag by + performing a get operation. Create operation does not require eTag. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for External Subscription scope. + :type scope: str + :param view_name: View name + :type view_name: str + :param parameters: Parameters supplied to the CreateOrUpdate View + operation. + :type parameters: ~azure.mgmt.costmanagement.models.View + :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: View or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.View or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'View') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', response) + if response.status_code == 201: + deserialized = self._deserialize('View', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + + def delete_by_scope( + self, scope, view_name, custom_headers=None, raw=False, **operation_config): + """The operation to delete a view. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for External Subscription scope. + :type scope: str + :param view_name: View name + :type view_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'}