From fb6d5daf03eaee100c37c59749a5d7a960748e3a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 6 Jun 2018 15:29:22 -0700 Subject: [PATCH] azure-mgmt-monitor 0.5.2 (#2460) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [AutoPR monitor/resource-manager] Added GA API version for Scheduled Query Rule (#2416) * Generated from d183bad923d3a0a4092d21203f850db6cde9f4e9 Resolving Comments Resolving Comments * Generated from df40ac3bbf17ea0180dd4adff2af3094065feca0 Made SKU as top level proprty and including generic error response format Couple of changes - 1. Made SKU as top level proprty as mentioned here - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md#put-resource 2. including generic error response format * Generated from 7578160670750a68d05f77ec8163b25bb72f391e Minor Changes to align implementation 1. Removed SKU - Billing Model is still under discussion, hence need not to be exposed to customers. 2. Enabled field ichanged to align with camel case. 3. 'throttleTillDate' in properties.action changed to 'throttlingInMin' to denote correct meaning and it’s data type changed to number instead of date. 4. 'status' to be removed in properties.action from examples. 5. 'severity' made a required field in properties.action. 6. Removed Examples from original spec json * Generated from fb180fb311d73934d0f5150f72638cc3de155ea0 Added Default Response payload in all APIs Changes - 1. Added Default Response payload in all APIs 2. Made azNs description more clear * Generated from fb180fb311d73934d0f5150f72638cc3de155ea0 Added Default Response payload in all APIs Changes - 1. Added Default Response payload in all APIs 2. Made azNs description more clear * [AutoPR monitor/resource-manager] Minor Updates - description text (#2513) * Generated from 0c826790271a1be2d4af5905ee0eb089b4260feb Merge pull request #1 from abversqr/MinorUpdates Minor updates * Generated from 1610a74a5c49c73a546972daca1e7a43798a8cea Merge branch 'master' into master * [AutoPR monitor/resource-manager] Add "autoMitigate" to Metric Alert API spec for 2018-03-01 (#2592) * Generated from d5b9b4545a8d15c70d3c8318d39e2f7b43229387 AutoMitigate changes * Generated from d5b9b4545a8d15c70d3c8318d39e2f7b43229387 AutoMitigate changes * [AutoPR monitor/resource-manager] [Monitor] Deconflict "Action" name in MetricAlert (#2617) * Generated from 35adc5e493c20a57e6e2cb35d87c578133d2b7a6 [Monitor] Deconflict "Action" name in MetricAlert Generates bad SDK. * Generated from ebfaf0bdd7f2bcf736598d8ec501f490a83d1268 Update reference to MetricAlertAction * [AutoPR monitor/resource-manager] Adding patch support for SQR API (#2596) * Generated from f53526896e5c001f79bd46ca892f825172b53abf Merge branch 'master' into patchsupport * Generated from f53526896e5c001f79bd46ca892f825172b53abf Merge branch 'master' into patchsupport * Generated from b37d3ace14508e3bc3f87ee29b7f2ad0b7025f67 Resolving multiple model issue Changes - 1. Renamed "MetricTrigger" to "LogMetricTrigger" 2. Aligned "Resources" to other specs * Rebuild by https://github.com/Azure/azure-sdk-for-python/pull/2460 * Auto packaging --- .../azure/mgmt/monitor/models/__init__.py | 82 ++++ .../azure/mgmt/monitor/models/action.py | 41 ++ .../monitor/models/action_group_resource.py | 19 +- .../models/action_group_resource_py3.py | 23 +- .../azure/mgmt/monitor/models/action_py3.py | 41 ++ .../models/activity_log_alert_resource_py3.py | 2 +- .../monitor/models/alert_rule_resource_py3.py | 2 +- .../mgmt/monitor/models/alerting_action.py | 56 +++ .../monitor/models/alerting_action_py3.py | 56 +++ .../models/autoscale_setting_resource_py3.py | 2 +- .../mgmt/monitor/models/az_ns_action_group.py | 38 ++ .../monitor/models/az_ns_action_group_py3.py | 38 ++ .../monitor/models/azure_function_receiver.py | 52 +++ .../models/azure_function_receiver_py3.py | 52 +++ ...agnostic_settings_category_resource_py3.py | 2 +- .../diagnostic_settings_resource_py3.py | 2 +- .../location_threshold_rule_condition_py3.py | 2 +- .../mgmt/monitor/models/log_metric_trigger.py | 45 ++ .../monitor/models/log_metric_trigger_py3.py | 45 ++ .../models/log_profile_resource_py3.py | 2 +- .../models/log_search_rule_resource.py | 88 ++++ .../models/log_search_rule_resource_paged.py | 27 ++ .../models/log_search_rule_resource_patch.py | 34 ++ .../log_search_rule_resource_patch_py3.py | 34 ++ .../models/log_search_rule_resource_py3.py | 88 ++++ .../mgmt/monitor/models/logic_app_receiver.py | 47 ++ .../monitor/models/logic_app_receiver_py3.py | 47 ++ .../management_event_rule_condition_py3.py | 2 +- .../monitor/models/metric_alert_action.py | 32 ++ .../monitor/models/metric_alert_action_py3.py | 32 ++ .../monitor/models/metric_alert_criteria.py | 46 ++ .../models/metric_alert_criteria_py3.py | 46 ++ .../monitor/models/metric_alert_resource.py | 106 +++++ .../models/metric_alert_resource_paged.py | 27 ++ .../models/metric_alert_resource_patch.py | 91 ++++ .../models/metric_alert_resource_patch_py3.py | 91 ++++ .../models/metric_alert_resource_py3.py | 106 +++++ ...ingle_resource_multiple_metric_criteria.py | 43 ++ ...e_resource_multiple_metric_criteria_py3.py | 43 ++ .../monitor/models/metric_alert_status.py | 40 ++ .../models/metric_alert_status_collection.py | 28 ++ .../metric_alert_status_collection_py3.py | 28 ++ .../models/metric_alert_status_properties.py | 36 ++ .../metric_alert_status_properties_py3.py | 36 ++ .../monitor/models/metric_alert_status_py3.py | 40 ++ .../mgmt/monitor/models/metric_criteria.py | 63 +++ .../monitor/models/metric_criteria_py3.py | 63 +++ .../mgmt/monitor/models/metric_dimension.py | 44 ++ .../monitor/models/metric_dimension_py3.py | 44 ++ .../models/monitor_management_client_enums.py | 41 ++ .../monitor/models/rule_email_action_py3.py | 2 +- .../rule_management_event_data_source_py3.py | 2 +- .../models/rule_metric_data_source_py3.py | 2 +- .../monitor/models/rule_webhook_action_py3.py | 2 +- .../azure/mgmt/monitor/models/schedule.py | 42 ++ .../azure/mgmt/monitor/models/schedule_py3.py | 42 ++ .../azure/mgmt/monitor/models/source.py | 49 ++ .../azure/mgmt/monitor/models/source_py3.py | 49 ++ .../models/threshold_rule_condition_py3.py | 2 +- .../mgmt/monitor/models/trigger_condition.py | 47 ++ .../monitor/models/trigger_condition_py3.py | 47 ++ .../mgmt/monitor/models/voice_receiver.py | 45 ++ .../mgmt/monitor/models/voice_receiver_py3.py | 45 ++ .../mgmt/monitor/monitor_management_client.py | 21 +- .../azure/mgmt/monitor/operations/__init__.py | 6 + .../operations/action_groups_operations.py | 7 +- .../operations/metric_alerts_operations.py | 418 +++++++++++++++++ .../metric_alerts_status_operations.py | 162 +++++++ .../scheduled_query_rules_operations.py | 436 ++++++++++++++++++ azure-mgmt-monitor/sdk_packaging.toml | 5 + azure-mgmt-monitor/setup.py | 2 +- 71 files changed, 3504 insertions(+), 24 deletions(-) create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/action.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/azure_function_receiver_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_paged.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/logic_app_receiver_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_paged.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_single_resource_multiple_metric_criteria.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_single_resource_multiple_metric_criteria_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_collection.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_collection_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/schedule.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/schedule_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/source.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/voice_receiver.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/voice_receiver_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_operations.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_status_operations.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py create mode 100644 azure-mgmt-monitor/sdk_packaging.toml diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py index f0a59de93e28..1f76267967cf 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,25 @@ from .baseline_response_py3 import BaselineResponse from .time_series_information_py3 import TimeSeriesInformation from .calculate_baseline_response_py3 import CalculateBaselineResponse + from .metric_alert_action_py3 import MetricAlertAction + 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 .action_py3 import Action + from .log_search_rule_resource_py3 import LogSearchRuleResource + from .log_search_rule_resource_patch_py3 import LogSearchRuleResourcePatch + from .log_metric_trigger_py3 import LogMetricTrigger + 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 +156,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 +184,25 @@ from .baseline_response import BaselineResponse from .time_series_information import TimeSeriesInformation from .calculate_baseline_response import CalculateBaselineResponse + from .metric_alert_action import MetricAlertAction + 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 .action import Action + from .log_search_rule_resource import LogSearchRuleResource + from .log_search_rule_resource_patch import LogSearchRuleResourcePatch + from .log_metric_trigger import LogMetricTrigger + 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,6 +212,8 @@ 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, @@ -183,6 +229,12 @@ Unit, AggregationType, Sensitivity, + Enabled, + ProvisioningState, + QueryType, + ConditionalOperator, + MetricTriggerType, + AlertSeverity, ResultType, ) @@ -236,6 +288,9 @@ 'ItsmReceiver', 'AzureAppPushReceiver', 'AutomationRunbookReceiver', + 'VoiceReceiver', + 'LogicAppReceiver', + 'AzureFunctionReceiver', 'ActionGroupResource', 'EnableRequest', 'ActionGroupPatchBody', @@ -261,6 +316,25 @@ 'BaselineResponse', 'TimeSeriesInformation', 'CalculateBaselineResponse', + 'MetricAlertAction', + 'MetricAlertCriteria', + 'MetricAlertResource', + 'MetricAlertResourcePatch', + 'MetricAlertStatusProperties', + 'MetricAlertStatus', + 'MetricAlertStatusCollection', + 'MetricDimension', + 'MetricCriteria', + 'MetricAlertSingleResourceMultipleMetricCriteria', + 'Source', + 'Schedule', + 'Action', + 'LogSearchRuleResource', + 'LogSearchRuleResourcePatch', + 'LogMetricTrigger', + 'TriggerCondition', + 'AzNsActionGroup', + 'AlertingAction', 'AutoscaleSettingResourcePaged', 'IncidentPaged', 'AlertRuleResourcePaged', @@ -270,6 +344,8 @@ 'EventDataPaged', 'LocalizableStringPaged', 'MetricDefinitionPaged', + 'MetricAlertResourcePaged', + 'LogSearchRuleResourcePaged', 'MetricStatisticType', 'TimeAggregationType', 'ComparisonOperationType', @@ -284,5 +360,11 @@ 'Unit', 'AggregationType', 'Sensitivity', + 'Enabled', + 'ProvisioningState', + 'QueryType', + 'ConditionalOperator', + 'MetricTriggerType', + '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..97c98e4fc86c --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py @@ -0,0 +1,41 @@ +# 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): + """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 odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + '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.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..0ccca8947395 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 = { @@ -64,7 +75,7 @@ class ActionGroupResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'group_short_name': {'required': True, 'max_length': 15}, + 'group_short_name': {'required': True, 'max_length': 12}, 'enabled': {'required': True}, } @@ -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..81edb6f53b0f 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 @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .resource import Resource +from .resource_py3 import Resource class ActionGroupResource(Resource): @@ -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 = { @@ -64,7 +75,7 @@ class ActionGroupResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'group_short_name': {'required': True, 'max_length': 15}, + 'group_short_name': {'required': True, 'max_length': 12}, 'enabled': {'required': True}, } @@ -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..c8217283cc29 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py @@ -0,0 +1,41 @@ +# 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): + """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 odatatype: Required. Constant filled by server. + :type odatatype: str + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + '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) -> None: + super(Action, self).__init__(**kwargs) + self.odatatype = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/activity_log_alert_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/activity_log_alert_resource_py3.py index bc03347d612d..1d44d057e560 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/activity_log_alert_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/activity_log_alert_resource_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .resource import Resource +from .resource_py3 import Resource class ActivityLogAlertResource(Resource): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/alert_rule_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/alert_rule_resource_py3.py index 83f226b1201d..c5d83396e2ab 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/alert_rule_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/alert_rule_resource_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .resource import Resource +from .resource_py3 import Resource class AlertRuleResource(Resource): 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..6df6d93edc5a --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py @@ -0,0 +1,56 @@ +# 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 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. Azure action group reference. + :type azns_action: ~azure.mgmt.monitor.models.AzNsActionGroup + :param throttling_in_min: time (in minutes) for which Alerts should be + throttled or suppressed. + :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 = { + '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..558088fa5315 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py @@ -0,0 +1,56 @@ +# 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_py3 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 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. Azure action group reference. + :type azns_action: ~azure.mgmt.monitor.models.AzNsActionGroup + :param throttling_in_min: time (in minutes) for which Alerts should be + throttled or suppressed. + :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 = { + '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, throttling_in_min: int=None, **kwargs) -> None: + super(AlertingAction, self).__init__(**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/autoscale_setting_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/autoscale_setting_resource_py3.py index b09a23c57c85..23eb4643a585 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/autoscale_setting_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/autoscale_setting_resource_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .resource import Resource +from .resource_py3 import Resource class AutoscaleSettingResource(Resource): 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..d98d5546826e --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group.py @@ -0,0 +1,38 @@ +# 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): + """Azure action group. + + :param action_group: Azure Action Group reference. + :type action_group: list[str] + :param email_subject: Custom subject override for all email ids in Azure + action group + :type email_subject: str + :param custom_webhook_payload: Custom payload to be sent for all webook + URI in Azure 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..72bc693ab43d --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group_py3.py @@ -0,0 +1,38 @@ +# 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): + """Azure action group. + + :param action_group: Azure Action Group reference. + :type action_group: list[str] + :param email_subject: Custom subject override for all email ids in Azure + action group + :type email_subject: str + :param custom_webhook_payload: Custom payload to be sent for all webook + URI in Azure 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/diagnostic_settings_category_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_category_resource_py3.py index 3c98429cbc1c..f97b609a6e0a 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_category_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_category_resource_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .proxy_only_resource import ProxyOnlyResource +from .proxy_only_resource_py3 import ProxyOnlyResource class DiagnosticSettingsCategoryResource(ProxyOnlyResource): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource_py3.py index df04a6892561..8d02b9e280ca 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .proxy_only_resource import ProxyOnlyResource +from .proxy_only_resource_py3 import ProxyOnlyResource class DiagnosticSettingsResource(ProxyOnlyResource): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/location_threshold_rule_condition_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/location_threshold_rule_condition_py3.py index 1d4157b8cdd1..e0d0eff9a386 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/location_threshold_rule_condition_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/location_threshold_rule_condition_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .rule_condition import RuleCondition +from .rule_condition_py3 import RuleCondition class LocationThresholdRuleCondition(RuleCondition): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py new file mode 100644 index 000000000000..754ab30066fc --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.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 LogMetricTrigger(Model): + """LogMetricTrigger. + + :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 threshold: + :type threshold: float + :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 + """ + + _attribute_map = { + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, + 'metric_column': {'key': 'metricColumn', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogMetricTrigger, self).__init__(**kwargs) + self.threshold_operator = kwargs.get('threshold_operator', None) + self.threshold = kwargs.get('threshold', 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/log_metric_trigger_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_py3.py new file mode 100644 index 000000000000..bcf1cfa94dc5 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_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 LogMetricTrigger(Model): + """LogMetricTrigger. + + :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 threshold: + :type threshold: float + :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 + """ + + _attribute_map = { + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, + 'metric_column': {'key': 'metricColumn', 'type': 'str'}, + } + + def __init__(self, *, threshold_operator=None, threshold: float=None, metric_trigger_type=None, metric_column: str=None, **kwargs) -> None: + super(LogMetricTrigger, self).__init__(**kwargs) + self.threshold_operator = threshold_operator + self.threshold = threshold + self.metric_trigger_type = metric_trigger_type + self.metric_column = metric_column diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_resource_py3.py index ec376218e6c2..28d3892f442d 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_resource_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .resource import Resource +from .resource_py3 import Resource class LogProfileResource(Resource): 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_patch.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch.py new file mode 100644 index 000000000000..350f17ce36ac --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch.py @@ -0,0 +1,34 @@ +# 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 LogSearchRuleResourcePatch(Model): + """The log search rule resource for patch operations. + + :param tags: Resource tags + :type tags: dict[str, 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 + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogSearchRuleResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.enabled = kwargs.get('enabled', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch_py3.py new file mode 100644 index 000000000000..010407469673 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch_py3.py @@ -0,0 +1,34 @@ +# 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 LogSearchRuleResourcePatch(Model): + """The log search rule resource for patch operations. + + :param tags: Resource tags + :type tags: dict[str, 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 + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'str'}, + } + + def __init__(self, *, tags=None, enabled=None, **kwargs) -> None: + super(LogSearchRuleResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.enabled = enabled 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..5cee5f349023 --- /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_py3 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/management_event_rule_condition_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/management_event_rule_condition_py3.py index 6de67497fbcd..6fb5cdb009f7 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/management_event_rule_condition_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/management_event_rule_condition_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .rule_condition import RuleCondition +from .rule_condition_py3 import RuleCondition class ManagementEventRuleCondition(RuleCondition): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py new file mode 100644 index 000000000000..426d3cef5664 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py @@ -0,0 +1,32 @@ +# 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 MetricAlertAction(Model): + """An alert action. + + :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] + """ + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MetricAlertAction, self).__init__(**kwargs) + self.action_group_id = kwargs.get('action_group_id', None) + self.webhook_properties = kwargs.get('webhook_properties', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py new file mode 100644 index 000000000000..da06ee03df07 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py @@ -0,0 +1,32 @@ +# 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 MetricAlertAction(Model): + """An alert action. + + :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] + """ + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__(self, *, action_group_id: str=None, webhook_properties=None, **kwargs) -> None: + super(MetricAlertAction, self).__init__(**kwargs) + self.action_group_id = action_group_id + self.webhook_properties = webhook_properties 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..98ac70d43bb1 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py @@ -0,0 +1,106 @@ +# 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 auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool + :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.MetricAlertAction] + :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'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, + '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.auto_mitigate = kwargs.get('auto_mitigate', 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..72bca9080e59 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py @@ -0,0 +1,91 @@ +# 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 auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool + :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.MetricAlertAction] + :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'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, + '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.auto_mitigate = kwargs.get('auto_mitigate', 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..c415f69e489b --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py @@ -0,0 +1,91 @@ +# 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 auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool + :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.MetricAlertAction] + :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'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, + '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, auto_mitigate: bool=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.auto_mitigate = auto_mitigate + 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..a116607117c6 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py @@ -0,0 +1,106 @@ +# 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_py3 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 auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool + :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.MetricAlertAction] + :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'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, + '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, auto_mitigate: bool=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.auto_mitigate = auto_mitigate + 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..7e74e7a90272 --- /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_py3 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/monitor_management_client_enums.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py index 0f3e04d11484..d2bda057fbd3 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 @@ -134,6 +134,47 @@ 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 ConditionalOperator(str, Enum): + + greater_than = "GreaterThan" + less_than = "LessThan" + equal = "Equal" + + +class MetricTriggerType(str, Enum): + + consecutive = "Consecutive" + total = "Total" + + +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/rule_email_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_email_action_py3.py index ebc3c723dacf..4c871a13da37 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_email_action_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_email_action_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .rule_action import RuleAction +from .rule_action_py3 import RuleAction class RuleEmailAction(RuleAction): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_management_event_data_source_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_management_event_data_source_py3.py index 5bf22d45150d..83398e8909b4 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_management_event_data_source_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_management_event_data_source_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .rule_data_source import RuleDataSource +from .rule_data_source_py3 import RuleDataSource class RuleManagementEventDataSource(RuleDataSource): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_metric_data_source_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_metric_data_source_py3.py index d29e9ecf9fd1..ad28d6387bb5 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_metric_data_source_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_metric_data_source_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .rule_data_source import RuleDataSource +from .rule_data_source_py3 import RuleDataSource class RuleMetricDataSource(RuleDataSource): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_webhook_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_webhook_action_py3.py index 20ac0fd328e0..4f0803555d93 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_webhook_action_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/rule_webhook_action_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .rule_action import RuleAction +from .rule_action_py3 import RuleAction class RuleWebhookAction(RuleAction): 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..4c305b2d49ba --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.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 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 data_source_id: Required. The resource uri over which log search + query is to be run. + :type data_source_id: str + :param query_type: Set value to 'ResultCount'. Possible values include: + 'ResultCount' + :type query_type: str or ~azure.mgmt.monitor.models.QueryType + """ + + _validation = { + 'query': {'required': True}, + 'data_source_id': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'authorized_resources': {'key': 'authorizedResources', 'type': '[str]'}, + 'data_source_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.data_source_id = kwargs.get('data_source_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..77655c4b55b5 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source_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 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 data_source_id: Required. The resource uri over which log search + query is to be run. + :type data_source_id: str + :param query_type: Set value to 'ResultCount'. Possible values include: + 'ResultCount' + :type query_type: str or ~azure.mgmt.monitor.models.QueryType + """ + + _validation = { + 'query': {'required': True}, + 'data_source_id': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'authorized_resources': {'key': 'authorizedResources', 'type': '[str]'}, + 'data_source_id': {'key': 'dataSourceId', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + } + + def __init__(self, *, query: str, data_source_id: str, authorized_resources=None, query_type=None, **kwargs) -> None: + super(Source, self).__init__(**kwargs) + self.query = query + self.authorized_resources = authorized_resources + self.data_source_id = data_source_id + self.query_type = query_type diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/threshold_rule_condition_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/threshold_rule_condition_py3.py index e2f2340c02b0..8fbff1f8930e 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/threshold_rule_condition_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/threshold_rule_condition_py3.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .rule_condition import RuleCondition +from .rule_condition_py3 import RuleCondition class ThresholdRuleCondition(RuleCondition): 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..e89fdc8c18f1 --- /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.LogMetricTrigger + """ + + _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': 'LogMetricTrigger'}, + } + + 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..b21e39d9a53e --- /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.LogMetricTrigger + """ + + _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': 'LogMetricTrigger'}, + } + + 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..16230f44386c --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py @@ -0,0 +1,436 @@ +# 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 update( + self, resource_group_name, rule_name, tags=None, enabled=None, custom_headers=None, raw=False, **operation_config): + """Update 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 tags: Resource tags + :type tags: dict[str, 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 + :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` + """ + parameters = models.LogSearchRuleResourcePatch(tags=tags, enabled=enabled) + + # 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, 'LogSearchRuleResourcePatch') + + # 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('LogSearchRuleResource', 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/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/sdk_packaging.toml b/azure-mgmt-monitor/sdk_packaging.toml new file mode 100644 index 000000000000..bdaf36684e1e --- /dev/null +++ b/azure-mgmt-monitor/sdk_packaging.toml @@ -0,0 +1,5 @@ +[packaging] +package_name = "azure-mgmt-monitor" +package_pprint_name = "Monitor" +package_doc_id = "monitoring" +is_stable = false diff --git a/azure-mgmt-monitor/setup.py b/azure-mgmt-monitor/setup.py index e0c133de0bf6..6c95e69612cd 100644 --- a/azure-mgmt-monitor/setup.py +++ b/azure-mgmt-monitor/setup.py @@ -77,7 +77,7 @@ zip_safe=False, packages=find_packages(exclude=["tests"]), install_requires=[ - 'msrestazure>=0.4.20,<2.0.0', + 'msrestazure>=0.4.27,<2.0.0', 'azure-common~=1.1', ], cmdclass=cmdclass