From de75206c0234d156d3b92a8f3cc3e65e9bfde3d9 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 13 Mar 2019 16:24:53 -0700 Subject: [PATCH 1/4] Generated from 3ee75a557636de42d727d65142c74ff42b754a67 (#4562) fix package tag for new API version --- .../azure/mgmt/monitor/models/arm_role_receiver.py | 6 ++++++ .../azure/mgmt/monitor/models/arm_role_receiver_py3.py | 8 +++++++- .../mgmt/monitor/models/automation_runbook_receiver.py | 6 ++++++ .../monitor/models/automation_runbook_receiver_py3.py | 8 +++++++- .../azure/mgmt/monitor/models/azure_function_receiver.py | 6 ++++++ .../mgmt/monitor/models/azure_function_receiver_py3.py | 8 +++++++- .../azure/mgmt/monitor/models/email_receiver.py | 6 ++++++ .../azure/mgmt/monitor/models/email_receiver_py3.py | 8 +++++++- .../azure/mgmt/monitor/models/logic_app_receiver.py | 6 ++++++ .../azure/mgmt/monitor/models/logic_app_receiver_py3.py | 8 +++++++- .../azure/mgmt/monitor/models/webhook_receiver.py | 6 ++++++ .../azure/mgmt/monitor/models/webhook_receiver_py3.py | 8 +++++++- .../mgmt/monitor/operations/action_groups_operations.py | 4 ++-- 13 files changed, 80 insertions(+), 8 deletions(-) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/arm_role_receiver.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/arm_role_receiver.py index 809194529d09..8b86662593d9 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/arm_role_receiver.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/arm_role_receiver.py @@ -22,19 +22,25 @@ class ArmRoleReceiver(Model): :type name: str :param role_id: Required. The arm role id. :type role_id: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'role_id': {'required': True}, + 'use_common_alert_schema': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'role_id': {'key': 'roleId', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, } def __init__(self, **kwargs): super(ArmRoleReceiver, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.role_id = kwargs.get('role_id', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/arm_role_receiver_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/arm_role_receiver_py3.py index 2286979546ac..ff2b974d12b4 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/arm_role_receiver_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/arm_role_receiver_py3.py @@ -22,19 +22,25 @@ class ArmRoleReceiver(Model): :type name: str :param role_id: Required. The arm role id. :type role_id: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'role_id': {'required': True}, + 'use_common_alert_schema': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'role_id': {'key': 'roleId', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, } - def __init__(self, *, name: str, role_id: str, **kwargs) -> None: + def __init__(self, *, name: str, role_id: str, use_common_alert_schema: bool, **kwargs) -> None: super(ArmRoleReceiver, self).__init__(**kwargs) self.name = name self.role_id = role_id + self.use_common_alert_schema = use_common_alert_schema diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/automation_runbook_receiver.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/automation_runbook_receiver.py index f7aa0bde67ed..41840c45f7b7 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/automation_runbook_receiver.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/automation_runbook_receiver.py @@ -32,6 +32,9 @@ class AutomationRunbookReceiver(Model): :type name: str :param service_uri: The URI where webhooks should be sent. :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool """ _validation = { @@ -39,6 +42,7 @@ class AutomationRunbookReceiver(Model): 'runbook_name': {'required': True}, 'webhook_resource_id': {'required': True}, 'is_global_runbook': {'required': True}, + 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -48,6 +52,7 @@ class AutomationRunbookReceiver(Model): 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, 'name': {'key': 'name', 'type': 'str'}, 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, } def __init__(self, **kwargs): @@ -58,3 +63,4 @@ def __init__(self, **kwargs): self.is_global_runbook = kwargs.get('is_global_runbook', None) self.name = kwargs.get('name', None) self.service_uri = kwargs.get('service_uri', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/automation_runbook_receiver_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/automation_runbook_receiver_py3.py index 0367cc1eb750..8d85eddd3e5d 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/automation_runbook_receiver_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/automation_runbook_receiver_py3.py @@ -32,6 +32,9 @@ class AutomationRunbookReceiver(Model): :type name: str :param service_uri: The URI where webhooks should be sent. :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool """ _validation = { @@ -39,6 +42,7 @@ class AutomationRunbookReceiver(Model): 'runbook_name': {'required': True}, 'webhook_resource_id': {'required': True}, 'is_global_runbook': {'required': True}, + 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -48,9 +52,10 @@ class AutomationRunbookReceiver(Model): 'is_global_runbook': {'key': 'isGlobalRunbook', 'type': 'bool'}, 'name': {'key': 'name', 'type': 'str'}, 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, } - def __init__(self, *, automation_account_id: str, runbook_name: str, webhook_resource_id: str, is_global_runbook: bool, name: str=None, service_uri: str=None, **kwargs) -> None: + def __init__(self, *, automation_account_id: str, runbook_name: str, webhook_resource_id: str, is_global_runbook: bool, use_common_alert_schema: bool, name: str=None, service_uri: str=None, **kwargs) -> None: super(AutomationRunbookReceiver, self).__init__(**kwargs) self.automation_account_id = automation_account_id self.runbook_name = runbook_name @@ -58,3 +63,4 @@ def __init__(self, *, automation_account_id: str, runbook_name: str, webhook_res self.is_global_runbook = is_global_runbook self.name = name self.service_uri = service_uri + self.use_common_alert_schema = use_common_alert_schema diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver.py index 131ce64379ef..cad1e0ff738b 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver.py @@ -28,6 +28,9 @@ class AzureFunctionReceiver(Model): :param http_trigger_url: Required. The http trigger url where http request sent to. :type http_trigger_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool """ _validation = { @@ -35,6 +38,7 @@ class AzureFunctionReceiver(Model): 'function_app_resource_id': {'required': True}, 'function_name': {'required': True}, 'http_trigger_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -42,6 +46,7 @@ class AzureFunctionReceiver(Model): 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, 'function_name': {'key': 'functionName', 'type': 'str'}, 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, } def __init__(self, **kwargs): @@ -50,3 +55,4 @@ def __init__(self, **kwargs): self.function_app_resource_id = kwargs.get('function_app_resource_id', None) self.function_name = kwargs.get('function_name', None) self.http_trigger_url = kwargs.get('http_trigger_url', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver_py3.py index cc8d10fa6fe2..f5d28c8df177 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver_py3.py @@ -28,6 +28,9 @@ class AzureFunctionReceiver(Model): :param http_trigger_url: Required. The http trigger url where http request sent to. :type http_trigger_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool """ _validation = { @@ -35,6 +38,7 @@ class AzureFunctionReceiver(Model): 'function_app_resource_id': {'required': True}, 'function_name': {'required': True}, 'http_trigger_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -42,11 +46,13 @@ class AzureFunctionReceiver(Model): 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, 'function_name': {'key': 'functionName', 'type': 'str'}, 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, } - def __init__(self, *, name: str, function_app_resource_id: str, function_name: str, http_trigger_url: str, **kwargs) -> None: + def __init__(self, *, name: str, function_app_resource_id: str, function_name: str, http_trigger_url: str, use_common_alert_schema: bool, **kwargs) -> None: super(AzureFunctionReceiver, self).__init__(**kwargs) self.name = name self.function_app_resource_id = function_app_resource_id self.function_name = function_name self.http_trigger_url = http_trigger_url + self.use_common_alert_schema = use_common_alert_schema diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/email_receiver.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/email_receiver.py index 4877d8aea802..1f3bfd600ea8 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/email_receiver.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/email_receiver.py @@ -25,6 +25,9 @@ class EmailReceiver(Model): :type name: str :param email_address: Required. The email address of this receiver. :type email_address: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool :ivar status: The receiver status of the e-mail. Possible values include: 'NotSpecified', 'Enabled', 'Disabled' :vartype status: str or ~azure.mgmt.monitor.models.ReceiverStatus @@ -33,12 +36,14 @@ class EmailReceiver(Model): _validation = { 'name': {'required': True}, 'email_address': {'required': True}, + 'use_common_alert_schema': {'required': True}, 'status': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, 'status': {'key': 'status', 'type': 'ReceiverStatus'}, } @@ -46,4 +51,5 @@ def __init__(self, **kwargs): super(EmailReceiver, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.email_address = kwargs.get('email_address', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) self.status = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/email_receiver_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/email_receiver_py3.py index 1f9c3f03f4a9..00c489387d24 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/email_receiver_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/email_receiver_py3.py @@ -25,6 +25,9 @@ class EmailReceiver(Model): :type name: str :param email_address: Required. The email address of this receiver. :type email_address: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool :ivar status: The receiver status of the e-mail. Possible values include: 'NotSpecified', 'Enabled', 'Disabled' :vartype status: str or ~azure.mgmt.monitor.models.ReceiverStatus @@ -33,17 +36,20 @@ class EmailReceiver(Model): _validation = { 'name': {'required': True}, 'email_address': {'required': True}, + 'use_common_alert_schema': {'required': True}, 'status': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, 'status': {'key': 'status', 'type': 'ReceiverStatus'}, } - def __init__(self, *, name: str, email_address: str, **kwargs) -> None: + def __init__(self, *, name: str, email_address: str, use_common_alert_schema: bool, **kwargs) -> None: super(EmailReceiver, self).__init__(**kwargs) self.name = name self.email_address = email_address + self.use_common_alert_schema = use_common_alert_schema self.status = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver.py index a2072831f0de..56863d601e49 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver.py @@ -26,18 +26,23 @@ class LogicAppReceiver(Model): :param callback_url: Required. The callback url where http request sent to. :type callback_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'resource_id': {'required': True}, 'callback_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, } def __init__(self, **kwargs): @@ -45,3 +50,4 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) self.resource_id = kwargs.get('resource_id', None) self.callback_url = kwargs.get('callback_url', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver_py3.py index cc0e13916d23..6a46bbdaf721 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver_py3.py @@ -26,22 +26,28 @@ class LogicAppReceiver(Model): :param callback_url: Required. The callback url where http request sent to. :type callback_url: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'resource_id': {'required': True}, 'callback_url': {'required': True}, + 'use_common_alert_schema': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, } - def __init__(self, *, name: str, resource_id: str, callback_url: str, **kwargs) -> None: + def __init__(self, *, name: str, resource_id: str, callback_url: str, use_common_alert_schema: bool, **kwargs) -> None: super(LogicAppReceiver, self).__init__(**kwargs) self.name = name self.resource_id = resource_id self.callback_url = callback_url + self.use_common_alert_schema = use_common_alert_schema diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/webhook_receiver.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/webhook_receiver.py index 844b87d1c71d..befb2ced1f54 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/webhook_receiver.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/webhook_receiver.py @@ -22,19 +22,25 @@ class WebhookReceiver(Model): :type name: str :param service_uri: Required. The URI where webhooks should be sent. :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'service_uri': {'required': True}, + 'use_common_alert_schema': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, } def __init__(self, **kwargs): super(WebhookReceiver, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.service_uri = kwargs.get('service_uri', None) + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/webhook_receiver_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/webhook_receiver_py3.py index a59a4f291f5e..1fed4f83053b 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/webhook_receiver_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/webhook_receiver_py3.py @@ -22,19 +22,25 @@ class WebhookReceiver(Model): :type name: str :param service_uri: Required. The URI where webhooks should be sent. :type service_uri: str + :param use_common_alert_schema: Required. Indicates whether to use common + alert schema. + :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'service_uri': {'required': True}, + 'use_common_alert_schema': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'use_common_alert_schema': {'key': 'useCommonAlertSchema', 'type': 'bool'}, } - def __init__(self, *, name: str, service_uri: str, **kwargs) -> None: + def __init__(self, *, name: str, service_uri: str, use_common_alert_schema: bool, **kwargs) -> None: super(WebhookReceiver, self).__init__(**kwargs) self.name = name self.service_uri = service_uri + self.use_common_alert_schema = use_common_alert_schema diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/action_groups_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/action_groups_operations.py index 97856627795d..6029227c4e4a 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/action_groups_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/action_groups_operations.py @@ -22,7 +22,7 @@ class ActionGroupsOperations(object): :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: "2018-09-01". + :ivar api_version: Client Api Version. Constant value: "2019-03-01". """ models = models @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-09-01" + self.api_version = "2019-03-01" self.config = config From 7beac36fac20df84a24c95fa46488be4757ac556 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 2 Apr 2019 14:25:43 -0700 Subject: [PATCH 2/4] Generated from d33c2e897124c07ae2896600c2215ae3717e74ba (#4670) #5326 Fix the criteria definition --- .../azure/mgmt/monitor/models/log_to_metric_action.py | 6 +++--- .../azure/mgmt/monitor/models/log_to_metric_action_py3.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) 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: From c7d9ffb80b3813a2481beac632c21afad967ecb4 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 11 Apr 2019 13:39:48 -0700 Subject: [PATCH 3/4] [AutoPR monitor/resource-manager] Added metrics baseline API (#4714) * Generated from c4e0f53de1a68b65271c9b57f17a84b45de4c0e2 Added metrics baseline API * Generated from ea28e828ee83119a547a48612f0128a600e08b94 Remove readonly * Generated from 589bb435ca13dd72fba86b13ccdee09b497b6a74 Updated model name * Generated from b12b3ca38498ff10b3e71239dc65f22b6df8e7da Renamed operation of older baseline apis * Generated from 3ef9b2fe8cda4fdc26d59705e2a195bc98a68f61 Reverted braking change, updated new API to List * Generated from c0b3744bf0287e8b37cae1a334da68795189e8ae Updated operation * Generated from a1ffa46de27615eaf1f2e06637c834fab28584db Changed the name of the enum * Packaging update of azure-mgmt-monitor --- .../azure/mgmt/monitor/models/__init__.py | 19 +++ .../mgmt/monitor/models/baseline_metadata.py | 39 +++++ .../monitor/models/baseline_metadata_py3.py | 39 +++++ .../monitor/models/metric_single_dimension.py | 39 +++++ .../models/metric_single_dimension_py3.py | 39 +++++ .../models/monitor_management_client_enums.py | 7 + .../mgmt/monitor/models/single_baseline.py | 45 ++++++ .../monitor/models/single_baseline_py3.py | 45 ++++++ .../monitor/models/single_metric_baseline.py | 71 +++++++++ .../models/single_metric_baseline_paged.py | 27 ++++ .../models/single_metric_baseline_py3.py | 71 +++++++++ .../monitor/models/time_series_baseline.py | 52 ++++++ .../models/time_series_baseline_py3.py | 52 ++++++ .../mgmt/monitor/monitor_management_client.py | 5 + .../azure/mgmt/monitor/operations/__init__.py | 2 + .../operations/baselines_operations.py | 150 ++++++++++++++++++ azure-mgmt-monitor/setup.py | 1 + 17 files changed, 703 insertions(+) create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/baseline_metadata.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/baseline_metadata_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_single_dimension.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_single_dimension_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/single_baseline.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/single_baseline_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline_paged.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/single_metric_baseline_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/time_series_baseline.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/time_series_baseline_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/operations/baselines_operations.py 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/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', From 56845700cccd954fce4bf36d757d5e6fdf10f63c Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 30 Apr 2019 11:43:30 -0700 Subject: [PATCH 4/4] [AutoPR monitor/resource-manager] Add dynamic metric alert api (#4896) * Generated from 74bb59c05d38452155d9af98a26da148d796c581 Rename microsoft.insight * Generated from 1f7739776b7592e12bef8e4be6cf24d68e0f25da Update dynamic threshold criteria descriptions * Generated from 31ef899f35bb54b58b5c01a849f4f4710000c5e5 Fix PR comments: Revert name change + Use fake subscriptionId --- .../azure/mgmt/monitor/models/__init__.py | 12 ++- .../monitor/models/dynamic_metric_criteria.py | 83 +++++++++++++++++++ .../models/dynamic_metric_criteria_py3.py | 83 +++++++++++++++++++ .../dynamic_threshold_failing_periods.py | 44 ++++++++++ .../dynamic_threshold_failing_periods_py3.py | 44 ++++++++++ .../mgmt/monitor/models/metric_criteria.py | 27 +++--- .../monitor/models/metric_criteria_py3.py | 31 +++---- .../monitor/models/multi_metric_criteria.py | 27 +++++- .../models/multi_metric_criteria_py3.py | 29 ++++++- 9 files changed, 338 insertions(+), 42 deletions(-) create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_metric_criteria.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_metric_criteria_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_threshold_failing_periods.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_threshold_failing_periods_py3.py diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py index 2e0e28c930b6..0e8040be7c8f 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py @@ -100,11 +100,13 @@ from .metric_alert_status_properties_py3 import MetricAlertStatusProperties from .metric_alert_status_py3 import MetricAlertStatus from .metric_alert_status_collection_py3 import MetricAlertStatusCollection - from .metric_dimension_py3 import MetricDimension from .metric_criteria_py3 import MetricCriteria from .metric_alert_single_resource_multiple_metric_criteria_py3 import MetricAlertSingleResourceMultipleMetricCriteria + from .metric_dimension_py3 import MetricDimension from .multi_metric_criteria_py3 import MultiMetricCriteria from .metric_alert_multiple_resource_multiple_metric_criteria_py3 import MetricAlertMultipleResourceMultipleMetricCriteria + from .dynamic_threshold_failing_periods_py3 import DynamicThresholdFailingPeriods + from .dynamic_metric_criteria_py3 import DynamicMetricCriteria from .source_py3 import Source from .schedule_py3 import Schedule from .action_py3 import Action @@ -216,11 +218,13 @@ from .metric_alert_status_properties import MetricAlertStatusProperties from .metric_alert_status import MetricAlertStatus from .metric_alert_status_collection import MetricAlertStatusCollection - from .metric_dimension import MetricDimension from .metric_criteria import MetricCriteria from .metric_alert_single_resource_multiple_metric_criteria import MetricAlertSingleResourceMultipleMetricCriteria + from .metric_dimension import MetricDimension from .multi_metric_criteria import MultiMetricCriteria from .metric_alert_multiple_resource_multiple_metric_criteria import MetricAlertMultipleResourceMultipleMetricCriteria + from .dynamic_threshold_failing_periods import DynamicThresholdFailingPeriods + from .dynamic_metric_criteria import DynamicMetricCriteria from .source import Source from .schedule import Schedule from .action import Action @@ -372,11 +376,13 @@ 'MetricAlertStatusProperties', 'MetricAlertStatus', 'MetricAlertStatusCollection', - 'MetricDimension', 'MetricCriteria', 'MetricAlertSingleResourceMultipleMetricCriteria', + 'MetricDimension', 'MultiMetricCriteria', 'MetricAlertMultipleResourceMultipleMetricCriteria', + 'DynamicThresholdFailingPeriods', + 'DynamicMetricCriteria', 'Source', 'Schedule', 'Action', diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_metric_criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_metric_criteria.py new file mode 100644 index 000000000000..9608b7ae26b1 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_metric_criteria.py @@ -0,0 +1,83 @@ +# 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 .multi_metric_criteria import MultiMetricCriteria + + +class DynamicMetricCriteria(MultiMetricCriteria): + """Criterion for dynamic threshold. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param name: Required. Name of the criteria. + :type name: str + :param metric_name: Required. Name of the metric. + :type metric_name: str + :param metric_namespace: Namespace of the metric. + :type metric_namespace: str + :param time_aggregation: Required. the criteria time aggregation types. + :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: list[~azure.mgmt.monitor.models.MetricDimension] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + :param operator: Required. The operator used to compare the metric value + against the threshold. + :type operator: object + :param alert_sensitivity: Required. The extent of deviation required to + trigger an alert. This will affect how tight the threshold is to the + metric series pattern. + :type alert_sensitivity: object + :param failing_periods: Required. The minimum number of violations + required within the selected lookback time window required to raise an + alert. + :type failing_periods: + ~azure.mgmt.monitor.models.DynamicThresholdFailingPeriods + :param ignore_data_before: Use this option to set the date from which to + start learning the metric historical data and calculate the dynamic + thresholds (in ISO8601 format) + :type ignore_data_before: datetime + """ + + _validation = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'time_aggregation': {'required': True}, + 'criterion_type': {'required': True}, + 'operator': {'required': True}, + 'alert_sensitivity': {'required': True}, + 'failing_periods': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'object'}, + 'alert_sensitivity': {'key': 'alertSensitivity', 'type': 'object'}, + 'failing_periods': {'key': 'failingPeriods', 'type': 'DynamicThresholdFailingPeriods'}, + 'ignore_data_before': {'key': 'ignoreDataBefore', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(DynamicMetricCriteria, self).__init__(**kwargs) + self.operator = kwargs.get('operator', None) + self.alert_sensitivity = kwargs.get('alert_sensitivity', None) + self.failing_periods = kwargs.get('failing_periods', None) + self.ignore_data_before = kwargs.get('ignore_data_before', None) + self.criterion_type = 'DynamicThresholdCriterion' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_metric_criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_metric_criteria_py3.py new file mode 100644 index 000000000000..4ceee195c47f --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_metric_criteria_py3.py @@ -0,0 +1,83 @@ +# 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 .multi_metric_criteria_py3 import MultiMetricCriteria + + +class DynamicMetricCriteria(MultiMetricCriteria): + """Criterion for dynamic threshold. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param name: Required. Name of the criteria. + :type name: str + :param metric_name: Required. Name of the metric. + :type metric_name: str + :param metric_namespace: Namespace of the metric. + :type metric_namespace: str + :param time_aggregation: Required. the criteria time aggregation types. + :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: list[~azure.mgmt.monitor.models.MetricDimension] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + :param operator: Required. The operator used to compare the metric value + against the threshold. + :type operator: object + :param alert_sensitivity: Required. The extent of deviation required to + trigger an alert. This will affect how tight the threshold is to the + metric series pattern. + :type alert_sensitivity: object + :param failing_periods: Required. The minimum number of violations + required within the selected lookback time window required to raise an + alert. + :type failing_periods: + ~azure.mgmt.monitor.models.DynamicThresholdFailingPeriods + :param ignore_data_before: Use this option to set the date from which to + start learning the metric historical data and calculate the dynamic + thresholds (in ISO8601 format) + :type ignore_data_before: datetime + """ + + _validation = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'time_aggregation': {'required': True}, + 'criterion_type': {'required': True}, + 'operator': {'required': True}, + 'alert_sensitivity': {'required': True}, + 'failing_periods': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'object'}, + 'alert_sensitivity': {'key': 'alertSensitivity', 'type': 'object'}, + '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) + self.operator = operator + self.alert_sensitivity = alert_sensitivity + self.failing_periods = failing_periods + self.ignore_data_before = ignore_data_before + self.criterion_type = 'DynamicThresholdCriterion' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_threshold_failing_periods.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_threshold_failing_periods.py new file mode 100644 index 000000000000..b3980af78497 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_threshold_failing_periods.py @@ -0,0 +1,44 @@ +# 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 DynamicThresholdFailingPeriods(Model): + """The minimum number of violations required within the selected lookback time + window required to raise an alert. + + All required parameters must be populated in order to send to Azure. + + :param number_of_evaluation_periods: Required. The number of aggregated + lookback points. The lookback time window is calculated based on the + aggregation granularity (windowSize) and the selected number of aggregated + points. + :type number_of_evaluation_periods: float + :param min_failing_periods_to_alert: Required. The number of violations to + trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. + :type min_failing_periods_to_alert: float + """ + + _validation = { + 'number_of_evaluation_periods': {'required': True}, + 'min_failing_periods_to_alert': {'required': True}, + } + + _attribute_map = { + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'float'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(DynamicThresholdFailingPeriods, self).__init__(**kwargs) + self.number_of_evaluation_periods = kwargs.get('number_of_evaluation_periods', None) + self.min_failing_periods_to_alert = kwargs.get('min_failing_periods_to_alert', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_threshold_failing_periods_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_threshold_failing_periods_py3.py new file mode 100644 index 000000000000..249e9f4782f8 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/dynamic_threshold_failing_periods_py3.py @@ -0,0 +1,44 @@ +# 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 DynamicThresholdFailingPeriods(Model): + """The minimum number of violations required within the selected lookback time + window required to raise an alert. + + All required parameters must be populated in order to send to Azure. + + :param number_of_evaluation_periods: Required. The number of aggregated + lookback points. The lookback time window is calculated based on the + aggregation granularity (windowSize) and the selected number of aggregated + points. + :type number_of_evaluation_periods: float + :param min_failing_periods_to_alert: Required. The number of violations to + trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. + :type min_failing_periods_to_alert: float + """ + + _validation = { + 'number_of_evaluation_periods': {'required': True}, + 'min_failing_periods_to_alert': {'required': True}, + } + + _attribute_map = { + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'float'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'float'}, + } + + def __init__(self, *, number_of_evaluation_periods: float, min_failing_periods_to_alert: float, **kwargs) -> None: + super(DynamicThresholdFailingPeriods, self).__init__(**kwargs) + self.number_of_evaluation_periods = number_of_evaluation_periods + self.min_failing_periods_to_alert = min_failing_periods_to_alert diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py index 726e08b77eef..aff905946ee3 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py @@ -20,53 +20,48 @@ class MetricCriteria(MultiMetricCriteria): :param additional_properties: Unmatched properties from the message are deserialized this collection :type additional_properties: dict[str, object] - :param criterion_type: Required. Constant filled by server. - :type criterion_type: str :param name: Required. Name of the criteria. :type name: str :param metric_name: Required. Name of the metric. :type metric_name: str :param metric_namespace: Namespace of the metric. :type metric_namespace: str - :param operator: Required. the criteria operator. - :type operator: object :param time_aggregation: Required. the criteria time aggregation types. :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: list[~azure.mgmt.monitor.models.MetricDimension] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + :param operator: Required. the criteria operator. + :type operator: object :param threshold: Required. the criteria threshold value that activates the alert. :type threshold: float - :param dimensions: List of dimension conditions. - :type dimensions: list[~azure.mgmt.monitor.models.MetricDimension] """ _validation = { - 'criterion_type': {'required': True}, 'name': {'required': True}, 'metric_name': {'required': True}, - 'operator': {'required': True}, 'time_aggregation': {'required': True}, + 'criterion_type': {'required': True}, + 'operator': {'required': True}, 'threshold': {'required': True}, } _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, - 'criterion_type': {'key': 'criterionType', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'metric_name': {'key': 'metricName', 'type': 'str'}, 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'object'}, 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, - 'threshold': {'key': 'threshold', 'type': 'float'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'object'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, } def __init__(self, **kwargs): super(MetricCriteria, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.metric_name = kwargs.get('metric_name', None) - self.metric_namespace = kwargs.get('metric_namespace', None) self.operator = kwargs.get('operator', None) - self.time_aggregation = kwargs.get('time_aggregation', None) self.threshold = kwargs.get('threshold', None) - self.dimensions = kwargs.get('dimensions', None) self.criterion_type = 'StaticThresholdCriterion' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria_py3.py index 7b0a1edc9dbb..86029593f200 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria_py3.py @@ -20,53 +20,48 @@ class MetricCriteria(MultiMetricCriteria): :param additional_properties: Unmatched properties from the message are deserialized this collection :type additional_properties: dict[str, object] - :param criterion_type: Required. Constant filled by server. - :type criterion_type: str :param name: Required. Name of the criteria. :type name: str :param metric_name: Required. Name of the metric. :type metric_name: str :param metric_namespace: Namespace of the metric. :type metric_namespace: str - :param operator: Required. the criteria operator. - :type operator: object :param time_aggregation: Required. the criteria time aggregation types. :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: list[~azure.mgmt.monitor.models.MetricDimension] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + :param operator: Required. the criteria operator. + :type operator: object :param threshold: Required. the criteria threshold value that activates the alert. :type threshold: float - :param dimensions: List of dimension conditions. - :type dimensions: list[~azure.mgmt.monitor.models.MetricDimension] """ _validation = { - 'criterion_type': {'required': True}, 'name': {'required': True}, 'metric_name': {'required': True}, - 'operator': {'required': True}, 'time_aggregation': {'required': True}, + 'criterion_type': {'required': True}, + 'operator': {'required': True}, 'threshold': {'required': True}, } _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, - 'criterion_type': {'key': 'criterionType', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'metric_name': {'key': 'metricName', 'type': 'str'}, 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'object'}, 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, - 'threshold': {'key': 'threshold', 'type': 'float'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'object'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, } - def __init__(self, *, name: str, metric_name: str, operator, time_aggregation, threshold: float, additional_properties=None, metric_namespace: str=None, dimensions=None, **kwargs) -> None: - super(MetricCriteria, self).__init__(additional_properties=additional_properties, **kwargs) - self.name = name - self.metric_name = metric_name - self.metric_namespace = metric_namespace + 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) self.operator = operator - self.time_aggregation = time_aggregation self.threshold = threshold - self.dimensions = dimensions self.criterion_type = 'StaticThresholdCriterion' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria.py index 03c567924a33..1547f135843c 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria.py @@ -16,31 +16,54 @@ class MultiMetricCriteria(Model): """The types of conditions for a multi resource alert. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MetricCriteria + sub-classes are: MetricCriteria, DynamicMetricCriteria All required parameters must be populated in order to send to Azure. :param additional_properties: Unmatched properties from the message are deserialized this collection :type additional_properties: dict[str, object] + :param name: Required. Name of the criteria. + :type name: str + :param metric_name: Required. Name of the metric. + :type metric_name: str + :param metric_namespace: Namespace of the metric. + :type metric_namespace: str + :param time_aggregation: Required. the criteria time aggregation types. + :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: list[~azure.mgmt.monitor.models.MetricDimension] :param criterion_type: Required. Constant filled by server. :type criterion_type: str """ _validation = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'time_aggregation': {'required': True}, 'criterion_type': {'required': True}, } _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, 'criterion_type': {'key': 'criterionType', 'type': 'str'}, } _subtype_map = { - 'criterion_type': {'StaticThresholdCriterion': 'MetricCriteria'} + 'criterion_type': {'StaticThresholdCriterion': 'MetricCriteria', 'DynamicThresholdCriterion': 'DynamicMetricCriteria'} } def __init__(self, **kwargs): super(MultiMetricCriteria, self).__init__(**kwargs) self.additional_properties = kwargs.get('additional_properties', None) + self.name = kwargs.get('name', None) + self.metric_name = kwargs.get('metric_name', None) + self.metric_namespace = kwargs.get('metric_namespace', None) + self.time_aggregation = kwargs.get('time_aggregation', None) + self.dimensions = kwargs.get('dimensions', None) self.criterion_type = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria_py3.py index 20c983aab667..d168ae9c3949 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria_py3.py @@ -16,31 +16,54 @@ class MultiMetricCriteria(Model): """The types of conditions for a multi resource alert. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MetricCriteria + sub-classes are: MetricCriteria, DynamicMetricCriteria All required parameters must be populated in order to send to Azure. :param additional_properties: Unmatched properties from the message are deserialized this collection :type additional_properties: dict[str, object] + :param name: Required. Name of the criteria. + :type name: str + :param metric_name: Required. Name of the metric. + :type metric_name: str + :param metric_namespace: Namespace of the metric. + :type metric_namespace: str + :param time_aggregation: Required. the criteria time aggregation types. + :type time_aggregation: object + :param dimensions: List of dimension conditions. + :type dimensions: list[~azure.mgmt.monitor.models.MetricDimension] :param criterion_type: Required. Constant filled by server. :type criterion_type: str """ _validation = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'time_aggregation': {'required': True}, 'criterion_type': {'required': True}, } _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, 'criterion_type': {'key': 'criterionType', 'type': 'str'}, } _subtype_map = { - 'criterion_type': {'StaticThresholdCriterion': 'MetricCriteria'} + 'criterion_type': {'StaticThresholdCriterion': 'MetricCriteria', 'DynamicThresholdCriterion': 'DynamicMetricCriteria'} } - def __init__(self, *, additional_properties=None, **kwargs) -> None: + def __init__(self, *, name: str, metric_name: str, time_aggregation, additional_properties=None, metric_namespace: str=None, dimensions=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.criterion_type = None