Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[T1] monitor 2020 11 17 #15360

Merged
merged 1 commit into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions sdk/monitor/azure-mgmt-monitor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Release History

## 0.12.0 (2020-11-17)

**Features**

- Added operation ScheduledQueryRulesOperations.list_by_resource_group
- Added operation ScheduledQueryRulesOperations.list_by_subscription

**Breaking changes**

- Model Resource no longer has parameter location
- Model Resource no longer has parameter tags
- Model ErrorResponse has a new signature
- Model Action has a new signature

## 0.11.0 (2020-07-15)

**Features**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2019-03-01: :mod:`v2019_03_01.models<azure.mgmt.monitor.v2019_03_01.models>`
* 2019-06-01: :mod:`v2019_06_01.models<azure.mgmt.monitor.v2019_06_01.models>`
* 2019-10-17-preview: :mod:`v2019_10_17.models<azure.mgmt.monitor.v2019_10_17.models>`
* 2019-11-01-preview: :mod:`v2019_11_01_preview.models<azure.mgmt.monitor.v2019_11_01_preview.models>`
* 2020-01-01-preview: :mod:`v2020_01_01_preview.models<azure.mgmt.monitor.v2020_01_01_preview.models>`
* 2020-05-01-preview: :mod:`v2020_05_01_preview.models<azure.mgmt.monitor.v2020_05_01_preview.models>`
"""
if api_version == '2015-04-01':
from .v2015_04_01 import models
Expand Down Expand Up @@ -172,9 +174,15 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2019-10-17-preview':
from .v2019_10_17 import models
return models
elif api_version == '2019-11-01-preview':
from .v2019_11_01_preview import models
return models
elif api_version == '2020-01-01-preview':
from .v2020_01_01_preview import models
return models
elif api_version == '2020-05-01-preview':
from .v2020_05_01_preview import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
Expand Down Expand Up @@ -296,6 +304,32 @@ def baselines(self):
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def data_collection_rule_associations(self):
"""Instance depends on the API version:

* 2019-11-01-preview: :class:`DataCollectionRuleAssociationsOperations<azure.mgmt.monitor.v2019_11_01_preview.operations.DataCollectionRuleAssociationsOperations>`
"""
api_version = self._get_api_version('data_collection_rule_associations')
if api_version == '2019-11-01-preview':
from .v2019_11_01_preview.operations import DataCollectionRuleAssociationsOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def data_collection_rules(self):
"""Instance depends on the API version:

* 2019-11-01-preview: :class:`DataCollectionRulesOperations<azure.mgmt.monitor.v2019_11_01_preview.operations.DataCollectionRulesOperations>`
"""
api_version = self._get_api_version('data_collection_rules')
if api_version == '2019-11-01-preview':
from .v2019_11_01_preview.operations import DataCollectionRulesOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def diagnostic_settings(self):
"""Instance depends on the API version:
Expand Down Expand Up @@ -563,10 +597,13 @@ def scheduled_query_rules(self):
"""Instance depends on the API version:

* 2018-04-16: :class:`ScheduledQueryRulesOperations<azure.mgmt.monitor.v2018_04_16.operations.ScheduledQueryRulesOperations>`
* 2020-05-01-preview: :class:`ScheduledQueryRulesOperations<azure.mgmt.monitor.v2020_05_01_preview.operations.ScheduledQueryRulesOperations>`
"""
api_version = self._get_api_version('scheduled_query_rules')
if api_version == '2018-04-16':
from .v2018_04_16.operations import ScheduledQueryRulesOperations as OperationClass
elif api_version == '2020-05-01-preview':
from .v2020_05_01_preview.operations import ScheduledQueryRulesOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ class MultiMetricCriteria(Model):
:param dimensions: List of dimension conditions.
:type dimensions:
list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension]
:param skip_metric_validation: Allows creating an alert rule on a custom
metric that isn't yet emitted, by causing the metric validation to be
skipped.
:type skip_metric_validation: bool
:param criterion_type: Required. Constant filled by server.
:type criterion_type: str
"""
Expand All @@ -350,6 +354,7 @@ class MultiMetricCriteria(Model):
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'object'},
'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'},
'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'},
'criterion_type': {'key': 'criterionType', 'type': 'str'},
}

Expand All @@ -365,6 +370,7 @@ def __init__(self, **kwargs):
self.metric_namespace = kwargs.get('metric_namespace', None)
self.time_aggregation = kwargs.get('time_aggregation', None)
self.dimensions = kwargs.get('dimensions', None)
self.skip_metric_validation = kwargs.get('skip_metric_validation', None)
self.criterion_type = None


Expand All @@ -387,6 +393,10 @@ class DynamicMetricCriteria(MultiMetricCriteria):
:param dimensions: List of dimension conditions.
:type dimensions:
list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension]
:param skip_metric_validation: Allows creating an alert rule on a custom
metric that isn't yet emitted, by causing the metric validation to be
skipped.
:type skip_metric_validation: bool
:param criterion_type: Required. Constant filled by server.
:type criterion_type: str
:param operator: Required. The operator used to compare the metric value
Expand Down Expand Up @@ -427,6 +437,7 @@ class DynamicMetricCriteria(MultiMetricCriteria):
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'object'},
'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'},
'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'},
'criterion_type': {'key': 'criterionType', 'type': 'str'},
'operator': {'key': 'operator', 'type': 'str'},
'alert_sensitivity': {'key': 'alertSensitivity', 'type': 'str'},
Expand Down Expand Up @@ -1057,6 +1068,10 @@ class MetricCriteria(MultiMetricCriteria):
:param dimensions: List of dimension conditions.
:type dimensions:
list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension]
:param skip_metric_validation: Allows creating an alert rule on a custom
metric that isn't yet emitted, by causing the metric validation to be
skipped.
:type skip_metric_validation: bool
:param criterion_type: Required. Constant filled by server.
:type criterion_type: str
:param operator: Required. the criteria operator. Possible values include:
Expand Down Expand Up @@ -1084,6 +1099,7 @@ class MetricCriteria(MultiMetricCriteria):
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'object'},
'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'},
'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'},
'criterion_type': {'key': 'criterionType', 'type': 'str'},
'operator': {'key': 'operator', 'type': 'str'},
'threshold': {'key': 'threshold', 'type': 'float'},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ class MultiMetricCriteria(Model):
:param dimensions: List of dimension conditions.
:type dimensions:
list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension]
:param skip_metric_validation: Allows creating an alert rule on a custom
metric that isn't yet emitted, by causing the metric validation to be
skipped.
:type skip_metric_validation: bool
:param criterion_type: Required. Constant filled by server.
:type criterion_type: str
"""
Expand All @@ -350,21 +354,23 @@ class MultiMetricCriteria(Model):
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'object'},
'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'},
'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'},
'criterion_type': {'key': 'criterionType', 'type': 'str'},
}

_subtype_map = {
'criterion_type': {'StaticThresholdCriterion': 'MetricCriteria', 'DynamicThresholdCriterion': 'DynamicMetricCriteria'}
}

def __init__(self, *, name: str, metric_name: str, time_aggregation, additional_properties=None, metric_namespace: str=None, dimensions=None, **kwargs) -> None:
def __init__(self, *, name: str, metric_name: str, time_aggregation, additional_properties=None, metric_namespace: str=None, dimensions=None, skip_metric_validation: bool=None, **kwargs) -> None:
super(MultiMetricCriteria, self).__init__(**kwargs)
self.additional_properties = additional_properties
self.name = name
self.metric_name = metric_name
self.metric_namespace = metric_namespace
self.time_aggregation = time_aggregation
self.dimensions = dimensions
self.skip_metric_validation = skip_metric_validation
self.criterion_type = None


Expand All @@ -387,6 +393,10 @@ class DynamicMetricCriteria(MultiMetricCriteria):
:param dimensions: List of dimension conditions.
:type dimensions:
list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension]
:param skip_metric_validation: Allows creating an alert rule on a custom
metric that isn't yet emitted, by causing the metric validation to be
skipped.
:type skip_metric_validation: bool
:param criterion_type: Required. Constant filled by server.
:type criterion_type: str
:param operator: Required. The operator used to compare the metric value
Expand Down Expand Up @@ -427,15 +437,16 @@ class DynamicMetricCriteria(MultiMetricCriteria):
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'object'},
'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'},
'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'},
'criterion_type': {'key': 'criterionType', 'type': 'str'},
'operator': {'key': 'operator', 'type': 'str'},
'alert_sensitivity': {'key': 'alertSensitivity', 'type': 'str'},
'failing_periods': {'key': 'failingPeriods', 'type': 'DynamicThresholdFailingPeriods'},
'ignore_data_before': {'key': 'ignoreDataBefore', 'type': 'iso-8601'},
}

def __init__(self, *, name: str, metric_name: str, time_aggregation, operator, alert_sensitivity, failing_periods, additional_properties=None, metric_namespace: str=None, dimensions=None, ignore_data_before=None, **kwargs) -> None:
super(DynamicMetricCriteria, self).__init__(additional_properties=additional_properties, name=name, metric_name=metric_name, metric_namespace=metric_namespace, time_aggregation=time_aggregation, dimensions=dimensions, **kwargs)
def __init__(self, *, name: str, metric_name: str, time_aggregation, operator, alert_sensitivity, failing_periods, additional_properties=None, metric_namespace: str=None, dimensions=None, skip_metric_validation: bool=None, ignore_data_before=None, **kwargs) -> None:
super(DynamicMetricCriteria, self).__init__(additional_properties=additional_properties, name=name, metric_name=metric_name, metric_namespace=metric_namespace, time_aggregation=time_aggregation, dimensions=dimensions, skip_metric_validation=skip_metric_validation, **kwargs)
self.operator = operator
self.alert_sensitivity = alert_sensitivity
self.failing_periods = failing_periods
Expand Down Expand Up @@ -1057,6 +1068,10 @@ class MetricCriteria(MultiMetricCriteria):
:param dimensions: List of dimension conditions.
:type dimensions:
list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension]
:param skip_metric_validation: Allows creating an alert rule on a custom
metric that isn't yet emitted, by causing the metric validation to be
skipped.
:type skip_metric_validation: bool
:param criterion_type: Required. Constant filled by server.
:type criterion_type: str
:param operator: Required. the criteria operator. Possible values include:
Expand Down Expand Up @@ -1084,13 +1099,14 @@ class MetricCriteria(MultiMetricCriteria):
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'object'},
'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'},
'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'},
'criterion_type': {'key': 'criterionType', 'type': 'str'},
'operator': {'key': 'operator', 'type': 'str'},
'threshold': {'key': 'threshold', 'type': 'float'},
}

def __init__(self, *, name: str, metric_name: str, time_aggregation, operator, threshold: float, additional_properties=None, metric_namespace: str=None, dimensions=None, **kwargs) -> None:
super(MetricCriteria, self).__init__(additional_properties=additional_properties, name=name, metric_name=metric_name, metric_namespace=metric_namespace, time_aggregation=time_aggregation, dimensions=dimensions, **kwargs)
def __init__(self, *, name: str, metric_name: str, time_aggregation, operator, threshold: float, additional_properties=None, metric_namespace: str=None, dimensions=None, skip_metric_validation: bool=None, **kwargs) -> None:
super(MetricCriteria, self).__init__(additional_properties=additional_properties, name=name, metric_name=metric_name, metric_namespace=metric_namespace, time_aggregation=time_aggregation, dimensions=dimensions, skip_metric_validation=skip_metric_validation, **kwargs)
self.operator = operator
self.threshold = threshold
self.criterion_type = 'StaticThresholdCriterion'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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 ._configuration import MonitorManagementClientConfiguration
from ._monitor_management_client import MonitorManagementClient
__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration']

from .version import VERSION

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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 msrestazure import AzureConfiguration

from .version import VERSION


class MonitorManagementClientConfiguration(AzureConfiguration):
"""Configuration for MonitorManagementClient
Note that all parameters used to create this instance are saved as instance
attributes.

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

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

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

super(MonitorManagementClientConfiguration, self).__init__(base_url)

# Starting Autorest.Python 4.0.64, make connection pool activated by default
self.keep_alive = True

self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id
Loading