Skip to content

Commit 95ed9eb

Browse files
changlong-liuSDK Automation
andauthored
Sdk automation/azure mgmt monitor (Azure#12549)
* Update from release/v3 * version 0.11.0 Co-authored-by: SDK Automation <[email protected]>
1 parent bdfb3a2 commit 95ed9eb

17 files changed

+986
-2
lines changed

sdk/monitor/azure-mgmt-monitor/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Release History
22

3+
## 0.11.0 (2020-07-15)
4+
5+
**Features**
6+
7+
- Model MetricTrigger has a new parameter metric_namespace
8+
- Model MetricTrigger has a new parameter dimensions
9+
- Added operation group ManagementGroupDiagnosticSettingsOperations
10+
311
## 0.10.0 (2020-06-08)
412

513
**Features**

sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
116116
* 2019-03-01: :mod:`v2019_03_01.models<azure.mgmt.monitor.v2019_03_01.models>`
117117
* 2019-06-01: :mod:`v2019_06_01.models<azure.mgmt.monitor.v2019_06_01.models>`
118118
* 2019-10-17-preview: :mod:`v2019_10_17.models<azure.mgmt.monitor.v2019_10_17.models>`
119+
* 2020-01-01-preview: :mod:`v2020_01_01_preview.models<azure.mgmt.monitor.v2020_01_01_preview.models>`
119120
"""
120121
if api_version == '2015-04-01':
121122
from .v2015_04_01 import models
@@ -171,6 +172,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
171172
elif api_version == '2019-10-17-preview':
172173
from .v2019_10_17 import models
173174
return models
175+
elif api_version == '2020-01-01-preview':
176+
from .v2020_01_01_preview import models
177+
return models
174178
raise NotImplementedError("APIVersion {} is not available".format(api_version))
175179

176180
@property
@@ -370,6 +374,19 @@ def log_profiles(self):
370374
raise NotImplementedError("APIVersion {} is not available".format(api_version))
371375
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
372376

377+
@property
378+
def management_group_diagnostic_settings(self):
379+
"""Instance depends on the API version:
380+
381+
* 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations<azure.mgmt.monitor.v2020_01_01_preview.operations.ManagementGroupDiagnosticSettingsOperations>`
382+
"""
383+
api_version = self._get_api_version('management_group_diagnostic_settings')
384+
if api_version == '2020-01-01-preview':
385+
from .v2020_01_01_preview.operations import ManagementGroupDiagnosticSettingsOperations as OperationClass
386+
else:
387+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
388+
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
389+
373390
@property
374391
def metric_alerts(self):
375392
"""Instance depends on the API version:

sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from ._models_py3 import ScaleAction
3030
from ._models_py3 import ScaleCapacity
3131
from ._models_py3 import ScaleRule
32+
from ._models_py3 import ScaleRuleMetricDimension
3233
from ._models_py3 import SenderAuthorization
3334
from ._models_py3 import TimeWindow
3435
from ._models_py3 import WebhookNotification
@@ -52,6 +53,7 @@
5253
from ._models import ScaleAction
5354
from ._models import ScaleCapacity
5455
from ._models import ScaleRule
56+
from ._models import ScaleRuleMetricDimension
5557
from ._models import SenderAuthorization
5658
from ._models import TimeWindow
5759
from ._models import WebhookNotification
@@ -63,6 +65,7 @@
6365
MetricStatisticType,
6466
TimeAggregationType,
6567
ComparisonOperationType,
68+
ScaleRuleMetricDimensionOperationType,
6669
ScaleDirection,
6770
ScaleType,
6871
RecurrenceFrequency,
@@ -88,6 +91,7 @@
8891
'ScaleAction',
8992
'ScaleCapacity',
9093
'ScaleRule',
94+
'ScaleRuleMetricDimension',
9195
'SenderAuthorization',
9296
'TimeWindow',
9397
'WebhookNotification',
@@ -98,6 +102,7 @@
98102
'MetricStatisticType',
99103
'TimeAggregationType',
100104
'ComparisonOperationType',
105+
'ScaleRuleMetricDimensionOperationType',
101106
'ScaleDirection',
102107
'ScaleType',
103108
'RecurrenceFrequency',

sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ class MetricTrigger(Model):
559559
:param metric_name: Required. the name of the metric that defines what the
560560
rule monitors.
561561
:type metric_name: str
562+
:param metric_namespace: the namespace of the metric that defines what the
563+
rule monitors.
564+
:type metric_namespace: str
562565
:param metric_resource_uri: Required. the resource identifier of the
563566
resource the rule monitors.
564567
:type metric_resource_uri: str
@@ -590,6 +593,10 @@ class MetricTrigger(Model):
590593
:param threshold: Required. the threshold of the metric that triggers the
591594
scale action.
592595
:type threshold: float
596+
:param dimensions: List of dimension conditions. For example:
597+
[{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}].
598+
:type dimensions:
599+
list[~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimension]
593600
"""
594601

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

606613
_attribute_map = {
607614
'metric_name': {'key': 'metricName', 'type': 'str'},
615+
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
608616
'metric_resource_uri': {'key': 'metricResourceUri', 'type': 'str'},
609617
'time_grain': {'key': 'timeGrain', 'type': 'duration'},
610618
'statistic': {'key': 'statistic', 'type': 'MetricStatisticType'},
611619
'time_window': {'key': 'timeWindow', 'type': 'duration'},
612620
'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'},
613621
'operator': {'key': 'operator', 'type': 'ComparisonOperationType'},
614622
'threshold': {'key': 'threshold', 'type': 'float'},
623+
'dimensions': {'key': 'dimensions', 'type': '[ScaleRuleMetricDimension]'},
615624
}
616625

617626
def __init__(self, **kwargs):
618627
super(MetricTrigger, self).__init__(**kwargs)
619628
self.metric_name = kwargs.get('metric_name', None)
629+
self.metric_namespace = kwargs.get('metric_namespace', None)
620630
self.metric_resource_uri = kwargs.get('metric_resource_uri', None)
621631
self.time_grain = kwargs.get('time_grain', None)
622632
self.statistic = kwargs.get('statistic', None)
623633
self.time_window = kwargs.get('time_window', None)
624634
self.time_aggregation = kwargs.get('time_aggregation', None)
625635
self.operator = kwargs.get('operator', None)
626636
self.threshold = kwargs.get('threshold', None)
637+
self.dimensions = kwargs.get('dimensions', None)
627638

628639

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

920931

932+
class ScaleRuleMetricDimension(Model):
933+
"""Specifies an auto scale rule metric dimension.
934+
935+
All required parameters must be populated in order to send to Azure.
936+
937+
:param dimension_name: Required. Name of the dimension.
938+
:type dimension_name: str
939+
:param operator: Required. the dimension operator. Only 'Equals' and
940+
'NotEquals' are supported. 'Equals' being equal to any of the values.
941+
'NotEquals' being not equal to all of the values. Possible values include:
942+
'Equals', 'NotEquals'
943+
:type operator: str or
944+
~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimensionOperationType
945+
:param values: Required. list of dimension values. For example:
946+
["App1","App2"].
947+
:type values: list[str]
948+
"""
949+
950+
_validation = {
951+
'dimension_name': {'required': True},
952+
'operator': {'required': True},
953+
'values': {'required': True},
954+
}
955+
956+
_attribute_map = {
957+
'dimension_name': {'key': 'DimensionName', 'type': 'str'},
958+
'operator': {'key': 'Operator', 'type': 'str'},
959+
'values': {'key': 'Values', 'type': '[str]'},
960+
}
961+
962+
def __init__(self, **kwargs):
963+
super(ScaleRuleMetricDimension, self).__init__(**kwargs)
964+
self.dimension_name = kwargs.get('dimension_name', None)
965+
self.operator = kwargs.get('operator', None)
966+
self.values = kwargs.get('values', None)
967+
968+
921969
class SenderAuthorization(Model):
922970
"""the authorization used by the user who has performed the operation that led
923971
to this event. This captures the RBAC properties of the event. These

sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models_py3.py

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ class MetricTrigger(Model):
559559
:param metric_name: Required. the name of the metric that defines what the
560560
rule monitors.
561561
:type metric_name: str
562+
:param metric_namespace: the namespace of the metric that defines what the
563+
rule monitors.
564+
:type metric_namespace: str
562565
:param metric_resource_uri: Required. the resource identifier of the
563566
resource the rule monitors.
564567
:type metric_resource_uri: str
@@ -590,6 +593,10 @@ class MetricTrigger(Model):
590593
:param threshold: Required. the threshold of the metric that triggers the
591594
scale action.
592595
:type threshold: float
596+
:param dimensions: List of dimension conditions. For example:
597+
[{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}].
598+
:type dimensions:
599+
list[~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimension]
593600
"""
594601

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

606613
_attribute_map = {
607614
'metric_name': {'key': 'metricName', 'type': 'str'},
615+
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
608616
'metric_resource_uri': {'key': 'metricResourceUri', 'type': 'str'},
609617
'time_grain': {'key': 'timeGrain', 'type': 'duration'},
610618
'statistic': {'key': 'statistic', 'type': 'MetricStatisticType'},
611619
'time_window': {'key': 'timeWindow', 'type': 'duration'},
612620
'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'},
613621
'operator': {'key': 'operator', 'type': 'ComparisonOperationType'},
614622
'threshold': {'key': 'threshold', 'type': 'float'},
623+
'dimensions': {'key': 'dimensions', 'type': '[ScaleRuleMetricDimension]'},
615624
}
616625

617-
def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, statistic, time_window, time_aggregation, operator, threshold: float, **kwargs) -> None:
626+
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:
618627
super(MetricTrigger, self).__init__(**kwargs)
619628
self.metric_name = metric_name
629+
self.metric_namespace = metric_namespace
620630
self.metric_resource_uri = metric_resource_uri
621631
self.time_grain = time_grain
622632
self.statistic = statistic
623633
self.time_window = time_window
624634
self.time_aggregation = time_aggregation
625635
self.operator = operator
626636
self.threshold = threshold
637+
self.dimensions = dimensions
627638

628639

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

920931

932+
class ScaleRuleMetricDimension(Model):
933+
"""Specifies an auto scale rule metric dimension.
934+
935+
All required parameters must be populated in order to send to Azure.
936+
937+
:param dimension_name: Required. Name of the dimension.
938+
:type dimension_name: str
939+
:param operator: Required. the dimension operator. Only 'Equals' and
940+
'NotEquals' are supported. 'Equals' being equal to any of the values.
941+
'NotEquals' being not equal to all of the values. Possible values include:
942+
'Equals', 'NotEquals'
943+
:type operator: str or
944+
~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimensionOperationType
945+
:param values: Required. list of dimension values. For example:
946+
["App1","App2"].
947+
:type values: list[str]
948+
"""
949+
950+
_validation = {
951+
'dimension_name': {'required': True},
952+
'operator': {'required': True},
953+
'values': {'required': True},
954+
}
955+
956+
_attribute_map = {
957+
'dimension_name': {'key': 'DimensionName', 'type': 'str'},
958+
'operator': {'key': 'Operator', 'type': 'str'},
959+
'values': {'key': 'Values', 'type': '[str]'},
960+
}
961+
962+
def __init__(self, *, dimension_name: str, operator, values, **kwargs) -> None:
963+
super(ScaleRuleMetricDimension, self).__init__(**kwargs)
964+
self.dimension_name = dimension_name
965+
self.operator = operator
966+
self.values = values
967+
968+
921969
class SenderAuthorization(Model):
922970
"""the authorization used by the user who has performed the operation that led
923971
to this event. This captures the RBAC properties of the event. These

sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ class ComparisonOperationType(str, Enum):
4949
less_than_or_equal = "LessThanOrEqual"
5050

5151

52+
class ScaleRuleMetricDimensionOperationType(str, Enum):
53+
54+
equals = "Equals"
55+
not_equals = "NotEquals"
56+
57+
5258
class ScaleDirection(str, Enum):
5359

5460
none = "None"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from ._configuration import MonitorManagementClientConfiguration
13+
from ._monitor_management_client import MonitorManagementClient
14+
__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration']
15+
16+
from .version import VERSION
17+
18+
__version__ = VERSION
19+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
from msrestazure import AzureConfiguration
12+
13+
from .version import VERSION
14+
15+
16+
class MonitorManagementClientConfiguration(AzureConfiguration):
17+
"""Configuration for MonitorManagementClient
18+
Note that all parameters used to create this instance are saved as instance
19+
attributes.
20+
21+
:param credentials: Credentials needed for the client to connect to Azure.
22+
:type credentials: :mod:`A msrestazure Credentials
23+
object<msrestazure.azure_active_directory>`
24+
:param str base_url: Service URL
25+
"""
26+
27+
def __init__(
28+
self, credentials, base_url=None):
29+
30+
if credentials is None:
31+
raise ValueError("Parameter 'credentials' must not be None.")
32+
if not base_url:
33+
base_url = 'https://management.azure.com'
34+
35+
super(MonitorManagementClientConfiguration, self).__init__(base_url)
36+
37+
# Starting Autorest.Python 4.0.64, make connection pool activated by default
38+
self.keep_alive = True
39+
40+
self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION))
41+
self.add_user_agent('Azure-SDK-For-Python')
42+
43+
self.credentials = credentials

0 commit comments

Comments
 (0)