From e810e7e21789d06a10e833de7b5e922cfbe61f1f Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 15 May 2020 02:57:37 +0000 Subject: [PATCH] Generated from d422c30312f83b5bc7b90dedd9a4bb256b4d357b remove useless file --- .../azure-mgmt-costmanagement/README.md | 30 +- .../costmanagement/_cost_management_client.py | 15 + .../mgmt/costmanagement/models/__init__.py | 85 +- .../models/_cost_management_client_enums.py | 87 +- .../mgmt/costmanagement/models/_models.py | 804 ++++++++++++++++- .../mgmt/costmanagement/models/_models_py3.py | 806 +++++++++++++++++- .../costmanagement/models/_paged_models.py | 13 + .../costmanagement/operations/__init__.py | 6 + .../operations/_alerts_operations.py | 179 ++++ .../operations/_dimensions_operations.py | 102 +++ .../operations/_forecast_operations.py | 207 +++++ .../operations/_query_operations.py | 74 ++ .../operations/_views_operations.py | 594 +++++++++++++ .../azure-mgmt-costmanagement/setup.py | 6 +- 14 files changed, 2912 insertions(+), 96 deletions(-) create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/README.md b/sdk/costmanagement/azure-mgmt-costmanagement/README.md index 8e49cdc26b15..30a17695c7c3 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/README.md +++ b/sdk/costmanagement/azure-mgmt-costmanagement/README.md @@ -1,29 +1,21 @@ -## Microsoft Azure SDK for Python +# Microsoft Azure SDK for Python This is the Microsoft Azure Cost Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/) -Azure Resource Manager (ARM) is the next generation of management APIs -that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. +# Usage -For the older Azure Service Management (ASM) libraries, see -[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy) -library. +For code examples, see [Cost Management](https://docs.microsoft.com/python/api/overview/azure/) +on docs.microsoft.com. -For a more complete set of Azure libraries, see the -[azure](https://pypi.python.org/pypi/azure) bundle package. -## Usage +# Provide Feedback -For code examples, see [Cost -Management](https://docs.microsoft.com/python/api/overview/azure/) on -docs.microsoft.com. - -## Provide Feedback - -If you encounter any bugs or have suggestions, please file an issue in -the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. -![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-costmanagement%2FREADME.png) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-costmanagement%2FREADME.png) 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..1d2dec49cac7 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,6 +13,9 @@ from msrest import Serializer, Deserializer from ._configuration import CostManagementClientConfiguration +from .operations import ViewsOperations +from .operations import AlertsOperations +from .operations import ForecastOperations from .operations import DimensionsOperations from .operations import QueryOperations from .operations import ExportsOperations @@ -26,6 +29,12 @@ class CostManagementClient(SDKClient): :ivar config: Configuration for client. :vartype config: CostManagementClientConfiguration + :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 @@ -54,6 +63,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + 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( 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..f86c1733e3e1 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,6 +10,10 @@ # -------------------------------------------------------------------------- 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 CommonExportProperties from ._models_py3 import Dimension from ._models_py3 import ErrorDetails @@ -22,8 +26,12 @@ 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 PivotProperties + from ._models_py3 import ProxyResource from ._models_py3 import QueryAggregation from ._models_py3 import QueryColumn from ._models_py3 import QueryComparisonExpression @@ -34,8 +42,21 @@ 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 View except (SyntaxError, ImportError): + from ._models import Alert + from ._models import AlertPropertiesDefinition + from ._models import AlertPropertiesDetails + from ._models import AlertsResult from ._models import CommonExportProperties from ._models import Dimension from ._models import ErrorDetails @@ -48,8 +69,12 @@ 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 PivotProperties + from ._models import ProxyResource from ._models import QueryAggregation from ._models import QueryColumn from ._models import QueryComparisonExpression @@ -60,22 +85,48 @@ 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 View from ._paged_models import DimensionPaged from ._paged_models import OperationPaged +from ._paged_models import ViewPaged from ._cost_management_client_enums import ( - ExportType, - TimeframeType, + ReportTimeframeType, + ReportGranularityType, + ReportConfigColumnType, + OperatorType, + ChartType, + AccumulatedType, + MetricType, + KpiTypeType, + PivotTypeType, + ForecastType, + ForecastTimeframeType, GranularityType, QueryColumnType, + ExportType, + TimeframeType, StatusType, RecurrenceType, FormatType, ExecutionType, ExecutionStatus, + ExternalCloudProviderType, ) __all__ = [ + 'Alert', + 'AlertPropertiesDefinition', + 'AlertPropertiesDetails', + 'AlertsResult', 'CommonExportProperties', 'Dimension', 'ErrorDetails', @@ -88,8 +139,12 @@ 'ExportListResult', 'ExportRecurrencePeriod', 'ExportSchedule', + 'ForecastDefinition', + 'KpiProperties', 'Operation', 'OperationDisplay', + 'PivotProperties', + 'ProxyResource', 'QueryAggregation', 'QueryColumn', 'QueryComparisonExpression', @@ -100,16 +155,38 @@ 'QueryGrouping', 'QueryResult', 'QueryTimePeriod', + 'ReportConfigAggregation', + 'ReportConfigComparisonExpression', + 'ReportConfigDataset', + 'ReportConfigDatasetConfiguration', + 'ReportConfigFilter', + 'ReportConfigGrouping', + 'ReportConfigSorting', + 'ReportConfigTimePeriod', 'Resource', + 'View', + 'ViewPaged', 'DimensionPaged', 'OperationPaged', - 'ExportType', - 'TimeframeType', + 'ReportTimeframeType', + 'ReportGranularityType', + 'ReportConfigColumnType', + 'OperatorType', + 'ChartType', + 'AccumulatedType', + 'MetricType', + 'KpiTypeType', + 'PivotTypeType', + 'ForecastType', + 'ForecastTimeframeType', 'GranularityType', 'QueryColumnType', + 'ExportType', + 'TimeframeType', '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..e5d695939d15 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,74 @@ 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 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 +100,23 @@ 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 StatusType(str, Enum): active = "Active" @@ -74,3 +151,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..276ae1b830fa 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,30 @@ 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 + :type source: str + :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 + :type status: str + :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 +103,202 @@ 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 + :type type: str + :param category: Alert category + :type category: str + :param criteria: Criteria that triggered alert + :type criteria: str + """ + + _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 + :type time_grain_type: str + :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 + :type operator: str + :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 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.QueryDefinition + """ + + _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': 'QueryDefinition'}, + } + + 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): @@ -200,6 +410,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 @@ -529,6 +745,81 @@ def __init__(self, **kwargs): self.recurrence_period = kwargs.get('recurrence_period', None) +class ForecastDefinition(Model): + """The definition of a forecast. + + All required parameters must be populated in order to send to Azure. + + :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 = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + '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(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. @@ -590,6 +881,66 @@ def __init__(self, **kwargs): self.operation = 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 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 QueryAggregation(Model): """The aggregation expression to be used in the query. @@ -921,3 +1272,388 @@ 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 not_property: The logical "NOT" expression. + :type not_property: ~azure.mgmt.costmanagement.models.ReportConfigFilter + :param dimension: Has comparison expression for a dimension + :type dimension: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tag: Has comparison expression for a tag + :type tag: + ~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]'}, + 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, + 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, + 'tag': {'key': 'tag', '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.not_property = kwargs.get('not_property', None) + self.dimension = kwargs.get('dimension', None) + self.tag = kwargs.get('tag', 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 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 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 dataset: Has definition for data in this report config. + :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :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}, + 'view_type': {'required': True, 'constant': True}, + 'timeframe': {'required': 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'}, + 'view_type': {'key': 'properties.query.type', 'type': 'str'}, + 'timeframe': {'key': 'properties.query.timeframe', 'type': 'str'}, + 'time_period': {'key': 'properties.query.timePeriod', 'type': 'ReportConfigTimePeriod'}, + 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, + '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.timeframe = kwargs.get('timeframe', None) + self.time_period = kwargs.get('time_period', None) + self.dataset = kwargs.get('dataset', 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..520cac7db637 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,30 @@ 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 + :type source: str + :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 + :type status: str + :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 +103,202 @@ 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: str=None, details=None, cost_entity_id: str=None, status: str=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 + :type type: str + :param category: Alert category + :type category: str + :param criteria: Criteria that triggered alert + :type criteria: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'str'}, + } + + def __init__(self, *, type: str=None, category: str=None, criteria: str=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 + :type time_grain_type: str + :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 + :type operator: str + :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: str=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: str=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 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.QueryDefinition + """ + + _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': 'QueryDefinition'}, + } + + 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): @@ -200,6 +410,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 @@ -529,6 +745,81 @@ def __init__(self, *, recurrence, status=None, recurrence_period=None, **kwargs) self.recurrence_period = recurrence_period +class ForecastDefinition(Model): + """The definition of a forecast. + + All required parameters must be populated in order to send to Azure. + + :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 = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + '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, *, 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. @@ -590,6 +881,66 @@ def __init__(self, **kwargs) -> None: self.operation = 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, *, type=None, name: str=None, **kwargs) -> None: + super(PivotProperties, self).__init__(**kwargs) + self.type = type + self.name = name + + +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 QueryAggregation(Model): """The aggregation expression to be used in the query. @@ -921,3 +1272,388 @@ 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 not_property: The logical "NOT" expression. + :type not_property: ~azure.mgmt.costmanagement.models.ReportConfigFilter + :param dimension: Has comparison expression for a dimension + :type dimension: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tag: Has comparison expression for a tag + :type tag: + ~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]'}, + 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, + 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, + 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, + } + + def __init__(self, *, and_property=None, or_property=None, not_property=None, dimension=None, tag=None, **kwargs) -> None: + super(ReportConfigFilter, self).__init__(**kwargs) + self.and_property = and_property + self.or_property = or_property + self.not_property = not_property + self.dimension = dimension + self.tag = tag + + +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 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 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 dataset: Has definition for data in this report config. + :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :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}, + 'view_type': {'required': True, 'constant': True}, + 'timeframe': {'required': 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'}, + 'view_type': {'key': 'properties.query.type', 'type': 'str'}, + 'timeframe': {'key': 'properties.query.timeframe', 'type': 'str'}, + 'time_period': {'key': 'properties.query.timePeriod', 'type': 'ReportConfigTimePeriod'}, + 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, + '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, dataset=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.timeframe = timeframe + self.time_period = time_period + self.dataset = dataset + 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..66bd6b250254 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,19 @@ from msrest.paging import Paged +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..180f43116a24 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,12 +9,18 @@ # regenerated. # -------------------------------------------------------------------------- +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 ._operations import Operations __all__ = [ + 'ViewsOperations', + 'AlertsOperations', + 'ForecastOperations', 'DimensionsOperations', 'QueryOperations', '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..28fe899dc9de --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py @@ -0,0 +1,179 @@ +# 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 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..9d4082c233b1 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 @@ -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..3f081e994d18 --- /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]: + 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/_query_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py index 00191d7f0ddf..4ce6b965f53f 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 @@ -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/_views_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py new file mode 100644 index 000000000000..30e75b5ba1c6 --- /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]: + 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]: + 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}'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/setup.py b/sdk/costmanagement/azure-mgmt-costmanagement/setup.py index 2f95b055a0cb..e853a3e11b21 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/setup.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -64,10 +66,10 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'License :: OSI Approved :: MIT License', ], zip_safe=False,