diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py index d2978d0436aa..2e0e28c930b6 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py @@ -88,6 +88,11 @@ from .baseline_response_py3 import BaselineResponse from .time_series_information_py3 import TimeSeriesInformation from .calculate_baseline_response_py3 import CalculateBaselineResponse + from .metric_single_dimension_py3 import MetricSingleDimension + from .single_baseline_py3 import SingleBaseline + from .baseline_metadata_py3 import BaselineMetadata + from .time_series_baseline_py3 import TimeSeriesBaseline + from .single_metric_baseline_py3 import SingleMetricBaseline from .metric_alert_action_py3 import MetricAlertAction from .metric_alert_criteria_py3 import MetricAlertCriteria from .metric_alert_resource_py3 import MetricAlertResource @@ -199,6 +204,11 @@ from .baseline_response import BaselineResponse from .time_series_information import TimeSeriesInformation from .calculate_baseline_response import CalculateBaselineResponse + from .metric_single_dimension import MetricSingleDimension + from .single_baseline import SingleBaseline + from .baseline_metadata import BaselineMetadata + from .time_series_baseline import TimeSeriesBaseline + from .single_metric_baseline import SingleMetricBaseline from .metric_alert_action import MetricAlertAction from .metric_alert_criteria import MetricAlertCriteria from .metric_alert_resource import MetricAlertResource @@ -240,6 +250,7 @@ from .event_data_paged import EventDataPaged from .localizable_string_paged import LocalizableStringPaged from .metric_definition_paged import MetricDefinitionPaged +from .single_metric_baseline_paged import SingleMetricBaselinePaged from .metric_alert_resource_paged import MetricAlertResourcePaged from .log_search_rule_resource_paged import LogSearchRuleResourcePaged from .metric_namespace_paged import MetricNamespacePaged @@ -258,6 +269,7 @@ Unit, AggregationType, Sensitivity, + BaselineSensitivity, Enabled, ProvisioningState, QueryType, @@ -348,6 +360,11 @@ 'BaselineResponse', 'TimeSeriesInformation', 'CalculateBaselineResponse', + 'MetricSingleDimension', + 'SingleBaseline', + 'BaselineMetadata', + 'TimeSeriesBaseline', + 'SingleMetricBaseline', 'MetricAlertAction', 'MetricAlertCriteria', 'MetricAlertResource', @@ -389,6 +406,7 @@ 'EventDataPaged', 'LocalizableStringPaged', 'MetricDefinitionPaged', + 'SingleMetricBaselinePaged', 'MetricAlertResourcePaged', 'LogSearchRuleResourcePaged', 'MetricNamespacePaged', @@ -406,6 +424,7 @@ 'Unit', 'AggregationType', 'Sensitivity', + 'BaselineSensitivity', 'Enabled', 'ProvisioningState', 'QueryType', diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/baseline_metadata.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/baseline_metadata.py new file mode 100644 index 000000000000..f712751fe44b --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/baseline_metadata.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class BaselineMetadata(Model): + """Represents a baseline metadata value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the baseline metadata. + :type name: str + :param value: Required. Value of the baseline metadata. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BaselineMetadata, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/baseline_metadata_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/baseline_metadata_py3.py new file mode 100644 index 000000000000..9c4eb9c042dc --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/baseline_metadata_py3.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class BaselineMetadata(Model): + """Represents a baseline metadata value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the baseline metadata. + :type name: str + :param value: Required. Value of the baseline metadata. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name: str, value: str, **kwargs) -> None: + super(BaselineMetadata, self).__init__(**kwargs) + self.name = name + self.value = value diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.py index 3f6aae2cfd7a..340f791d7963 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.py @@ -19,8 +19,8 @@ class LogToMetricAction(Action): :param odatatype: Required. Constant filled by server. :type odatatype: str - :param criteria: Required. Severity of the alert - :type criteria: ~azure.mgmt.monitor.models.Criteria + :param criteria: Required. Criteria of Metric + :type criteria: list[~azure.mgmt.monitor.models.Criteria] """ _validation = { @@ -30,7 +30,7 @@ class LogToMetricAction(Action): _attribute_map = { 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, - 'criteria': {'key': 'criteria', 'type': 'Criteria'}, + 'criteria': {'key': 'criteria', 'type': '[Criteria]'}, } def __init__(self, **kwargs): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action_py3.py index 7d82993fdc4d..80070b506458 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action_py3.py @@ -19,8 +19,8 @@ class LogToMetricAction(Action): :param odatatype: Required. Constant filled by server. :type odatatype: str - :param criteria: Required. Severity of the alert - :type criteria: ~azure.mgmt.monitor.models.Criteria + :param criteria: Required. Criteria of Metric + :type criteria: list[~azure.mgmt.monitor.models.Criteria] """ _validation = { @@ -30,7 +30,7 @@ class LogToMetricAction(Action): _attribute_map = { 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, - 'criteria': {'key': 'criteria', 'type': 'Criteria'}, + 'criteria': {'key': 'criteria', 'type': '[Criteria]'}, } def __init__(self, *, criteria, **kwargs) -> None: diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_single_dimension.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_single_dimension.py new file mode 100644 index 000000000000..08a0325e291b --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_single_dimension.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MetricSingleDimension(Model): + """The metric dimension name and value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param value: Required. Value of the dimension. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricSingleDimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_single_dimension_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_single_dimension_py3.py new file mode 100644 index 000000000000..ec1ef70360a1 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_single_dimension_py3.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MetricSingleDimension(Model): + """The metric dimension name and value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param value: Required. Value of the dimension. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name: str, value: str, **kwargs) -> None: + super(MetricSingleDimension, self).__init__(**kwargs) + self.name = name + self.value = value diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py index 034dcdfe187d..a217cf604e42 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py @@ -135,6 +135,13 @@ class Sensitivity(str, Enum): high = "High" +class BaselineSensitivity(str, Enum): + + low = "Low" + medium = "Medium" + high = "High" + + class Enabled(str, Enum): true = "true" diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/single_baseline.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/single_baseline.py new file mode 100644 index 000000000000..4f7c9ca7fa7e --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/single_baseline.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SingleBaseline(Model): + """The baseline values for a single sensitivity value. + + All required parameters must be populated in order to send to Azure. + + :param sensitivity: Required. the sensitivity of the baseline. Possible + values include: 'Low', 'Medium', 'High' + :type sensitivity: str or ~azure.mgmt.monitor.models.BaselineSensitivity + :param low_thresholds: Required. The low thresholds of the baseline. + :type low_thresholds: list[float] + :param high_thresholds: Required. The high thresholds of the baseline. + :type high_thresholds: list[float] + """ + + _validation = { + 'sensitivity': {'required': True}, + 'low_thresholds': {'required': True}, + 'high_thresholds': {'required': True}, + } + + _attribute_map = { + 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, + 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, + 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + } + + def __init__(self, **kwargs): + super(SingleBaseline, self).__init__(**kwargs) + self.sensitivity = kwargs.get('sensitivity', None) + self.low_thresholds = kwargs.get('low_thresholds', None) + self.high_thresholds = kwargs.get('high_thresholds', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/single_baseline_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/single_baseline_py3.py new file mode 100644 index 000000000000..392b1dd980ae --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/single_baseline_py3.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SingleBaseline(Model): + """The baseline values for a single sensitivity value. + + All required parameters must be populated in order to send to Azure. + + :param sensitivity: Required. the sensitivity of the baseline. Possible + values include: 'Low', 'Medium', 'High' + :type sensitivity: str or ~azure.mgmt.monitor.models.BaselineSensitivity + :param low_thresholds: Required. The low thresholds of the baseline. + :type low_thresholds: list[float] + :param high_thresholds: Required. The high thresholds of the baseline. + :type high_thresholds: list[float] + """ + + _validation = { + 'sensitivity': {'required': True}, + 'low_thresholds': {'required': True}, + 'high_thresholds': {'required': True}, + } + + _attribute_map = { + 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, + 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, + 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + } + + def __init__(self, *, sensitivity, low_thresholds, high_thresholds, **kwargs) -> None: + super(SingleBaseline, self).__init__(**kwargs) + self.sensitivity = sensitivity + self.low_thresholds = low_thresholds + self.high_thresholds = high_thresholds diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline.py new file mode 100644 index 000000000000..041bafa0050a --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SingleMetricBaseline(Model): + """The baseline results of a single metric. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The metric baseline Id. + :type id: str + :param type: Required. The resource type of the metric baseline resource. + :type type: str + :param name: Required. The name of the metric for which the baselines were + retrieved. + :type name: str + :param timespan: Required. The timespan for which the data was retrieved. + Its value consists of two datetimes concatenated, separated by '/'. This + may be adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: Required. The interval (window size) for which the metric + data was returned in. This may be adjusted in the future and returned + back from what was originally requested. This is not present if a + metadata request was made. + :type interval: timedelta + :param namespace: The namespace of the metrics been queried. + :type namespace: str + :param baselines: Required. The baseline for each time series that was + queried. + :type baselines: list[~azure.mgmt.monitor.models.TimeSeriesBaseline] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + 'name': {'required': True}, + 'timespan': {'required': True}, + 'interval': {'required': True}, + 'baselines': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'timespan': {'key': 'properties.timespan', 'type': 'str'}, + 'interval': {'key': 'properties.interval', 'type': 'duration'}, + 'namespace': {'key': 'properties.namespace', 'type': 'str'}, + 'baselines': {'key': 'properties.baselines', 'type': '[TimeSeriesBaseline]'}, + } + + def __init__(self, **kwargs): + super(SingleMetricBaseline, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + self.timespan = kwargs.get('timespan', None) + self.interval = kwargs.get('interval', None) + self.namespace = kwargs.get('namespace', None) + self.baselines = kwargs.get('baselines', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline_paged.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline_paged.py new file mode 100644 index 000000000000..83214fd5f7f7 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class SingleMetricBaselinePaged(Paged): + """ + A paging container for iterating over a list of :class:`SingleMetricBaseline ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SingleMetricBaseline]'} + } + + def __init__(self, *args, **kwargs): + + super(SingleMetricBaselinePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline_py3.py new file mode 100644 index 000000000000..1b24686b90b2 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline_py3.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SingleMetricBaseline(Model): + """The baseline results of a single metric. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The metric baseline Id. + :type id: str + :param type: Required. The resource type of the metric baseline resource. + :type type: str + :param name: Required. The name of the metric for which the baselines were + retrieved. + :type name: str + :param timespan: Required. The timespan for which the data was retrieved. + Its value consists of two datetimes concatenated, separated by '/'. This + may be adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: Required. The interval (window size) for which the metric + data was returned in. This may be adjusted in the future and returned + back from what was originally requested. This is not present if a + metadata request was made. + :type interval: timedelta + :param namespace: The namespace of the metrics been queried. + :type namespace: str + :param baselines: Required. The baseline for each time series that was + queried. + :type baselines: list[~azure.mgmt.monitor.models.TimeSeriesBaseline] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + 'name': {'required': True}, + 'timespan': {'required': True}, + 'interval': {'required': True}, + 'baselines': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'timespan': {'key': 'properties.timespan', 'type': 'str'}, + 'interval': {'key': 'properties.interval', 'type': 'duration'}, + 'namespace': {'key': 'properties.namespace', 'type': 'str'}, + 'baselines': {'key': 'properties.baselines', 'type': '[TimeSeriesBaseline]'}, + } + + def __init__(self, *, id: str, type: str, name: str, timespan: str, interval, baselines, namespace: str=None, **kwargs) -> None: + super(SingleMetricBaseline, self).__init__(**kwargs) + self.id = id + self.type = type + self.name = name + self.timespan = timespan + self.interval = interval + self.namespace = namespace + self.baselines = baselines diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/time_series_baseline.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/time_series_baseline.py new file mode 100644 index 000000000000..0218b00125d9 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/time_series_baseline.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TimeSeriesBaseline(Model): + """The baseline values for a single time series. + + All required parameters must be populated in order to send to Azure. + + :param aggregation: Required. The aggregation type of the metric. + :type aggregation: str + :param dimensions: The dimensions of this time series. + :type dimensions: list[~azure.mgmt.monitor.models.MetricSingleDimension] + :param timestamps: Required. The list of timestamps of the baselines. + :type timestamps: list[datetime] + :param data: Required. The baseline values for each sensitivity. + :type data: list[~azure.mgmt.monitor.models.SingleBaseline] + :param metadata: The baseline metadata values. + :type metadata: list[~azure.mgmt.monitor.models.BaselineMetadata] + """ + + _validation = { + 'aggregation': {'required': True}, + 'timestamps': {'required': True}, + 'data': {'required': True}, + } + + _attribute_map = { + 'aggregation': {'key': 'aggregation', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricSingleDimension]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'data': {'key': 'data', 'type': '[SingleBaseline]'}, + 'metadata': {'key': 'metadata', 'type': '[BaselineMetadata]'}, + } + + def __init__(self, **kwargs): + super(TimeSeriesBaseline, self).__init__(**kwargs) + self.aggregation = kwargs.get('aggregation', None) + self.dimensions = kwargs.get('dimensions', None) + self.timestamps = kwargs.get('timestamps', None) + self.data = kwargs.get('data', None) + self.metadata = kwargs.get('metadata', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/time_series_baseline_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/time_series_baseline_py3.py new file mode 100644 index 000000000000..7f3fe632864f --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/time_series_baseline_py3.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TimeSeriesBaseline(Model): + """The baseline values for a single time series. + + All required parameters must be populated in order to send to Azure. + + :param aggregation: Required. The aggregation type of the metric. + :type aggregation: str + :param dimensions: The dimensions of this time series. + :type dimensions: list[~azure.mgmt.monitor.models.MetricSingleDimension] + :param timestamps: Required. The list of timestamps of the baselines. + :type timestamps: list[datetime] + :param data: Required. The baseline values for each sensitivity. + :type data: list[~azure.mgmt.monitor.models.SingleBaseline] + :param metadata: The baseline metadata values. + :type metadata: list[~azure.mgmt.monitor.models.BaselineMetadata] + """ + + _validation = { + 'aggregation': {'required': True}, + 'timestamps': {'required': True}, + 'data': {'required': True}, + } + + _attribute_map = { + 'aggregation': {'key': 'aggregation', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricSingleDimension]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'data': {'key': 'data', 'type': '[SingleBaseline]'}, + 'metadata': {'key': 'metadata', 'type': '[BaselineMetadata]'}, + } + + def __init__(self, *, aggregation: str, timestamps, data, dimensions=None, metadata=None, **kwargs) -> None: + super(TimeSeriesBaseline, self).__init__(**kwargs) + self.aggregation = aggregation + self.dimensions = dimensions + self.timestamps = timestamps + self.data = data + self.metadata = metadata diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/monitor_management_client.py b/azure-mgmt-monitor/azure/mgmt/monitor/monitor_management_client.py index 7d44a529ad2f..f5717897c039 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/monitor_management_client.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/monitor_management_client.py @@ -28,6 +28,7 @@ from .operations.metric_definitions_operations import MetricDefinitionsOperations from .operations.metrics_operations import MetricsOperations from .operations.metric_baseline_operations import MetricBaselineOperations +from .operations.baselines_operations import BaselinesOperations from .operations.metric_alerts_operations import MetricAlertsOperations from .operations.metric_alerts_status_operations import MetricAlertsStatusOperations from .operations.scheduled_query_rules_operations import ScheduledQueryRulesOperations @@ -104,6 +105,8 @@ class MonitorManagementClient(SDKClient): :vartype metrics: azure.mgmt.monitor.operations.MetricsOperations :ivar metric_baseline: MetricBaseline operations :vartype metric_baseline: azure.mgmt.monitor.operations.MetricBaselineOperations + :ivar baselines: Baselines operations + :vartype baselines: azure.mgmt.monitor.operations.BaselinesOperations :ivar metric_alerts: MetricAlerts operations :vartype metric_alerts: azure.mgmt.monitor.operations.MetricAlertsOperations :ivar metric_alerts_status: MetricAlertsStatus operations @@ -163,6 +166,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.metric_baseline = MetricBaselineOperations( self._client, self.config, self._serialize, self._deserialize) + self.baselines = BaselinesOperations( + self._client, self.config, self._serialize, self._deserialize) self.metric_alerts = MetricAlertsOperations( self._client, self.config, self._serialize, self._deserialize) self.metric_alerts_status = MetricAlertsStatusOperations( diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py index 85645e686fc1..6697780b0342 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py @@ -24,6 +24,7 @@ from .metric_definitions_operations import MetricDefinitionsOperations from .metrics_operations import MetricsOperations from .metric_baseline_operations import MetricBaselineOperations +from .baselines_operations import BaselinesOperations from .metric_alerts_operations import MetricAlertsOperations from .metric_alerts_status_operations import MetricAlertsStatusOperations from .scheduled_query_rules_operations import ScheduledQueryRulesOperations @@ -46,6 +47,7 @@ 'MetricDefinitionsOperations', 'MetricsOperations', 'MetricBaselineOperations', + 'BaselinesOperations', 'MetricAlertsOperations', 'MetricAlertsStatusOperations', 'ScheduledQueryRulesOperations', diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/baselines_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/baselines_operations.py new file mode 100644 index 000000000000..4e9e9db4363e --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/baselines_operations.py @@ -0,0 +1,150 @@ +# 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 BaselinesOperations(object): + """BaselinesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-03-01" + + self.config = config + + def list( + self, resource_uri, metricnames=None, metricnamespace=None, timespan=None, interval=None, aggregation=None, sensitivities=None, filter=None, result_type=None, custom_headers=None, raw=False, **operation_config): + """**Lists the metric baseline values for a resource**. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param metricnames: The names of the metrics (comma separated) to + retrieve. + :type metricnames: str + :param metricnamespace: Metric namespace to query metric definitions + for. + :type metricnamespace: str + :param timespan: The timespan of the query. It is a string with the + following format 'startDateTime_ISO/endDateTime_ISO'. + :type timespan: str + :param interval: The interval (i.e. timegrain) of the query. + :type interval: timedelta + :param aggregation: The list of aggregation types (comma separated) to + retrieve. + :type aggregation: str + :param sensitivities: The list of sensitivities (comma separated) to + retrieve. + :type sensitivities: str + :param filter: The **$filter** is used to reduce the set of metric + data returned.
Example:
Metric contains metadata A, B and + C.
- Return all time series of C where A = a1 and B = b1 or + b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq + ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C + eq ‘*’ or B = ‘b2’**
This is invalid because the logical or + operator cannot separate two different metadata names.
- Return all + time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ + and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = + a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + :type filter: str + :param result_type: Allows retrieving only metadata of the baseline. + On data request all information is retrieved. Possible values include: + 'Data', 'Metadata' + :type result_type: str or ~azure.mgmt.monitor.models.ResultType + :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 SingleMetricBaseline + :rtype: + ~azure.mgmt.monitor.models.SingleMetricBaselinePaged[~azure.mgmt.monitor.models.SingleMetricBaseline] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if metricnames is not None: + query_parameters['metricnames'] = self._serialize.query("metricnames", metricnames, 'str') + if metricnamespace is not None: + query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str') + if timespan is not None: + query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') + if aggregation is not None: + query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str') + if sensitivities is not None: + query_parameters['sensitivities'] = self._serialize.query("sensitivities", sensitivities, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if result_type is not None: + query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'ResultType') + 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) + 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 + deserialized = models.SingleMetricBaselinePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SingleMetricBaselinePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricBaselines'} diff --git a/azure-mgmt-monitor/setup.py b/azure-mgmt-monitor/setup.py index e26e0db3cc39..b571adaf4894 100644 --- a/azure-mgmt-monitor/setup.py +++ b/azure-mgmt-monitor/setup.py @@ -53,6 +53,7 @@ version=version, description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), long_description=readme + '\n\n' + history, + long_description_content_type='text/x-rst', license='MIT License', author='Microsoft Corporation', author_email='azpysdkhelp@microsoft.com',