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 1d2dec49cac7..84a9269af785 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 @@ -59,7 +59,7 @@ def __init__( super(CostManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2019-11-01' + self.api_version = '2020-06-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) 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 0b74a203e817..a6a27b6e622e 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 @@ -20,6 +20,9 @@ from ._models_py3 import ErrorDetails from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import Export + from ._models_py3 import ExportDataset + from ._models_py3 import ExportDatasetConfiguration + from ._models_py3 import ExportDefinition from ._models_py3 import ExportDeliveryDestination from ._models_py3 import ExportDeliveryInfo from ._models_py3 import ExportExecution @@ -27,6 +30,7 @@ from ._models_py3 import ExportListResult from ._models_py3 import ExportRecurrencePeriod from ._models_py3 import ExportSchedule + from ._models_py3 import ExportTimePeriod from ._models_py3 import ForecastDefinition from ._models_py3 import KpiProperties from ._models_py3 import Operation @@ -64,6 +68,9 @@ from ._models import ErrorDetails from ._models import ErrorResponse, ErrorResponseException from ._models import Export + from ._models import ExportDataset + from ._models import ExportDatasetConfiguration + from ._models import ExportDefinition from ._models import ExportDeliveryDestination from ._models import ExportDeliveryInfo from ._models import ExportExecution @@ -71,6 +78,7 @@ from ._models import ExportListResult from ._models import ExportRecurrencePeriod from ._models import ExportSchedule + from ._models import ExportTimePeriod from ._models import ForecastDefinition from ._models import KpiProperties from ._models import Operation @@ -142,6 +150,9 @@ 'ErrorDetails', 'ErrorResponse', 'ErrorResponseException', 'Export', + 'ExportDataset', + 'ExportDatasetConfiguration', + 'ExportDefinition', 'ExportDeliveryDestination', 'ExportDeliveryInfo', 'ExportExecution', @@ -149,6 +160,7 @@ 'ExportListResult', 'ExportRecurrencePeriod', 'ExportSchedule', + 'ExportTimePeriod', 'ForecastDefinition', 'KpiProperties', 'Operation', 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 f1a51f08a78e..14f192f7d951 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 @@ -287,26 +287,39 @@ class CloudError(Model): class CommonExportProperties(Model): """The common properties of the export. + 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 format: The format of the export being delivered. Possible values - include: 'Csv' + :param format: The format of the export being delivered. Currently only + 'Csv' is supported. 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 + :param definition: Required. Has the definition for the export. + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition + :param run_history: If requested, has the most recent execution history + for the export. + :type run_history: + ~azure.mgmt.costmanagement.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, + provides an estimate of the next execution time. + :vartype next_run_time_estimate: datetime """ _validation = { 'delivery_info': {'required': True}, 'definition': {'required': True}, + 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'definition', 'type': 'QueryDefinition'}, + 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, + 'run_history': {'key': 'runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, } def __init__(self, **kwargs): @@ -314,6 +327,8 @@ def __init__(self, **kwargs): self.format = kwargs.get('format', None) self.delivery_info = kwargs.get('delivery_info', None) self.definition = kwargs.get('definition', None) + self.run_history = kwargs.get('run_history', None) + self.next_run_time_estimate = None class Dimension(Resource): @@ -516,8 +531,47 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) -class Export(Resource): - """A export resource. +class ProxyResource(Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.e_tag = kwargs.get('e_tag', None) + + +class Export(ProxyResource): + """An export resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -530,15 +584,24 @@ class Export(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :param format: The format of the export being delivered. Possible values - include: 'Csv' + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + :param format: The format of the export being delivered. Currently only + 'Csv' is supported. 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 + :param definition: Required. Has the definition for the export. + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition + :param run_history: If requested, has the most recent execution history + for the export. + :type run_history: + ~azure.mgmt.costmanagement.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, + provides an estimate of the next execution time. + :vartype next_run_time_estimate: datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -547,19 +610,21 @@ class Export(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, 'delivery_info': {'required': True}, 'definition': {'required': True}, + 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, 'format': {'key': 'properties.format', 'type': 'str'}, 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'properties.definition', 'type': 'QueryDefinition'}, + 'definition': {'key': 'properties.definition', 'type': 'ExportDefinition'}, + 'run_history': {'key': 'properties.runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'properties.nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, } @@ -568,9 +633,94 @@ def __init__(self, **kwargs): self.format = kwargs.get('format', None) self.delivery_info = kwargs.get('delivery_info', None) self.definition = kwargs.get('definition', None) + self.run_history = kwargs.get('run_history', None) + self.next_run_time_estimate = None self.schedule = kwargs.get('schedule', None) +class ExportDataset(Model): + """The definition for data in the export. + + :param granularity: The granularity of rows in the export. Currently only + 'Daily' is supported. Possible values include: 'Daily' + :type granularity: str or + ~azure.mgmt.costmanagement.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: + ~azure.mgmt.costmanagement.models.ExportDatasetConfiguration + """ + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'ExportDatasetConfiguration'}, + } + + def __init__(self, **kwargs): + super(ExportDataset, self).__init__(**kwargs) + self.granularity = kwargs.get('granularity', None) + self.configuration = kwargs.get('configuration', None) + + +class ExportDatasetConfiguration(Model): + """The export dataset configuration. Allows columns to be selected for the + export. If not provided then the export will include all available columns. + + :param columns: Array of column names to be included in the export. If not + provided then the export will include all available columns. The available + columns can vary by customer channel (see examples). + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(ExportDatasetConfiguration, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + + +class ExportDefinition(Model): + """The definition of an export. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of the export. Note that 'Usage' is + equivalent to 'ActualCost' and is applicable to exports that do not yet + provide data for charges or amortization for service reservations. + Possible values include: 'Usage', 'ActualCost', 'AmortizedCost' + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: Required. The time frame for pulling data for the + export. If custom, then a specific time period must be provided. Possible + values include: 'MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom' + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~azure.mgmt.costmanagement.models.ExportTimePeriod + :param data_set: The definition for data in the export. + :type data_set: ~azure.mgmt.costmanagement.models.ExportDataset + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'ExportTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'ExportDataset'}, + } + + def __init__(self, **kwargs): + super(ExportDefinition, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.timeframe = kwargs.get('timeframe', None) + self.time_period = kwargs.get('time_period', None) + self.data_set = kwargs.get('data_set', None) + + class ExportDeliveryDestination(Model): """The destination information for the delivery of the export. To allow access to a storage account, you must register the account's subscription with the @@ -637,7 +787,7 @@ def __init__(self, **kwargs): class ExportExecution(Resource): - """A export execution. + """An export execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -654,26 +804,29 @@ class ExportExecution(Resource): include: 'OnDemand', 'Scheduled' :type execution_type: str or ~azure.mgmt.costmanagement.models.ExecutionType - :param status: The status of the export execution. Possible values - include: 'Queued', 'InProgress', 'Completed', 'Failed', 'Timeout', + :param status: The last known status of the export execution. Possible + values include: 'Queued', 'InProgress', 'Completed', 'Failed', 'Timeout', 'NewDataNotAvailable', 'DataNotAvailable' :type status: str or ~azure.mgmt.costmanagement.models.ExecutionStatus :param submitted_by: The identifier for the entity that executed the - export. For OnDemand executions, it is the email id. For Scheduled - executions, it is the constant value - System. + export. For OnDemand executions it is the user email. For scheduled + executions it is 'System'. :type submitted_by: str :param submitted_time: The time when export was queued to be executed. :type submitted_time: datetime :param processing_start_time: The time when export was picked up to be executed. :type processing_start_time: datetime - :param processing_end_time: The time when export execution finished. + :param processing_end_time: The time when the export execution finished. :type processing_end_time: datetime - :param file_name: The name of the file export got written to. + :param file_name: The name of the exported file. :type file_name: str - :param run_settings: + :param run_settings: The export settings that were in effect for this + execution. :type run_settings: ~azure.mgmt.costmanagement.models.CommonExportProperties + :param error: The details of any error. + :type error: ~azure.mgmt.costmanagement.models.ErrorDetails """ _validation = { @@ -696,6 +849,7 @@ class ExportExecution(Resource): 'processing_end_time': {'key': 'properties.processingEndTime', 'type': 'iso-8601'}, 'file_name': {'key': 'properties.fileName', 'type': 'str'}, 'run_settings': {'key': 'properties.runSettings', 'type': 'CommonExportProperties'}, + 'error': {'key': 'properties.error', 'type': 'ErrorDetails'}, } def __init__(self, **kwargs): @@ -708,15 +862,16 @@ def __init__(self, **kwargs): self.processing_end_time = kwargs.get('processing_end_time', None) self.file_name = kwargs.get('file_name', None) self.run_settings = kwargs.get('run_settings', None) + self.error = kwargs.get('error', None) class ExportExecutionListResult(Model): - """Result of listing exports execution history of a export by name. + """Result of listing the execution history of an export. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of export executions. + :ivar value: A list of export executions. :vartype value: list[~azure.mgmt.costmanagement.models.ExportExecution] """ @@ -784,13 +939,12 @@ def __init__(self, **kwargs): class ExportSchedule(Model): - """The schedule associated with a export. + """The schedule associated with the export. All required parameters must be populated in order to send to Azure. - :param status: The status of the schedule. Whether active or not. If - inactive, the export's scheduled execution is paused. Possible values - include: 'Active', 'Inactive' + :param status: The status of the export's schedule. If 'Inactive', the + export's schedule is paused. Possible values include: 'Active', 'Inactive' :type status: str or ~azure.mgmt.costmanagement.models.StatusType :param recurrence: Required. The schedule recurrence. Possible values include: 'Daily', 'Weekly', 'Monthly', 'Annually' @@ -819,6 +973,34 @@ def __init__(self, **kwargs): self.recurrence_period = kwargs.get('recurrence_period', None) +class ExportTimePeriod(Model): + """The date range for data in the export. This should only be specified with + timeFrame set to 'Custom'. The maximum date range is 3 months. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date for export data. + :type from_property: datetime + :param to: Required. The end date for export data. + :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(ExportTimePeriod, self).__init__(**kwargs) + self.from_property = kwargs.get('from_property', None) + self.to = kwargs.get('to', None) + + class ForecastDefinition(Model): """The definition of a forecast. @@ -976,45 +1158,6 @@ def __init__(self, **kwargs): 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. 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 cdb6ffb673b8..17bbedcb4059 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 @@ -287,33 +287,48 @@ class CloudError(Model): class CommonExportProperties(Model): """The common properties of the export. + 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 format: The format of the export being delivered. Possible values - include: 'Csv' + :param format: The format of the export being delivered. Currently only + 'Csv' is supported. 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 + :param definition: Required. Has the definition for the export. + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition + :param run_history: If requested, has the most recent execution history + for the export. + :type run_history: + ~azure.mgmt.costmanagement.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, + provides an estimate of the next execution time. + :vartype next_run_time_estimate: datetime """ _validation = { 'delivery_info': {'required': True}, 'definition': {'required': True}, + 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'definition', 'type': 'QueryDefinition'}, + 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, + 'run_history': {'key': 'runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, } - def __init__(self, *, delivery_info, definition, format=None, **kwargs) -> None: + def __init__(self, *, delivery_info, definition, format=None, run_history=None, **kwargs) -> None: super(CommonExportProperties, self).__init__(**kwargs) self.format = format self.delivery_info = delivery_info self.definition = definition + self.run_history = run_history + self.next_run_time_estimate = None class Dimension(Resource): @@ -516,8 +531,47 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) -class Export(Resource): - """A export resource. +class ProxyResource(Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + } + + def __init__(self, *, e_tag: str=None, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.e_tag = e_tag + + +class Export(ProxyResource): + """An export resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -530,15 +584,24 @@ class Export(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :param format: The format of the export being delivered. Possible values - include: 'Csv' + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + :param format: The format of the export being delivered. Currently only + 'Csv' is supported. 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 + :param definition: Required. Has the definition for the export. + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition + :param run_history: If requested, has the most recent execution history + for the export. + :type run_history: + ~azure.mgmt.costmanagement.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, + provides an estimate of the next execution time. + :vartype next_run_time_estimate: datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -547,30 +610,117 @@ class Export(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, 'delivery_info': {'required': True}, 'definition': {'required': True}, + 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, 'format': {'key': 'properties.format', 'type': 'str'}, 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'properties.definition', 'type': 'QueryDefinition'}, + 'definition': {'key': 'properties.definition', 'type': 'ExportDefinition'}, + 'run_history': {'key': 'properties.runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'properties.nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, } - def __init__(self, *, delivery_info, definition, format=None, schedule=None, **kwargs) -> None: - super(Export, self).__init__(**kwargs) + def __init__(self, *, delivery_info, definition, e_tag: str=None, format=None, run_history=None, schedule=None, **kwargs) -> None: + super(Export, self).__init__(e_tag=e_tag, **kwargs) self.format = format self.delivery_info = delivery_info self.definition = definition + self.run_history = run_history + self.next_run_time_estimate = None self.schedule = schedule +class ExportDataset(Model): + """The definition for data in the export. + + :param granularity: The granularity of rows in the export. Currently only + 'Daily' is supported. Possible values include: 'Daily' + :type granularity: str or + ~azure.mgmt.costmanagement.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: + ~azure.mgmt.costmanagement.models.ExportDatasetConfiguration + """ + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'ExportDatasetConfiguration'}, + } + + def __init__(self, *, granularity=None, configuration=None, **kwargs) -> None: + super(ExportDataset, self).__init__(**kwargs) + self.granularity = granularity + self.configuration = configuration + + +class ExportDatasetConfiguration(Model): + """The export dataset configuration. Allows columns to be selected for the + export. If not provided then the export will include all available columns. + + :param columns: Array of column names to be included in the export. If not + provided then the export will include all available columns. The available + columns can vary by customer channel (see examples). + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__(self, *, columns=None, **kwargs) -> None: + super(ExportDatasetConfiguration, self).__init__(**kwargs) + self.columns = columns + + +class ExportDefinition(Model): + """The definition of an export. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of the export. Note that 'Usage' is + equivalent to 'ActualCost' and is applicable to exports that do not yet + provide data for charges or amortization for service reservations. + Possible values include: 'Usage', 'ActualCost', 'AmortizedCost' + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: Required. The time frame for pulling data for the + export. If custom, then a specific time period must be provided. Possible + values include: 'MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom' + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~azure.mgmt.costmanagement.models.ExportTimePeriod + :param data_set: The definition for data in the export. + :type data_set: ~azure.mgmt.costmanagement.models.ExportDataset + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'ExportTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'ExportDataset'}, + } + + def __init__(self, *, type, timeframe, time_period=None, data_set=None, **kwargs) -> None: + super(ExportDefinition, self).__init__(**kwargs) + self.type = type + self.timeframe = timeframe + self.time_period = time_period + self.data_set = data_set + + class ExportDeliveryDestination(Model): """The destination information for the delivery of the export. To allow access to a storage account, you must register the account's subscription with the @@ -637,7 +787,7 @@ def __init__(self, *, destination, **kwargs) -> None: class ExportExecution(Resource): - """A export execution. + """An export execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -654,26 +804,29 @@ class ExportExecution(Resource): include: 'OnDemand', 'Scheduled' :type execution_type: str or ~azure.mgmt.costmanagement.models.ExecutionType - :param status: The status of the export execution. Possible values - include: 'Queued', 'InProgress', 'Completed', 'Failed', 'Timeout', + :param status: The last known status of the export execution. Possible + values include: 'Queued', 'InProgress', 'Completed', 'Failed', 'Timeout', 'NewDataNotAvailable', 'DataNotAvailable' :type status: str or ~azure.mgmt.costmanagement.models.ExecutionStatus :param submitted_by: The identifier for the entity that executed the - export. For OnDemand executions, it is the email id. For Scheduled - executions, it is the constant value - System. + export. For OnDemand executions it is the user email. For scheduled + executions it is 'System'. :type submitted_by: str :param submitted_time: The time when export was queued to be executed. :type submitted_time: datetime :param processing_start_time: The time when export was picked up to be executed. :type processing_start_time: datetime - :param processing_end_time: The time when export execution finished. + :param processing_end_time: The time when the export execution finished. :type processing_end_time: datetime - :param file_name: The name of the file export got written to. + :param file_name: The name of the exported file. :type file_name: str - :param run_settings: + :param run_settings: The export settings that were in effect for this + execution. :type run_settings: ~azure.mgmt.costmanagement.models.CommonExportProperties + :param error: The details of any error. + :type error: ~azure.mgmt.costmanagement.models.ErrorDetails """ _validation = { @@ -696,9 +849,10 @@ class ExportExecution(Resource): 'processing_end_time': {'key': 'properties.processingEndTime', 'type': 'iso-8601'}, 'file_name': {'key': 'properties.fileName', 'type': 'str'}, 'run_settings': {'key': 'properties.runSettings', 'type': 'CommonExportProperties'}, + 'error': {'key': 'properties.error', 'type': 'ErrorDetails'}, } - def __init__(self, *, execution_type=None, status=None, submitted_by: str=None, submitted_time=None, processing_start_time=None, processing_end_time=None, file_name: str=None, run_settings=None, **kwargs) -> None: + def __init__(self, *, execution_type=None, status=None, submitted_by: str=None, submitted_time=None, processing_start_time=None, processing_end_time=None, file_name: str=None, run_settings=None, error=None, **kwargs) -> None: super(ExportExecution, self).__init__(**kwargs) self.execution_type = execution_type self.status = status @@ -708,15 +862,16 @@ def __init__(self, *, execution_type=None, status=None, submitted_by: str=None, self.processing_end_time = processing_end_time self.file_name = file_name self.run_settings = run_settings + self.error = error class ExportExecutionListResult(Model): - """Result of listing exports execution history of a export by name. + """Result of listing the execution history of an export. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of export executions. + :ivar value: A list of export executions. :vartype value: list[~azure.mgmt.costmanagement.models.ExportExecution] """ @@ -784,13 +939,12 @@ def __init__(self, *, from_property, to=None, **kwargs) -> None: class ExportSchedule(Model): - """The schedule associated with a export. + """The schedule associated with the export. All required parameters must be populated in order to send to Azure. - :param status: The status of the schedule. Whether active or not. If - inactive, the export's scheduled execution is paused. Possible values - include: 'Active', 'Inactive' + :param status: The status of the export's schedule. If 'Inactive', the + export's schedule is paused. Possible values include: 'Active', 'Inactive' :type status: str or ~azure.mgmt.costmanagement.models.StatusType :param recurrence: Required. The schedule recurrence. Possible values include: 'Daily', 'Weekly', 'Monthly', 'Annually' @@ -819,6 +973,34 @@ def __init__(self, *, recurrence, status=None, recurrence_period=None, **kwargs) self.recurrence_period = recurrence_period +class ExportTimePeriod(Model): + """The date range for data in the export. This should only be specified with + timeFrame set to 'Custom'. The maximum date range is 3 months. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date for export data. + :type from_property: datetime + :param to: Required. The end date for export data. + :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(ExportTimePeriod, self).__init__(**kwargs) + self.from_property = from_property + self.to = to + + class ForecastDefinition(Model): """The definition of a forecast. @@ -976,45 +1158,6 @@ def __init__(self, *, type=None, name: str=None, **kwargs) -> None: 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. 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 index 1ecdad45dc5c..c045efc67fe8 100644 --- 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 @@ -24,7 +24,7 @@ class AlertsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request (e.g. '2020-06-01'). Constant value: "2020-06-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config 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 9d4082c233b1..877d41372326 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 @@ -24,7 +24,7 @@ class DimensionsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request (e.g. '2020-06-01'). Constant value: "2020-06-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py index 73edeb506961..71c1598fbdfe 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py @@ -24,7 +24,7 @@ class ExportsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request (e.g. '2020-06-01'). Constant value: "2020-06-01". """ models = models @@ -34,12 +34,12 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config def list( - self, scope, custom_headers=None, raw=False, **operation_config): + self, scope, expand=None, custom_headers=None, raw=False, **operation_config): """The operation to list all exports at the given scope. :param scope: The scope associated with query and export operations. @@ -62,6 +62,10 @@ def list( '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. :type scope: str + :param expand: May be used to expand the properties within an export. + Currently only 'runHistory' is supported and will return information + for the last execution of each export. + :type expand: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -83,6 +87,8 @@ def list( # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} @@ -113,7 +119,7 @@ def list( list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports'} def get( - self, scope, export_name, custom_headers=None, raw=False, **operation_config): + self, scope, export_name, expand=None, custom_headers=None, raw=False, **operation_config): """The operation to get the export for the defined scope by export name. :param scope: The scope associated with query and export operations. @@ -138,6 +144,10 @@ def get( :type scope: str :param export_name: Export Name. :type export_name: str + :param expand: May be used to expand the properties within an export. + Currently only 'runHistory' is supported and will return information + for the last 10 executions of the export. + :type expand: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -160,6 +170,8 @@ def get( # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} @@ -348,7 +360,7 @@ def delete( def execute( self, scope, export_name, custom_headers=None, raw=False, **operation_config): - """The operation to execute a export. + """The operation to execute an export. :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription @@ -418,7 +430,7 @@ def execute( def get_execution_history( self, scope, export_name, custom_headers=None, raw=False, **operation_config): """The operation to get the execution history of an export for the defined - scope by export name. + scope and export name. :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription 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 index 3f081e994d18..6d84f1344877 100644 --- 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 @@ -24,7 +24,7 @@ class ForecastOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request (e.g. '2020-06-01'). Constant value: "2020-06-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py index 9b8e7a21167b..6061a5a6201f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py @@ -24,7 +24,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request (e.g. '2020-06-01'). Constant value: "2020-06-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config 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 4ce6b965f53f..ef90230cb7e4 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 @@ -24,7 +24,7 @@ class QueryOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request (e.g. '2020-06-01'). Constant value: "2020-06-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config 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 index 30e75b5ba1c6..3425c4b9f8c0 100644 --- 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 @@ -24,7 +24,7 @@ class ViewsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request (e.g. '2020-06-01'). Constant value: "2020-06-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config