Skip to content

Commit

Permalink
Sdk automation/azure mgmt monitor (Azure#12549)
Browse files Browse the repository at this point in the history
* Update from release/v3

* version 0.11.0

Co-authored-by: SDK Automation <sdkautomation@microsoft.com>
  • Loading branch information
changlong-liu and SDK Automation authored Jul 15, 2020
1 parent bdfb3a2 commit 95ed9eb
Show file tree
Hide file tree
Showing 17 changed files with 986 additions and 2 deletions.
8 changes: 8 additions & 0 deletions sdk/monitor/azure-mgmt-monitor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release History

## 0.11.0 (2020-07-15)

**Features**

- Model MetricTrigger has a new parameter metric_namespace
- Model MetricTrigger has a new parameter dimensions
- Added operation group ManagementGroupDiagnosticSettingsOperations

## 0.10.0 (2020-06-08)

**Features**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ 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>`
* 2020-01-01-preview: :mod:`v2020_01_01_preview.models<azure.mgmt.monitor.v2020_01_01_preview.models>`
"""
if api_version == '2015-04-01':
from .v2015_04_01 import models
Expand Down Expand Up @@ -171,6 +172,9 @@ 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 == '2020-01-01-preview':
from .v2020_01_01_preview import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
Expand Down Expand Up @@ -370,6 +374,19 @@ def log_profiles(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 management_group_diagnostic_settings(self):
"""Instance depends on the API version:
* 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations<azure.mgmt.monitor.v2020_01_01_preview.operations.ManagementGroupDiagnosticSettingsOperations>`
"""
api_version = self._get_api_version('management_group_diagnostic_settings')
if api_version == '2020-01-01-preview':
from .v2020_01_01_preview.operations import ManagementGroupDiagnosticSettingsOperations 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 metric_alerts(self):
"""Instance depends on the API version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from ._models_py3 import ScaleAction
from ._models_py3 import ScaleCapacity
from ._models_py3 import ScaleRule
from ._models_py3 import ScaleRuleMetricDimension
from ._models_py3 import SenderAuthorization
from ._models_py3 import TimeWindow
from ._models_py3 import WebhookNotification
Expand All @@ -52,6 +53,7 @@
from ._models import ScaleAction
from ._models import ScaleCapacity
from ._models import ScaleRule
from ._models import ScaleRuleMetricDimension
from ._models import SenderAuthorization
from ._models import TimeWindow
from ._models import WebhookNotification
Expand All @@ -63,6 +65,7 @@
MetricStatisticType,
TimeAggregationType,
ComparisonOperationType,
ScaleRuleMetricDimensionOperationType,
ScaleDirection,
ScaleType,
RecurrenceFrequency,
Expand All @@ -88,6 +91,7 @@
'ScaleAction',
'ScaleCapacity',
'ScaleRule',
'ScaleRuleMetricDimension',
'SenderAuthorization',
'TimeWindow',
'WebhookNotification',
Expand All @@ -98,6 +102,7 @@
'MetricStatisticType',
'TimeAggregationType',
'ComparisonOperationType',
'ScaleRuleMetricDimensionOperationType',
'ScaleDirection',
'ScaleType',
'RecurrenceFrequency',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,9 @@ class MetricTrigger(Model):
:param metric_name: Required. the name of the metric that defines what the
rule monitors.
:type metric_name: str
:param metric_namespace: the namespace of the metric that defines what the
rule monitors.
:type metric_namespace: str
:param metric_resource_uri: Required. the resource identifier of the
resource the rule monitors.
:type metric_resource_uri: str
Expand Down Expand Up @@ -590,6 +593,10 @@ class MetricTrigger(Model):
:param threshold: Required. the threshold of the metric that triggers the
scale action.
:type threshold: float
:param dimensions: List of dimension conditions. For example:
[{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}].
:type dimensions:
list[~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimension]
"""

_validation = {
Expand All @@ -605,25 +612,29 @@ class MetricTrigger(Model):

_attribute_map = {
'metric_name': {'key': 'metricName', 'type': 'str'},
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
'metric_resource_uri': {'key': 'metricResourceUri', 'type': 'str'},
'time_grain': {'key': 'timeGrain', 'type': 'duration'},
'statistic': {'key': 'statistic', 'type': 'MetricStatisticType'},
'time_window': {'key': 'timeWindow', 'type': 'duration'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'},
'operator': {'key': 'operator', 'type': 'ComparisonOperationType'},
'threshold': {'key': 'threshold', 'type': 'float'},
'dimensions': {'key': 'dimensions', 'type': '[ScaleRuleMetricDimension]'},
}

def __init__(self, **kwargs):
super(MetricTrigger, self).__init__(**kwargs)
self.metric_name = kwargs.get('metric_name', None)
self.metric_namespace = kwargs.get('metric_namespace', None)
self.metric_resource_uri = kwargs.get('metric_resource_uri', None)
self.time_grain = kwargs.get('time_grain', None)
self.statistic = kwargs.get('statistic', None)
self.time_window = kwargs.get('time_window', None)
self.time_aggregation = kwargs.get('time_aggregation', None)
self.operator = kwargs.get('operator', None)
self.threshold = kwargs.get('threshold', None)
self.dimensions = kwargs.get('dimensions', None)


class Operation(Model):
Expand Down Expand Up @@ -918,6 +929,43 @@ def __init__(self, **kwargs):
self.scale_action = kwargs.get('scale_action', None)


class ScaleRuleMetricDimension(Model):
"""Specifies an auto scale rule metric dimension.
All required parameters must be populated in order to send to Azure.
:param dimension_name: Required. Name of the dimension.
:type dimension_name: str
:param operator: Required. the dimension operator. Only 'Equals' and
'NotEquals' are supported. 'Equals' being equal to any of the values.
'NotEquals' being not equal to all of the values. Possible values include:
'Equals', 'NotEquals'
:type operator: str or
~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimensionOperationType
:param values: Required. list of dimension values. For example:
["App1","App2"].
:type values: list[str]
"""

_validation = {
'dimension_name': {'required': True},
'operator': {'required': True},
'values': {'required': True},
}

_attribute_map = {
'dimension_name': {'key': 'DimensionName', 'type': 'str'},
'operator': {'key': 'Operator', 'type': 'str'},
'values': {'key': 'Values', 'type': '[str]'},
}

def __init__(self, **kwargs):
super(ScaleRuleMetricDimension, self).__init__(**kwargs)
self.dimension_name = kwargs.get('dimension_name', None)
self.operator = kwargs.get('operator', None)
self.values = kwargs.get('values', None)


class SenderAuthorization(Model):
"""the authorization used by the user who has performed the operation that led
to this event. This captures the RBAC properties of the event. These
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,9 @@ class MetricTrigger(Model):
:param metric_name: Required. the name of the metric that defines what the
rule monitors.
:type metric_name: str
:param metric_namespace: the namespace of the metric that defines what the
rule monitors.
:type metric_namespace: str
:param metric_resource_uri: Required. the resource identifier of the
resource the rule monitors.
:type metric_resource_uri: str
Expand Down Expand Up @@ -590,6 +593,10 @@ class MetricTrigger(Model):
:param threshold: Required. the threshold of the metric that triggers the
scale action.
:type threshold: float
:param dimensions: List of dimension conditions. For example:
[{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}].
:type dimensions:
list[~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimension]
"""

_validation = {
Expand All @@ -605,25 +612,29 @@ class MetricTrigger(Model):

_attribute_map = {
'metric_name': {'key': 'metricName', 'type': 'str'},
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
'metric_resource_uri': {'key': 'metricResourceUri', 'type': 'str'},
'time_grain': {'key': 'timeGrain', 'type': 'duration'},
'statistic': {'key': 'statistic', 'type': 'MetricStatisticType'},
'time_window': {'key': 'timeWindow', 'type': 'duration'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'},
'operator': {'key': 'operator', 'type': 'ComparisonOperationType'},
'threshold': {'key': 'threshold', 'type': 'float'},
'dimensions': {'key': 'dimensions', 'type': '[ScaleRuleMetricDimension]'},
}

def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, statistic, time_window, time_aggregation, operator, threshold: float, **kwargs) -> None:
def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, statistic, time_window, time_aggregation, operator, threshold: float, metric_namespace: str=None, dimensions=None, **kwargs) -> None:
super(MetricTrigger, self).__init__(**kwargs)
self.metric_name = metric_name
self.metric_namespace = metric_namespace
self.metric_resource_uri = metric_resource_uri
self.time_grain = time_grain
self.statistic = statistic
self.time_window = time_window
self.time_aggregation = time_aggregation
self.operator = operator
self.threshold = threshold
self.dimensions = dimensions


class Operation(Model):
Expand Down Expand Up @@ -918,6 +929,43 @@ def __init__(self, *, metric_trigger, scale_action, **kwargs) -> None:
self.scale_action = scale_action


class ScaleRuleMetricDimension(Model):
"""Specifies an auto scale rule metric dimension.
All required parameters must be populated in order to send to Azure.
:param dimension_name: Required. Name of the dimension.
:type dimension_name: str
:param operator: Required. the dimension operator. Only 'Equals' and
'NotEquals' are supported. 'Equals' being equal to any of the values.
'NotEquals' being not equal to all of the values. Possible values include:
'Equals', 'NotEquals'
:type operator: str or
~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimensionOperationType
:param values: Required. list of dimension values. For example:
["App1","App2"].
:type values: list[str]
"""

_validation = {
'dimension_name': {'required': True},
'operator': {'required': True},
'values': {'required': True},
}

_attribute_map = {
'dimension_name': {'key': 'DimensionName', 'type': 'str'},
'operator': {'key': 'Operator', 'type': 'str'},
'values': {'key': 'Values', 'type': '[str]'},
}

def __init__(self, *, dimension_name: str, operator, values, **kwargs) -> None:
super(ScaleRuleMetricDimension, self).__init__(**kwargs)
self.dimension_name = dimension_name
self.operator = operator
self.values = values


class SenderAuthorization(Model):
"""the authorization used by the user who has performed the operation that led
to this event. This captures the RBAC properties of the event. These
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ class ComparisonOperationType(str, Enum):
less_than_or_equal = "LessThanOrEqual"


class ScaleRuleMetricDimensionOperationType(str, Enum):

equals = "Equals"
not_equals = "NotEquals"


class ScaleDirection(str, Enum):

none = "None"
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,43 @@
# 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 str base_url: Service URL
"""

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

if credentials is None:
raise ValueError("Parameter 'credentials' 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
Loading

0 comments on commit 95ed9eb

Please sign in to comment.