diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py index f0a59de93e28..50353acdcea3 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py @@ -59,6 +59,9 @@ from .itsm_receiver_py3 import ItsmReceiver from .azure_app_push_receiver_py3 import AzureAppPushReceiver from .automation_runbook_receiver_py3 import AutomationRunbookReceiver + from .voice_receiver_py3 import VoiceReceiver + from .logic_app_receiver_py3 import LogicAppReceiver + from .azure_function_receiver_py3 import AzureFunctionReceiver from .action_group_resource_py3 import ActionGroupResource from .enable_request_py3 import EnableRequest from .action_group_patch_body_py3 import ActionGroupPatchBody @@ -84,6 +87,22 @@ from .baseline_response_py3 import BaselineResponse from .time_series_information_py3 import TimeSeriesInformation from .calculate_baseline_response_py3 import CalculateBaselineResponse + from .action_py3 import Action + from .metric_alert_criteria_py3 import MetricAlertCriteria + from .metric_alert_resource_py3 import MetricAlertResource + from .metric_alert_resource_patch_py3 import MetricAlertResourcePatch + 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 .source_py3 import Source + from .schedule_py3 import Schedule + from .log_search_rule_resource_py3 import LogSearchRuleResource + from .trigger_condition_py3 import TriggerCondition + from .az_ns_action_group_py3 import AzNsActionGroup + from .alerting_action_py3 import AlertingAction except (SyntaxError, ImportError): from .resource import Resource from .scale_capacity import ScaleCapacity @@ -134,6 +153,9 @@ from .itsm_receiver import ItsmReceiver from .azure_app_push_receiver import AzureAppPushReceiver from .automation_runbook_receiver import AutomationRunbookReceiver + from .voice_receiver import VoiceReceiver + from .logic_app_receiver import LogicAppReceiver + from .azure_function_receiver import AzureFunctionReceiver from .action_group_resource import ActionGroupResource from .enable_request import EnableRequest from .action_group_patch_body import ActionGroupPatchBody @@ -159,6 +181,22 @@ from .baseline_response import BaselineResponse from .time_series_information import TimeSeriesInformation from .calculate_baseline_response import CalculateBaselineResponse + from .action import Action + from .metric_alert_criteria import MetricAlertCriteria + from .metric_alert_resource import MetricAlertResource + from .metric_alert_resource_patch import MetricAlertResourcePatch + 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 .source import Source + from .schedule import Schedule + from .log_search_rule_resource import LogSearchRuleResource + from .trigger_condition import TriggerCondition + from .az_ns_action_group import AzNsActionGroup + from .alerting_action import AlertingAction from .autoscale_setting_resource_paged import AutoscaleSettingResourcePaged from .incident_paged import IncidentPaged from .alert_rule_resource_paged import AlertRuleResourcePaged @@ -168,10 +206,14 @@ from .event_data_paged import EventDataPaged from .localizable_string_paged import LocalizableStringPaged from .metric_definition_paged import MetricDefinitionPaged +from .metric_alert_resource_paged import MetricAlertResourcePaged +from .log_search_rule_resource_paged import LogSearchRuleResourcePaged from .monitor_management_client_enums import ( MetricStatisticType, TimeAggregationType, ComparisonOperationType, + ConditionalOperator, + MetricTriggerType, ScaleDirection, ScaleType, RecurrenceFrequency, @@ -183,6 +225,10 @@ Unit, AggregationType, Sensitivity, + Enabled, + ProvisioningState, + QueryType, + AlertSeverity, ResultType, ) @@ -236,6 +282,9 @@ 'ItsmReceiver', 'AzureAppPushReceiver', 'AutomationRunbookReceiver', + 'VoiceReceiver', + 'LogicAppReceiver', + 'AzureFunctionReceiver', 'ActionGroupResource', 'EnableRequest', 'ActionGroupPatchBody', @@ -261,6 +310,22 @@ 'BaselineResponse', 'TimeSeriesInformation', 'CalculateBaselineResponse', + 'Action', + 'MetricAlertCriteria', + 'MetricAlertResource', + 'MetricAlertResourcePatch', + 'MetricAlertStatusProperties', + 'MetricAlertStatus', + 'MetricAlertStatusCollection', + 'MetricDimension', + 'MetricCriteria', + 'MetricAlertSingleResourceMultipleMetricCriteria', + 'Source', + 'Schedule', + 'LogSearchRuleResource', + 'TriggerCondition', + 'AzNsActionGroup', + 'AlertingAction', 'AutoscaleSettingResourcePaged', 'IncidentPaged', 'AlertRuleResourcePaged', @@ -270,9 +335,13 @@ 'EventDataPaged', 'LocalizableStringPaged', 'MetricDefinitionPaged', + 'MetricAlertResourcePaged', + 'LogSearchRuleResourcePaged', 'MetricStatisticType', 'TimeAggregationType', 'ComparisonOperationType', + 'ConditionalOperator', + 'MetricTriggerType', 'ScaleDirection', 'ScaleType', 'RecurrenceFrequency', @@ -284,5 +353,9 @@ 'Unit', 'AggregationType', 'Sensitivity', + 'Enabled', + 'ProvisioningState', + 'QueryType', + 'AlertSeverity', 'ResultType', ] diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py new file mode 100644 index 000000000000..dcb773260063 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py @@ -0,0 +1,49 @@ +# 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 Action(Model): + """An alert action. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AlertingAction + + All required parameters must be populated in order to send to Azure. + + :param action_group_id: the id of the action group to use. + :type action_group_id: str + :param webhook_properties: + :type webhook_properties: dict[str, str] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction'} + } + + def __init__(self, **kwargs): + super(Action, self).__init__(**kwargs) + self.action_group_id = kwargs.get('action_group_id', None) + self.webhook_properties = kwargs.get('webhook_properties', None) + self.odatatype = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py index 4cdf16d25a2d..2feb3268a1df 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py @@ -57,6 +57,17 @@ class ActionGroupResource(Resource): receivers that are part of this action group. :type automation_runbook_receivers: list[~azure.mgmt.monitor.models.AutomationRunbookReceiver] + :param voice_receivers: The list of voice receivers that are part of this + action group. + :type voice_receivers: list[~azure.mgmt.monitor.models.VoiceReceiver] + :param logic_app_receivers: The list of logic app receivers that are part + of this action group. + :type logic_app_receivers: + list[~azure.mgmt.monitor.models.LogicAppReceiver] + :param azure_function_receivers: The list of azure function receivers that + are part of this action group. + :type azure_function_receivers: + list[~azure.mgmt.monitor.models.AzureFunctionReceiver] """ _validation = { @@ -82,6 +93,9 @@ class ActionGroupResource(Resource): 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + 'voice_receivers': {'key': 'properties.voiceReceivers', 'type': '[VoiceReceiver]'}, + 'logic_app_receivers': {'key': 'properties.logicAppReceivers', 'type': '[LogicAppReceiver]'}, + 'azure_function_receivers': {'key': 'properties.azureFunctionReceivers', 'type': '[AzureFunctionReceiver]'}, } def __init__(self, **kwargs): @@ -94,3 +108,6 @@ def __init__(self, **kwargs): self.itsm_receivers = kwargs.get('itsm_receivers', None) self.azure_app_push_receivers = kwargs.get('azure_app_push_receivers', None) self.automation_runbook_receivers = kwargs.get('automation_runbook_receivers', None) + self.voice_receivers = kwargs.get('voice_receivers', None) + self.logic_app_receivers = kwargs.get('logic_app_receivers', None) + self.azure_function_receivers = kwargs.get('azure_function_receivers', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py index fdd6a95d4f1a..d65569ab6cb7 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py @@ -57,6 +57,17 @@ class ActionGroupResource(Resource): receivers that are part of this action group. :type automation_runbook_receivers: list[~azure.mgmt.monitor.models.AutomationRunbookReceiver] + :param voice_receivers: The list of voice receivers that are part of this + action group. + :type voice_receivers: list[~azure.mgmt.monitor.models.VoiceReceiver] + :param logic_app_receivers: The list of logic app receivers that are part + of this action group. + :type logic_app_receivers: + list[~azure.mgmt.monitor.models.LogicAppReceiver] + :param azure_function_receivers: The list of azure function receivers that + are part of this action group. + :type azure_function_receivers: + list[~azure.mgmt.monitor.models.AzureFunctionReceiver] """ _validation = { @@ -82,9 +93,12 @@ class ActionGroupResource(Resource): 'itsm_receivers': {'key': 'properties.itsmReceivers', 'type': '[ItsmReceiver]'}, 'azure_app_push_receivers': {'key': 'properties.azureAppPushReceivers', 'type': '[AzureAppPushReceiver]'}, 'automation_runbook_receivers': {'key': 'properties.automationRunbookReceivers', 'type': '[AutomationRunbookReceiver]'}, + 'voice_receivers': {'key': 'properties.voiceReceivers', 'type': '[VoiceReceiver]'}, + 'logic_app_receivers': {'key': 'properties.logicAppReceivers', 'type': '[LogicAppReceiver]'}, + 'azure_function_receivers': {'key': 'properties.azureFunctionReceivers', 'type': '[AzureFunctionReceiver]'}, } - def __init__(self, *, location: str, group_short_name: str, tags=None, enabled: bool=True, email_receivers=None, sms_receivers=None, webhook_receivers=None, itsm_receivers=None, azure_app_push_receivers=None, automation_runbook_receivers=None, **kwargs) -> None: + def __init__(self, *, location: str, group_short_name: str, tags=None, enabled: bool=True, email_receivers=None, sms_receivers=None, webhook_receivers=None, itsm_receivers=None, azure_app_push_receivers=None, automation_runbook_receivers=None, voice_receivers=None, logic_app_receivers=None, azure_function_receivers=None, **kwargs) -> None: super(ActionGroupResource, self).__init__(location=location, tags=tags, **kwargs) self.group_short_name = group_short_name self.enabled = enabled @@ -94,3 +108,6 @@ def __init__(self, *, location: str, group_short_name: str, tags=None, enabled: self.itsm_receivers = itsm_receivers self.azure_app_push_receivers = azure_app_push_receivers self.automation_runbook_receivers = automation_runbook_receivers + self.voice_receivers = voice_receivers + self.logic_app_receivers = logic_app_receivers + self.azure_function_receivers = azure_function_receivers diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py new file mode 100644 index 000000000000..8f20cdeaafe4 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py @@ -0,0 +1,49 @@ +# 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 Action(Model): + """An alert action. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AlertingAction + + All required parameters must be populated in order to send to Azure. + + :param action_group_id: the id of the action group to use. + :type action_group_id: str + :param webhook_properties: + :type webhook_properties: dict[str, str] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction'} + } + + def __init__(self, *, action_group_id: str=None, webhook_properties=None, **kwargs) -> None: + super(Action, self).__init__(**kwargs) + self.action_group_id = action_group_id + self.webhook_properties = webhook_properties + self.odatatype = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py new file mode 100644 index 000000000000..462b180d180f --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py @@ -0,0 +1,62 @@ +# 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 .action import Action + + +class AlertingAction(Action): + """Specifiy action need to be taken when rule type is Alert. + + All required parameters must be populated in order to send to Azure. + + :param action_group_id: the id of the action group to use. + :type action_group_id: str + :param webhook_properties: + :type webhook_properties: dict[str, str] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param severity: Required. Severity of the alert. Possible values include: + '0', '1', '2', '3', '4' + :type severity: str or ~azure.mgmt.monitor.models.AlertSeverity + :param azns_action: Required. azns notification group reference. + :type azns_action: ~azure.mgmt.monitor.models.AzNsActionGroup + :param throttling_in_min: time (in minutes) for which Alerts should be + throttled + :type throttling_in_min: int + :param trigger: Required. The trigger condition that results in the alert + rule being. + :type trigger: ~azure.mgmt.monitor.models.TriggerCondition + """ + + _validation = { + 'odatatype': {'required': True}, + 'severity': {'required': True}, + 'azns_action': {'required': True}, + 'trigger': {'required': True}, + } + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'azns_action': {'key': 'aznsAction', 'type': 'AzNsActionGroup'}, + 'throttling_in_min': {'key': 'throttlingInMin', 'type': 'int'}, + 'trigger': {'key': 'trigger', 'type': 'TriggerCondition'}, + } + + def __init__(self, **kwargs): + super(AlertingAction, self).__init__(**kwargs) + self.severity = kwargs.get('severity', None) + self.azns_action = kwargs.get('azns_action', None) + self.throttling_in_min = kwargs.get('throttling_in_min', None) + self.trigger = kwargs.get('trigger', None) + self.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py new file mode 100644 index 000000000000..601f9cde528b --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py @@ -0,0 +1,62 @@ +# 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 .action import Action + + +class AlertingAction(Action): + """Specifiy action need to be taken when rule type is Alert. + + All required parameters must be populated in order to send to Azure. + + :param action_group_id: the id of the action group to use. + :type action_group_id: str + :param webhook_properties: + :type webhook_properties: dict[str, str] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param severity: Required. Severity of the alert. Possible values include: + '0', '1', '2', '3', '4' + :type severity: str or ~azure.mgmt.monitor.models.AlertSeverity + :param azns_action: Required. azns notification group reference. + :type azns_action: ~azure.mgmt.monitor.models.AzNsActionGroup + :param throttling_in_min: time (in minutes) for which Alerts should be + throttled + :type throttling_in_min: int + :param trigger: Required. The trigger condition that results in the alert + rule being. + :type trigger: ~azure.mgmt.monitor.models.TriggerCondition + """ + + _validation = { + 'odatatype': {'required': True}, + 'severity': {'required': True}, + 'azns_action': {'required': True}, + 'trigger': {'required': True}, + } + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'azns_action': {'key': 'aznsAction', 'type': 'AzNsActionGroup'}, + 'throttling_in_min': {'key': 'throttlingInMin', 'type': 'int'}, + 'trigger': {'key': 'trigger', 'type': 'TriggerCondition'}, + } + + def __init__(self, *, severity, azns_action, trigger, action_group_id: str=None, webhook_properties=None, throttling_in_min: int=None, **kwargs) -> None: + super(AlertingAction, self).__init__(action_group_id=action_group_id, webhook_properties=webhook_properties, **kwargs) + self.severity = severity + self.azns_action = azns_action + self.throttling_in_min = throttling_in_min + self.trigger = trigger + self.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group.py new file mode 100644 index 000000000000..5c5576517664 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group.py @@ -0,0 +1,37 @@ +# 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 AzNsActionGroup(Model): + """azns notification group. + + :param action_group: Azure Group reference. + :type action_group: list[str] + :param email_subject: Custom subject for Azns email + :type email_subject: str + :param custom_webhook_payload: Custom webhook payload to be send to azns + action group + :type custom_webhook_payload: str + """ + + _attribute_map = { + 'action_group': {'key': 'actionGroup', 'type': '[str]'}, + 'email_subject': {'key': 'emailSubject', 'type': 'str'}, + 'custom_webhook_payload': {'key': 'customWebhookPayload', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzNsActionGroup, self).__init__(**kwargs) + self.action_group = kwargs.get('action_group', None) + self.email_subject = kwargs.get('email_subject', None) + self.custom_webhook_payload = kwargs.get('custom_webhook_payload', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group_py3.py new file mode 100644 index 000000000000..bd5f281ea775 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group_py3.py @@ -0,0 +1,37 @@ +# 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 AzNsActionGroup(Model): + """azns notification group. + + :param action_group: Azure Group reference. + :type action_group: list[str] + :param email_subject: Custom subject for Azns email + :type email_subject: str + :param custom_webhook_payload: Custom webhook payload to be send to azns + action group + :type custom_webhook_payload: str + """ + + _attribute_map = { + 'action_group': {'key': 'actionGroup', 'type': '[str]'}, + 'email_subject': {'key': 'emailSubject', 'type': 'str'}, + 'custom_webhook_payload': {'key': 'customWebhookPayload', 'type': 'str'}, + } + + def __init__(self, *, action_group=None, email_subject: str=None, custom_webhook_payload: str=None, **kwargs) -> None: + super(AzNsActionGroup, self).__init__(**kwargs) + self.action_group = action_group + self.email_subject = email_subject + self.custom_webhook_payload = custom_webhook_payload 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 new file mode 100644 index 000000000000..131ce64379ef --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver.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 AzureFunctionReceiver(Model): + """An azure function receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the azure function receiver. Names must + be unique across all receivers within an action group. + :type name: str + :param function_app_resource_id: Required. The azure resource id of the + function app. + :type function_app_resource_id: str + :param function_name: Required. The function name in the function app. + :type function_name: str + :param http_trigger_url: Required. The http trigger url where http request + sent to. + :type http_trigger_url: str + """ + + _validation = { + 'name': {'required': True}, + 'function_app_resource_id': {'required': True}, + 'function_name': {'required': True}, + 'http_trigger_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, + 'function_name': {'key': 'functionName', 'type': 'str'}, + 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureFunctionReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + 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) 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 new file mode 100644 index 000000000000..cc8d10fa6fe2 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver_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 AzureFunctionReceiver(Model): + """An azure function receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the azure function receiver. Names must + be unique across all receivers within an action group. + :type name: str + :param function_app_resource_id: Required. The azure resource id of the + function app. + :type function_app_resource_id: str + :param function_name: Required. The function name in the function app. + :type function_name: str + :param http_trigger_url: Required. The http trigger url where http request + sent to. + :type http_trigger_url: str + """ + + _validation = { + 'name': {'required': True}, + 'function_app_resource_id': {'required': True}, + 'function_name': {'required': True}, + 'http_trigger_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function_app_resource_id': {'key': 'functionAppResourceId', 'type': 'str'}, + 'function_name': {'key': 'functionName', 'type': 'str'}, + 'http_trigger_url': {'key': 'httpTriggerUrl', 'type': 'str'}, + } + + def __init__(self, *, name: str, function_app_resource_id: str, function_name: str, http_trigger_url: str, **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 diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py new file mode 100644 index 000000000000..fc531623e212 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py @@ -0,0 +1,88 @@ +# 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 .resource import Resource + + +class LogSearchRuleResource(Resource): + """The Log Search Rule resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param description: The description of the Log Search rule. + :type description: str + :param enabled: The flag which indicates whether the Log Search rule is + enabled. Value should be true or false. Possible values include: 'true', + 'false' + :type enabled: str or ~azure.mgmt.monitor.models.Enabled + :ivar last_updated_time: Last time the rule was updated in IS08601 format. + :vartype last_updated_time: datetime + :ivar provisioning_state: Provisioning state of the scheduledquery rule. + Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.ProvisioningState + :param source: Required. Data Source against which rule will Query Data + :type source: ~azure.mgmt.monitor.models.Source + :param schedule: Required. Schedule (Frequnecy, Time Window) for rule. + :type schedule: ~azure.mgmt.monitor.models.Schedule + :param action: Required. Action needs to be taken on rule execution. + :type action: ~azure.mgmt.monitor.models.Action + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'last_updated_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'source': {'required': True}, + 'schedule': {'required': True}, + 'action': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'str'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'Source'}, + 'schedule': {'key': 'properties.schedule', 'type': 'Schedule'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + } + + def __init__(self, **kwargs): + super(LogSearchRuleResource, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.enabled = kwargs.get('enabled', None) + self.last_updated_time = None + self.provisioning_state = None + self.source = kwargs.get('source', None) + self.schedule = kwargs.get('schedule', None) + self.action = kwargs.get('action', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_paged.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_paged.py new file mode 100644 index 000000000000..fbec51381f06 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_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 LogSearchRuleResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`LogSearchRuleResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[LogSearchRuleResource]'} + } + + def __init__(self, *args, **kwargs): + + super(LogSearchRuleResourcePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py new file mode 100644 index 000000000000..90bedd4f1bcb --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py @@ -0,0 +1,88 @@ +# 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 .resource import Resource + + +class LogSearchRuleResource(Resource): + """The Log Search Rule resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param description: The description of the Log Search rule. + :type description: str + :param enabled: The flag which indicates whether the Log Search rule is + enabled. Value should be true or false. Possible values include: 'true', + 'false' + :type enabled: str or ~azure.mgmt.monitor.models.Enabled + :ivar last_updated_time: Last time the rule was updated in IS08601 format. + :vartype last_updated_time: datetime + :ivar provisioning_state: Provisioning state of the scheduledquery rule. + Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.ProvisioningState + :param source: Required. Data Source against which rule will Query Data + :type source: ~azure.mgmt.monitor.models.Source + :param schedule: Required. Schedule (Frequnecy, Time Window) for rule. + :type schedule: ~azure.mgmt.monitor.models.Schedule + :param action: Required. Action needs to be taken on rule execution. + :type action: ~azure.mgmt.monitor.models.Action + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'last_updated_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'source': {'required': True}, + 'schedule': {'required': True}, + 'action': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'str'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'Source'}, + 'schedule': {'key': 'properties.schedule', 'type': 'Schedule'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + } + + def __init__(self, *, location: str, source, schedule, action, tags=None, description: str=None, enabled=None, **kwargs) -> None: + super(LogSearchRuleResource, self).__init__(location=location, tags=tags, **kwargs) + self.description = description + self.enabled = enabled + self.last_updated_time = None + self.provisioning_state = None + self.source = source + self.schedule = schedule + self.action = action 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 new file mode 100644 index 000000000000..a2072831f0de --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver.py @@ -0,0 +1,47 @@ +# 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 LogicAppReceiver(Model): + """A logic app receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the logic app receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param resource_id: Required. The azure resource id of the logic app + receiver. + :type resource_id: str + :param callback_url: Required. The callback url where http request sent + to. + :type callback_url: str + """ + + _validation = { + 'name': {'required': True}, + 'resource_id': {'required': True}, + 'callback_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogicAppReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.resource_id = kwargs.get('resource_id', None) + self.callback_url = kwargs.get('callback_url', 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 new file mode 100644 index 000000000000..cc0e13916d23 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver_py3.py @@ -0,0 +1,47 @@ +# 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 LogicAppReceiver(Model): + """A logic app receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the logic app receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param resource_id: Required. The azure resource id of the logic app + receiver. + :type resource_id: str + :param callback_url: Required. The callback url where http request sent + to. + :type callback_url: str + """ + + _validation = { + 'name': {'required': True}, + 'resource_id': {'required': True}, + 'callback_url': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + } + + def __init__(self, *, name: str, resource_id: str, callback_url: str, **kwargs) -> None: + super(LogicAppReceiver, self).__init__(**kwargs) + self.name = name + self.resource_id = resource_id + self.callback_url = callback_url diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria.py new file mode 100644 index 000000000000..e09cd7cbd52a --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria.py @@ -0,0 +1,46 @@ +# 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 MetricAlertCriteria(Model): + """The rule criteria that defines the conditions of the alert rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MetricAlertSingleResourceMultipleMetricCriteria + + 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 odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria': 'MetricAlertSingleResourceMultipleMetricCriteria'} + } + + def __init__(self, **kwargs): + super(MetricAlertCriteria, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.odatatype = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria_py3.py new file mode 100644 index 000000000000..c7efb60b1ddc --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria_py3.py @@ -0,0 +1,46 @@ +# 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 MetricAlertCriteria(Model): + """The rule criteria that defines the conditions of the alert rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MetricAlertSingleResourceMultipleMetricCriteria + + 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 odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odatatype': {'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria': 'MetricAlertSingleResourceMultipleMetricCriteria'} + } + + def __init__(self, *, additional_properties=None, **kwargs) -> None: + super(MetricAlertCriteria, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.odatatype = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py new file mode 100644 index 000000000000..4a45ac4ed6f6 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py @@ -0,0 +1,101 @@ +# 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 .resource import Resource + + +class MetricAlertResource(Resource): + """The metric alert resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param description: Required. the description of the metric alert that + will be included in the alert email. + :type description: str + :param severity: Required. Alert severity {0, 1, 2, 3, 4} + :type severity: int + :param enabled: Required. the flag that indicates whether the metric alert + is enabled. + :type enabled: bool + :param scopes: the list of resource id's that this metric alert is scoped + to. + :type scopes: list[str] + :param evaluation_frequency: Required. how often the metric alert is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: Required. the period of time (in ISO 8601 duration + format) that is used to monitor alert activity based on the threshold. + :type window_size: timedelta + :param criteria: Required. defines the specific alert criteria + information. + :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: list[~azure.mgmt.monitor.models.Action] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'description': {'required': True}, + 'severity': {'required': True}, + 'enabled': {'required': True}, + 'evaluation_frequency': {'required': True}, + 'window_size': {'required': True}, + 'criteria': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'int'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(MetricAlertResource, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.severity = kwargs.get('severity', None) + self.enabled = kwargs.get('enabled', None) + self.scopes = kwargs.get('scopes', None) + self.evaluation_frequency = kwargs.get('evaluation_frequency', None) + self.window_size = kwargs.get('window_size', None) + self.criteria = kwargs.get('criteria', None) + self.actions = kwargs.get('actions', None) + self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_paged.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_paged.py new file mode 100644 index 000000000000..8ad3fb071965 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_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 MetricAlertResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`MetricAlertResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MetricAlertResource]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricAlertResourcePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py new file mode 100644 index 000000000000..52be4f70d27e --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py @@ -0,0 +1,86 @@ +# 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 MetricAlertResourcePatch(Model): + """The metric alert resource for patch operations. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param description: Required. the description of the metric alert that + will be included in the alert email. + :type description: str + :param severity: Required. Alert severity {0, 1, 2, 3, 4} + :type severity: int + :param enabled: Required. the flag that indicates whether the metric alert + is enabled. + :type enabled: bool + :param scopes: the list of resource id's that this metric alert is scoped + to. + :type scopes: list[str] + :param evaluation_frequency: Required. how often the metric alert is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: Required. the period of time (in ISO 8601 duration + format) that is used to monitor alert activity based on the threshold. + :type window_size: timedelta + :param criteria: Required. defines the specific alert criteria + information. + :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: list[~azure.mgmt.monitor.models.Action] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'description': {'required': True}, + 'severity': {'required': True}, + 'enabled': {'required': True}, + 'evaluation_frequency': {'required': True}, + 'window_size': {'required': True}, + 'criteria': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'int'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(MetricAlertResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.description = kwargs.get('description', None) + self.severity = kwargs.get('severity', None) + self.enabled = kwargs.get('enabled', None) + self.scopes = kwargs.get('scopes', None) + self.evaluation_frequency = kwargs.get('evaluation_frequency', None) + self.window_size = kwargs.get('window_size', None) + self.criteria = kwargs.get('criteria', None) + self.actions = kwargs.get('actions', None) + self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py new file mode 100644 index 000000000000..2198413c7819 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py @@ -0,0 +1,86 @@ +# 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 MetricAlertResourcePatch(Model): + """The metric alert resource for patch operations. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param tags: Resource tags + :type tags: dict[str, str] + :param description: Required. the description of the metric alert that + will be included in the alert email. + :type description: str + :param severity: Required. Alert severity {0, 1, 2, 3, 4} + :type severity: int + :param enabled: Required. the flag that indicates whether the metric alert + is enabled. + :type enabled: bool + :param scopes: the list of resource id's that this metric alert is scoped + to. + :type scopes: list[str] + :param evaluation_frequency: Required. how often the metric alert is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: Required. the period of time (in ISO 8601 duration + format) that is used to monitor alert activity based on the threshold. + :type window_size: timedelta + :param criteria: Required. defines the specific alert criteria + information. + :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: list[~azure.mgmt.monitor.models.Action] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'description': {'required': True}, + 'severity': {'required': True}, + 'enabled': {'required': True}, + 'evaluation_frequency': {'required': True}, + 'window_size': {'required': True}, + 'criteria': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'int'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, actions=None, **kwargs) -> None: + super(MetricAlertResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.description = description + self.severity = severity + self.enabled = enabled + self.scopes = scopes + self.evaluation_frequency = evaluation_frequency + self.window_size = window_size + self.criteria = criteria + self.actions = actions + self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py new file mode 100644 index 000000000000..7dfbfeb5cae8 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py @@ -0,0 +1,101 @@ +# 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 .resource import Resource + + +class MetricAlertResource(Resource): + """The metric alert resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id + :vartype id: str + :ivar name: Azure resource name + :vartype name: str + :ivar type: Azure resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param description: Required. the description of the metric alert that + will be included in the alert email. + :type description: str + :param severity: Required. Alert severity {0, 1, 2, 3, 4} + :type severity: int + :param enabled: Required. the flag that indicates whether the metric alert + is enabled. + :type enabled: bool + :param scopes: the list of resource id's that this metric alert is scoped + to. + :type scopes: list[str] + :param evaluation_frequency: Required. how often the metric alert is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: Required. the period of time (in ISO 8601 duration + format) that is used to monitor alert activity based on the threshold. + :type window_size: timedelta + :param criteria: Required. defines the specific alert criteria + information. + :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria + :param actions: the array of actions that are performed when the alert + rule becomes active, and when an alert condition is resolved. + :type actions: list[~azure.mgmt.monitor.models.Action] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'description': {'required': True}, + 'severity': {'required': True}, + 'enabled': {'required': True}, + 'evaluation_frequency': {'required': True}, + 'window_size': {'required': True}, + 'criteria': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'int'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, location: str, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, actions=None, **kwargs) -> None: + super(MetricAlertResource, self).__init__(location=location, tags=tags, **kwargs) + self.description = description + self.severity = severity + self.enabled = enabled + self.scopes = scopes + self.evaluation_frequency = evaluation_frequency + self.window_size = window_size + self.criteria = criteria + self.actions = actions + self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_single_resource_multiple_metric_criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_single_resource_multiple_metric_criteria.py new file mode 100644 index 000000000000..ccc84e1991ca --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_single_resource_multiple_metric_criteria.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .metric_alert_criteria import MetricAlertCriteria + + +class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): + """Specifies the metric alert criteria for a single resource that has multiple + metric criteria. + + 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 odatatype: Required. Constant filled by server. + :type odatatype: str + :param all_of: The list of metric criteria for this 'all of' operation. + :type all_of: list[~azure.mgmt.monitor.models.MetricCriteria] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'all_of': {'key': 'allOf', 'type': '[MetricCriteria]'}, + } + + def __init__(self, **kwargs): + super(MetricAlertSingleResourceMultipleMetricCriteria, self).__init__(**kwargs) + self.all_of = kwargs.get('all_of', None) + self.odatatype = 'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_single_resource_multiple_metric_criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_single_resource_multiple_metric_criteria_py3.py new file mode 100644 index 000000000000..171a2bff719d --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_single_resource_multiple_metric_criteria_py3.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .metric_alert_criteria import MetricAlertCriteria + + +class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): + """Specifies the metric alert criteria for a single resource that has multiple + metric criteria. + + 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 odatatype: Required. Constant filled by server. + :type odatatype: str + :param all_of: The list of metric criteria for this 'all of' operation. + :type all_of: list[~azure.mgmt.monitor.models.MetricCriteria] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'all_of': {'key': 'allOf', 'type': '[MetricCriteria]'}, + } + + def __init__(self, *, additional_properties=None, all_of=None, **kwargs) -> None: + super(MetricAlertSingleResourceMultipleMetricCriteria, self).__init__(additional_properties=additional_properties, **kwargs) + self.all_of = all_of + self.odatatype = 'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status.py new file mode 100644 index 000000000000..89a6928343f2 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status.py @@ -0,0 +1,40 @@ +# 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 MetricAlertStatus(Model): + """An alert status. + + :param name: The status name. + :type name: str + :param id: The alert rule arm id. + :type id: str + :param type: The extended resource type name. + :type type: str + :param properties: The alert status properties of the metric alert status. + :type properties: ~azure.mgmt.monitor.models.MetricAlertStatusProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MetricAlertStatusProperties'}, + } + + def __init__(self, **kwargs): + super(MetricAlertStatus, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_collection.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_collection.py new file mode 100644 index 000000000000..f893590e2015 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_collection.py @@ -0,0 +1,28 @@ +# 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 MetricAlertStatusCollection(Model): + """Represents a collection of alert rule resources. + + :param value: the values for the alert rule resources. + :type value: list[~azure.mgmt.monitor.models.MetricAlertStatus] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MetricAlertStatus]'}, + } + + def __init__(self, **kwargs): + super(MetricAlertStatusCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_collection_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_collection_py3.py new file mode 100644 index 000000000000..06c21ce2b3cc --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_collection_py3.py @@ -0,0 +1,28 @@ +# 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 MetricAlertStatusCollection(Model): + """Represents a collection of alert rule resources. + + :param value: the values for the alert rule resources. + :type value: list[~azure.mgmt.monitor.models.MetricAlertStatus] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MetricAlertStatus]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(MetricAlertStatusCollection, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties.py new file mode 100644 index 000000000000..dbb20a8f55e4 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties.py @@ -0,0 +1,36 @@ +# 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 MetricAlertStatusProperties(Model): + """An alert status properties. + + :param dimensions: + :type dimensions: dict[str, str] + :param status: status value + :type status: str + :param timestamp: UTC time when the status was checked. + :type timestamp: datetime + """ + + _attribute_map = { + 'dimensions': {'key': 'dimensions', 'type': '{str}'}, + 'status': {'key': 'status', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(MetricAlertStatusProperties, self).__init__(**kwargs) + self.dimensions = kwargs.get('dimensions', None) + self.status = kwargs.get('status', None) + self.timestamp = kwargs.get('timestamp', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties_py3.py new file mode 100644 index 000000000000..5990828126e4 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties_py3.py @@ -0,0 +1,36 @@ +# 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 MetricAlertStatusProperties(Model): + """An alert status properties. + + :param dimensions: + :type dimensions: dict[str, str] + :param status: status value + :type status: str + :param timestamp: UTC time when the status was checked. + :type timestamp: datetime + """ + + _attribute_map = { + 'dimensions': {'key': 'dimensions', 'type': '{str}'}, + 'status': {'key': 'status', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + } + + def __init__(self, *, dimensions=None, status: str=None, timestamp=None, **kwargs) -> None: + super(MetricAlertStatusProperties, self).__init__(**kwargs) + self.dimensions = dimensions + self.status = status + self.timestamp = timestamp diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_py3.py new file mode 100644 index 000000000000..e6b7f3062534 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_py3.py @@ -0,0 +1,40 @@ +# 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 MetricAlertStatus(Model): + """An alert status. + + :param name: The status name. + :type name: str + :param id: The alert rule arm id. + :type id: str + :param type: The extended resource type name. + :type type: str + :param properties: The alert status properties of the metric alert status. + :type properties: ~azure.mgmt.monitor.models.MetricAlertStatusProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MetricAlertStatusProperties'}, + } + + def __init__(self, *, name: str=None, id: str=None, type: str=None, properties=None, **kwargs) -> None: + super(MetricAlertStatus, self).__init__(**kwargs) + self.name = name + self.id = id + self.type = type + self.properties = properties diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py new file mode 100644 index 000000000000..b9c0298fe117 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py @@ -0,0 +1,63 @@ +# 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 MetricCriteria(Model): + """MetricCriteria. + + All required parameters must be populated in order to send to Azure. + + :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 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 = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'operator': {'required': True}, + 'time_aggregation': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + '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]'}, + } + + 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) 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 new file mode 100644 index 000000000000..65c32e4e0f08 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria_py3.py @@ -0,0 +1,63 @@ +# 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 MetricCriteria(Model): + """MetricCriteria. + + All required parameters must be populated in order to send to Azure. + + :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 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 = { + 'name': {'required': True}, + 'metric_name': {'required': True}, + 'operator': {'required': True}, + 'time_aggregation': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + '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]'}, + } + + def __init__(self, *, name: str, metric_name: str, operator, time_aggregation, threshold: float, metric_namespace: str=None, dimensions=None, **kwargs) -> None: + super(MetricCriteria, self).__init__(**kwargs) + self.name = name + self.metric_name = metric_name + self.metric_namespace = metric_namespace + self.operator = operator + self.time_aggregation = time_aggregation + self.threshold = threshold + self.dimensions = dimensions diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension.py new file mode 100644 index 000000000000..a2c5882d0892 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension.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 MetricDimension(Model): + """MetricDimension. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param operator: Required. the dimension operator. + :type operator: str + :param values: Required. list of dimension values. + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetricDimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.operator = kwargs.get('operator', None) + self.values = kwargs.get('values', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension_py3.py new file mode 100644 index 000000000000..3bad2ed539b3 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension_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 MetricDimension(Model): + """MetricDimension. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param operator: Required. the dimension operator. + :type operator: str + :param values: Required. list of dimension values. + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__(self, *, name: str, operator: str, values, **kwargs) -> None: + super(MetricDimension, self).__init__(**kwargs) + self.name = name + self.operator = operator + self.values = values diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py index 0bc042577bb6..c674b66489f5 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py @@ -49,6 +49,17 @@ class MetricTrigger(Model): :param threshold: Required. the threshold of the metric that triggers the scale action. :type threshold: float + :param threshold_operator: Evaluation operation for Metric -'GreaterThan' + or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', + 'LessThan', 'Equal' + :type threshold_operator: str or + ~azure.mgmt.monitor.models.ConditionalOperator + :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or + 'Total'. Possible values include: 'Consecutive', 'Total' + :type metric_trigger_type: str or + ~azure.mgmt.monitor.models.MetricTriggerType + :param metric_column: Evaluation of metric on a particular column + :type metric_column: str """ _validation = { @@ -71,6 +82,9 @@ class MetricTrigger(Model): 'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'}, 'operator': {'key': 'operator', 'type': 'ComparisonOperationType'}, 'threshold': {'key': 'threshold', 'type': 'float'}, + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, + 'metric_column': {'key': 'metricColumn', 'type': 'str'}, } def __init__(self, **kwargs): @@ -83,3 +97,6 @@ def __init__(self, **kwargs): self.time_aggregation = kwargs.get('time_aggregation', None) self.operator = kwargs.get('operator', None) self.threshold = kwargs.get('threshold', None) + self.threshold_operator = kwargs.get('threshold_operator', None) + self.metric_trigger_type = kwargs.get('metric_trigger_type', None) + self.metric_column = kwargs.get('metric_column', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py index 991b29d2707c..4cd6f809b9e7 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py @@ -49,6 +49,17 @@ class MetricTrigger(Model): :param threshold: Required. the threshold of the metric that triggers the scale action. :type threshold: float + :param threshold_operator: Evaluation operation for Metric -'GreaterThan' + or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', + 'LessThan', 'Equal' + :type threshold_operator: str or + ~azure.mgmt.monitor.models.ConditionalOperator + :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or + 'Total'. Possible values include: 'Consecutive', 'Total' + :type metric_trigger_type: str or + ~azure.mgmt.monitor.models.MetricTriggerType + :param metric_column: Evaluation of metric on a particular column + :type metric_column: str """ _validation = { @@ -71,9 +82,12 @@ class MetricTrigger(Model): 'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'}, 'operator': {'key': 'operator', 'type': 'ComparisonOperationType'}, 'threshold': {'key': 'threshold', 'type': 'float'}, + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, + 'metric_column': {'key': 'metricColumn', 'type': 'str'}, } - def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, statistic, time_window, time_aggregation, operator, threshold: float, **kwargs) -> None: + def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, statistic, time_window, time_aggregation, operator, threshold: float, threshold_operator=None, metric_trigger_type=None, metric_column: str=None, **kwargs) -> None: super(MetricTrigger, self).__init__(**kwargs) self.metric_name = metric_name self.metric_resource_uri = metric_resource_uri @@ -83,3 +97,6 @@ def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, st self.time_aggregation = time_aggregation self.operator = operator self.threshold = threshold + self.threshold_operator = threshold_operator + self.metric_trigger_type = metric_trigger_type + self.metric_column = metric_column 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 0f3e04d11484..de796532bfb7 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 @@ -39,6 +39,19 @@ class ComparisonOperationType(str, Enum): less_than_or_equal = "LessThanOrEqual" +class ConditionalOperator(str, Enum): + + greater_than = "GreaterThan" + less_than = "LessThan" + equal = "Equal" + + +class MetricTriggerType(str, Enum): + + consecutive = "Consecutive" + total = "Total" + + class ScaleDirection(str, Enum): none = "None" @@ -134,6 +147,34 @@ class Sensitivity(str, Enum): high = "High" +class Enabled(str, Enum): + + true = "true" + false = "false" + + +class ProvisioningState(str, Enum): + + succeeded = "Succeeded" + deploying = "Deploying" + canceled = "Canceled" + failed = "Failed" + + +class QueryType(str, Enum): + + result_count = "ResultCount" + + +class AlertSeverity(str, Enum): + + zero = "0" + one = "1" + two = "2" + three = "3" + four = "4" + + class ResultType(str, Enum): data = "Data" diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/schedule.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/schedule.py new file mode 100644 index 000000000000..1ddff6b7910d --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/schedule.py @@ -0,0 +1,42 @@ +# 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 Schedule(Model): + """Defines how often to run the search and the time interval. + + All required parameters must be populated in order to send to Azure. + + :param frequency_in_minutes: Required. frequency (in minutes) at which + rule condition should be evaluated. + :type frequency_in_minutes: int + :param time_window_in_minutes: Required. Time window for which data needs + to be fetched for query (should be greater than or equal to + frequencyInMinutes). + :type time_window_in_minutes: int + """ + + _validation = { + 'frequency_in_minutes': {'required': True}, + 'time_window_in_minutes': {'required': True}, + } + + _attribute_map = { + 'frequency_in_minutes': {'key': 'frequencyInMinutes', 'type': 'int'}, + 'time_window_in_minutes': {'key': 'timeWindowInMinutes', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(Schedule, self).__init__(**kwargs) + self.frequency_in_minutes = kwargs.get('frequency_in_minutes', None) + self.time_window_in_minutes = kwargs.get('time_window_in_minutes', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/schedule_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/schedule_py3.py new file mode 100644 index 000000000000..a1f87d04605a --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/schedule_py3.py @@ -0,0 +1,42 @@ +# 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 Schedule(Model): + """Defines how often to run the search and the time interval. + + All required parameters must be populated in order to send to Azure. + + :param frequency_in_minutes: Required. frequency (in minutes) at which + rule condition should be evaluated. + :type frequency_in_minutes: int + :param time_window_in_minutes: Required. Time window for which data needs + to be fetched for query (should be greater than or equal to + frequencyInMinutes). + :type time_window_in_minutes: int + """ + + _validation = { + 'frequency_in_minutes': {'required': True}, + 'time_window_in_minutes': {'required': True}, + } + + _attribute_map = { + 'frequency_in_minutes': {'key': 'frequencyInMinutes', 'type': 'int'}, + 'time_window_in_minutes': {'key': 'timeWindowInMinutes', 'type': 'int'}, + } + + def __init__(self, *, frequency_in_minutes: int, time_window_in_minutes: int, **kwargs) -> None: + super(Schedule, self).__init__(**kwargs) + self.frequency_in_minutes = frequency_in_minutes + self.time_window_in_minutes = time_window_in_minutes diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py new file mode 100644 index 000000000000..3f3ba2b7687a --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py @@ -0,0 +1,50 @@ +# 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 Source(Model): + """Specifies the log search query. + + All required parameters must be populated in order to send to Azure. + + :param query: Required. Log search query. + :type query: str + :param authorized_resources: List of Resource referred into query + :type authorized_resources: list[str] + :param datasource_id: Required. The resource uri over which log search + query is to be run. + :type datasource_id: str + :param query_type: Set value to ResultCount if query should be returning + search result count. Set it to Number if its a metric query. Possible + values include: 'ResultCount' + :type query_type: str or ~azure.mgmt.monitor.models.QueryType + """ + + _validation = { + 'query': {'required': True}, + 'datasource_id': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'authorized_resources': {'key': 'authorizedResources', 'type': '[str]'}, + 'datasource_id': {'key': 'datasourceId', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Source, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + self.authorized_resources = kwargs.get('authorized_resources', None) + self.datasource_id = kwargs.get('datasource_id', None) + self.query_type = kwargs.get('query_type', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py new file mode 100644 index 000000000000..aaaba5c0cc01 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py @@ -0,0 +1,50 @@ +# 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 Source(Model): + """Specifies the log search query. + + All required parameters must be populated in order to send to Azure. + + :param query: Required. Log search query. + :type query: str + :param authorized_resources: List of Resource referred into query + :type authorized_resources: list[str] + :param datasource_id: Required. The resource uri over which log search + query is to be run. + :type datasource_id: str + :param query_type: Set value to ResultCount if query should be returning + search result count. Set it to Number if its a metric query. Possible + values include: 'ResultCount' + :type query_type: str or ~azure.mgmt.monitor.models.QueryType + """ + + _validation = { + 'query': {'required': True}, + 'datasource_id': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'authorized_resources': {'key': 'authorizedResources', 'type': '[str]'}, + 'datasource_id': {'key': 'datasourceId', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + } + + def __init__(self, *, query: str, datasource_id: str, authorized_resources=None, query_type=None, **kwargs) -> None: + super(Source, self).__init__(**kwargs) + self.query = query + self.authorized_resources = authorized_resources + self.datasource_id = datasource_id + self.query_type = query_type diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition.py new file mode 100644 index 000000000000..9c011b1fcd62 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition.py @@ -0,0 +1,47 @@ +# 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 TriggerCondition(Model): + """The condition that results in the Log Search rule. + + All required parameters must be populated in order to send to Azure. + + :param threshold_operator: Required. Evaluation operation for rule - + 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', + 'LessThan', 'Equal' + :type threshold_operator: str or + ~azure.mgmt.monitor.models.ConditionalOperator + :param threshold: Required. Result or count threshold based on which rule + should be triggered. + :type threshold: float + :param metric_trigger: Trigger condition for metric query rule + :type metric_trigger: ~azure.mgmt.monitor.models.MetricTrigger + """ + + _validation = { + 'threshold_operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'metric_trigger': {'key': 'metricTrigger', 'type': 'MetricTrigger'}, + } + + def __init__(self, **kwargs): + super(TriggerCondition, self).__init__(**kwargs) + self.threshold_operator = kwargs.get('threshold_operator', None) + self.threshold = kwargs.get('threshold', None) + self.metric_trigger = kwargs.get('metric_trigger', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition_py3.py new file mode 100644 index 000000000000..1a492de47033 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition_py3.py @@ -0,0 +1,47 @@ +# 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 TriggerCondition(Model): + """The condition that results in the Log Search rule. + + All required parameters must be populated in order to send to Azure. + + :param threshold_operator: Required. Evaluation operation for rule - + 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', + 'LessThan', 'Equal' + :type threshold_operator: str or + ~azure.mgmt.monitor.models.ConditionalOperator + :param threshold: Required. Result or count threshold based on which rule + should be triggered. + :type threshold: float + :param metric_trigger: Trigger condition for metric query rule + :type metric_trigger: ~azure.mgmt.monitor.models.MetricTrigger + """ + + _validation = { + 'threshold_operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'metric_trigger': {'key': 'metricTrigger', 'type': 'MetricTrigger'}, + } + + def __init__(self, *, threshold_operator, threshold: float, metric_trigger=None, **kwargs) -> None: + super(TriggerCondition, self).__init__(**kwargs) + self.threshold_operator = threshold_operator + self.threshold = threshold + self.metric_trigger = metric_trigger diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/voice_receiver.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/voice_receiver.py new file mode 100644 index 000000000000..0cecd17337d7 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/voice_receiver.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 VoiceReceiver(Model): + """A voice receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the voice receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the voice receiver. + :type country_code: str + :param phone_number: Required. The phone number of the voice receiver. + :type phone_number: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(VoiceReceiver, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.country_code = kwargs.get('country_code', None) + self.phone_number = kwargs.get('phone_number', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/voice_receiver_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/voice_receiver_py3.py new file mode 100644 index 000000000000..02334b76c479 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/voice_receiver_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 VoiceReceiver(Model): + """A voice receiver. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the voice receiver. Names must be + unique across all receivers within an action group. + :type name: str + :param country_code: Required. The country code of the voice receiver. + :type country_code: str + :param phone_number: Required. The phone number of the voice receiver. + :type phone_number: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + 'phone_number': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs) -> None: + super(VoiceReceiver, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + self.phone_number = phone_number 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 8ba664998175..f27f5bbcbefa 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/monitor_management_client.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/monitor_management_client.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import ServiceClient +from msrest.service_client import SDKClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION @@ -28,6 +28,9 @@ from .operations.metric_definitions_operations import MetricDefinitionsOperations from .operations.metrics_operations import MetricsOperations from .operations.metric_baseline_operations import MetricBaselineOperations +from .operations.metric_alerts_operations import MetricAlertsOperations +from .operations.metric_alerts_status_operations import MetricAlertsStatusOperations +from .operations.scheduled_query_rules_operations import ScheduledQueryRulesOperations from . import models @@ -63,7 +66,7 @@ def __init__( self.subscription_id = subscription_id -class MonitorManagementClient(object): +class MonitorManagementClient(SDKClient): """Monitor Management Client :ivar config: Configuration for client. @@ -99,6 +102,12 @@ class MonitorManagementClient(object): :vartype metrics: azure.mgmt.monitor.operations.MetricsOperations :ivar metric_baseline: MetricBaseline operations :vartype metric_baseline: azure.mgmt.monitor.operations.MetricBaselineOperations + :ivar metric_alerts: MetricAlerts operations + :vartype metric_alerts: azure.mgmt.monitor.operations.MetricAlertsOperations + :ivar metric_alerts_status: MetricAlertsStatus operations + :vartype metric_alerts_status: azure.mgmt.monitor.operations.MetricAlertsStatusOperations + :ivar scheduled_query_rules: ScheduledQueryRules operations + :vartype scheduled_query_rules: azure.mgmt.monitor.operations.ScheduledQueryRulesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -112,7 +121,7 @@ def __init__( self, credentials, subscription_id, base_url=None): self.config = MonitorManagementClientConfiguration(credentials, subscription_id, base_url) - self._client = ServiceClient(self.config.credentials, self.config) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -148,3 +157,9 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.metric_baseline = MetricBaselineOperations( 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( + self._client, self.config, self._serialize, self._deserialize) + self.scheduled_query_rules = ScheduledQueryRulesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py index 071c73c9668e..17a5cbbab15e 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py @@ -24,6 +24,9 @@ from .metric_definitions_operations import MetricDefinitionsOperations from .metrics_operations import MetricsOperations from .metric_baseline_operations import MetricBaselineOperations +from .metric_alerts_operations import MetricAlertsOperations +from .metric_alerts_status_operations import MetricAlertsStatusOperations +from .scheduled_query_rules_operations import ScheduledQueryRulesOperations __all__ = [ 'AutoscaleSettingsOperations', @@ -41,4 +44,7 @@ 'MetricDefinitionsOperations', 'MetricsOperations', 'MetricBaselineOperations', + 'MetricAlertsOperations', + 'MetricAlertsStatusOperations', + 'ScheduledQueryRulesOperations', ] 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 88fd6c92ff0f..763b3361a9f0 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: "2017-04-01". + :ivar api_version: Client Api Version. Constant value: "2018-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 = "2017-04-01" + self.api_version = "2018-03-01" self.config = config @@ -427,7 +427,8 @@ def internal_paging(next_link=None, raw=False): def enable_receiver( self, resource_group_name, action_group_name, receiver_name, custom_headers=None, raw=False, **operation_config): """Enable a receiver in an action group. This changes the receiver's - status from Disabled to Enabled. + status from Disabled to Enabled. This operation is only supported for + Email or SMS receivers. :param resource_group_name: The name of the resource group. :type resource_group_name: str diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_operations.py new file mode 100644 index 000000000000..0f42e68bb6c3 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_operations.py @@ -0,0 +1,418 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class MetricAlertsOperations(object): + """MetricAlertsOperations 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: "2018-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01" + + self.config = config + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Retrieve alert rule definitions in a subscription. + + :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 MetricAlertResource + :rtype: + ~azure.mgmt.monitor.models.MetricAlertResourcePaged[~azure.mgmt.monitor.models.MetricAlertResource] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.MetricAlertResourcePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.MetricAlertResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Retrieve alert rule defintions in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :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 MetricAlertResource + :rtype: + ~azure.mgmt.monitor.models.MetricAlertResourcePaged[~azure.mgmt.monitor.models.MetricAlertResource] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.MetricAlertResourcePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.MetricAlertResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts'} + + def get( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Retrieve an alert rule definiton. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :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: MetricAlertResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.models.MetricAlertResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MetricAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} + + def create_or_update( + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or update an metric alert definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: ~azure.mgmt.monitor.models.MetricAlertResource + :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: MetricAlertResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.models.MetricAlertResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(parameters, 'MetricAlertResource') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MetricAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} + + def update( + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Update an metric alert definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to update. + :type parameters: ~azure.mgmt.monitor.models.MetricAlertResourcePatch + :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: MetricAlertResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.models.MetricAlertResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(parameters, 'MetricAlertResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MetricAlertResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} + + def delete( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Delete an alert rule defitiniton. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'} diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_status_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_status_operations.py new file mode 100644 index 000000000000..a30a72eed057 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_status_operations.py @@ -0,0 +1,162 @@ +# 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 MetricAlertsStatusOperations(object): + """MetricAlertsStatusOperations 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: "2018-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01" + + self.config = config + + def list( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Retrieve an alert rule status. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :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: MetricAlertStatusCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.models.MetricAlertStatusCollection or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MetricAlertStatusCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status'} + + def list_by_name( + self, resource_group_name, rule_name, status_name, custom_headers=None, raw=False, **operation_config): + """Retrieve an alert rule status. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param status_name: The name of the status. + :type status_name: str + :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: MetricAlertStatusCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.models.MetricAlertStatusCollection or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_name.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'statusName': self._serialize.url("status_name", status_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MetricAlertStatusCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}'} diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py new file mode 100644 index 000000000000..6227f567f391 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py @@ -0,0 +1,363 @@ +# 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 ScheduledQueryRulesOperations(object): + """ScheduledQueryRulesOperations 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: "2018-04-16". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-04-16" + + self.config = config + + def create_or_update( + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an log search rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResource + :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: LogSearchRuleResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(parameters, 'LogSearchRuleResource') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LogSearchRuleResource', response) + if response.status_code == 201: + deserialized = self._deserialize('LogSearchRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} + + def get( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an Log Search rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :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: LogSearchRuleResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LogSearchRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} + + def delete( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes a Log Search rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} + + def list_by_subscription( + self, filter=None, custom_headers=None, raw=False, **operation_config): + """List the Log Search rules within a subscription group. + + :param filter: The filter to apply on the operation. For more + information please see + https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + :type filter: str + :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 LogSearchRuleResource + :rtype: + ~azure.mgmt.monitor.models.LogSearchRuleResourcePaged[~azure.mgmt.monitor.models.LogSearchRuleResource] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.LogSearchRuleResourcePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LogSearchRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules'} + + def list_by_resource_group( + self, resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config): + """List the Log Search rules within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For more + information please see + https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + :type filter: str + :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 LogSearchRuleResource + :rtype: + ~azure.mgmt.monitor.models.LogSearchRuleResourcePaged[~azure.mgmt.monitor.models.LogSearchRuleResource] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.LogSearchRuleResourcePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LogSearchRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules'} diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/version.py b/azure-mgmt-monitor/azure/mgmt/monitor/version.py index c9fea7678df4..266f5a486d79 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/version.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.5.1" +VERSION = "0.5.0"