Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .operations.operations import Operations
from .operations.alerts_operations import AlertsOperations
from .operations.smart_groups_operations import SmartGroupsOperations
from .operations.smart_detector_alert_rules_operations import SmartDetectorAlertRulesOperations
from . import models


Expand All @@ -33,18 +34,26 @@ class AlertsManagementClientConfiguration(AzureConfiguration):
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param subscription_id1: The Azure subscription id.
:type subscription_id1: str
:param api_version1: Client Api Version.
:type api_version1: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, scope, subscription_id, base_url=None):
self, credentials, scope, subscription_id, subscription_id1, api_version1, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if scope is None:
raise ValueError("Parameter 'scope' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if subscription_id1 is None:
raise ValueError("Parameter 'subscription_id1' must not be None.")
if api_version1 is None:
raise ValueError("Parameter 'api_version1' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

Expand All @@ -56,6 +65,8 @@ def __init__(
self.credentials = credentials
self.scope = scope
self.subscription_id = subscription_id
self.subscription_id1 = subscription_id1
self.api_version1 = api_version1


class AlertsManagementClient(SDKClient):
Expand All @@ -70,6 +81,8 @@ class AlertsManagementClient(SDKClient):
:vartype alerts: azure.mgmt.alertsmanagement.operations.AlertsOperations
:ivar smart_groups: SmartGroups operations
:vartype smart_groups: azure.mgmt.alertsmanagement.operations.SmartGroupsOperations
:ivar smart_detector_alert_rules: SmartDetectorAlertRules operations
:vartype smart_detector_alert_rules: azure.mgmt.alertsmanagement.operations.SmartDetectorAlertRulesOperations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand All @@ -80,13 +93,17 @@ class AlertsManagementClient(SDKClient):
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param subscription_id1: The Azure subscription id.
:type subscription_id1: str
:param api_version1: Client Api Version.
:type api_version1: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, scope, subscription_id, base_url=None):
self, credentials, scope, subscription_id, subscription_id1, api_version1, base_url=None):

self.config = AlertsManagementClientConfiguration(credentials, scope, subscription_id, base_url)
self.config = AlertsManagementClientConfiguration(credentials, scope, subscription_id, subscription_id1, api_version1, base_url)
super(AlertsManagementClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
Expand All @@ -100,3 +117,5 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.smart_groups = SmartGroupsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.smart_detector_alert_rules = SmartDetectorAlertRulesOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
from .smart_group_aggregated_property_py3 import SmartGroupAggregatedProperty
from .smart_group_py3 import SmartGroup
from .smart_groups_list_py3 import SmartGroupsList
from .error_response1_py3 import ErrorResponse1, ErrorResponse1Exception
from .action_groups_information_py3 import ActionGroupsInformation
from .throttling_information_py3 import ThrottlingInformation
from .azure_resource_py3 import AzureResource
from .detector_py3 import Detector
from .alert_rule_py3 import AlertRule
except (SyntaxError, ImportError):
from .operation_display import OperationDisplay
from .operation import Operation
Expand All @@ -47,8 +53,15 @@
from .smart_group_aggregated_property import SmartGroupAggregatedProperty
from .smart_group import SmartGroup
from .smart_groups_list import SmartGroupsList
from .error_response1 import ErrorResponse1, ErrorResponse1Exception
from .action_groups_information import ActionGroupsInformation
from .throttling_information import ThrottlingInformation
from .azure_resource import AzureResource
from .detector import Detector
from .alert_rule import AlertRule
from .operation_paged import OperationPaged
from .alert_paged import AlertPaged
from .alert_rule_paged import AlertRulePaged
from .alerts_management_client_enums import (
Severity,
SignalType,
Expand All @@ -58,6 +71,7 @@
AlertModificationEvent,
SmartGroupModificationEvent,
State,
AlertRuleState,
TimeRange,
AlertsSortByFields,
AlertsSummaryGroupByFields,
Expand All @@ -83,8 +97,15 @@
'SmartGroupAggregatedProperty',
'SmartGroup',
'SmartGroupsList',
'ErrorResponse1', 'ErrorResponse1Exception',
'ActionGroupsInformation',
'ThrottlingInformation',
'AzureResource',
'Detector',
'AlertRule',
'OperationPaged',
'AlertPaged',
'AlertRulePaged',
'Severity',
'SignalType',
'AlertState',
Expand All @@ -93,6 +114,7 @@
'AlertModificationEvent',
'SmartGroupModificationEvent',
'State',
'AlertRuleState',
'TimeRange',
'AlertsSortByFields',
'AlertsSummaryGroupByFields',
Expand Down
Original file line number Diff line number Diff line change
@@ -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 ActionGroupsInformation(Model):
"""The Action Groups information, used by the alert rule.

All required parameters must be populated in order to send to Azure.

:param custom_email_subject: An optional custom email subject to use in
email notifications.
:type custom_email_subject: str
:param custom_webhook_payload: An optional custom web-hook payload to use
in web-hook notifications.
:type custom_webhook_payload: str
:param group_ids: Required. The Action Group resource IDs.
:type group_ids: list[str]
"""

_validation = {
'group_ids': {'required': True},
}

_attribute_map = {
'custom_email_subject': {'key': 'customEmailSubject', 'type': 'str'},
'custom_webhook_payload': {'key': 'customWebhookPayload', 'type': 'str'},
'group_ids': {'key': 'groupIds', 'type': '[str]'},
}

def __init__(self, **kwargs):
super(ActionGroupsInformation, self).__init__(**kwargs)
self.custom_email_subject = kwargs.get('custom_email_subject', None)
self.custom_webhook_payload = kwargs.get('custom_webhook_payload', None)
self.group_ids = kwargs.get('group_ids', None)
Original file line number Diff line number Diff line change
@@ -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 ActionGroupsInformation(Model):
"""The Action Groups information, used by the alert rule.

All required parameters must be populated in order to send to Azure.

:param custom_email_subject: An optional custom email subject to use in
email notifications.
:type custom_email_subject: str
:param custom_webhook_payload: An optional custom web-hook payload to use
in web-hook notifications.
:type custom_webhook_payload: str
:param group_ids: Required. The Action Group resource IDs.
:type group_ids: list[str]
"""

_validation = {
'group_ids': {'required': True},
}

_attribute_map = {
'custom_email_subject': {'key': 'customEmailSubject', 'type': 'str'},
'custom_webhook_payload': {'key': 'customWebhookPayload', 'type': 'str'},
'group_ids': {'key': 'groupIds', 'type': '[str]'},
}

def __init__(self, *, group_ids, custom_email_subject: str=None, custom_webhook_payload: str=None, **kwargs) -> None:
super(ActionGroupsInformation, self).__init__(**kwargs)
self.custom_email_subject = custom_email_subject
self.custom_webhook_payload = custom_webhook_payload
self.group_ids = group_ids
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# 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 .azure_resource import AzureResource


class AlertRule(AzureResource):
"""The alert rule information.

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: The resource ID.
:vartype id: str
:ivar type: The resource type.
:vartype type: str
:ivar name: The resource name.
:vartype name: str
:param description: The alert rule description.
:type description: str
:param state: Required. The alert rule state. Possible values include:
'Enabled', 'Disabled'
:type state: str or ~azure.mgmt.alertsmanagement.models.AlertRuleState
:param severity: Required. The alert rule severity. Possible values
include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4'
:type severity: str or ~azure.mgmt.alertsmanagement.models.Severity
:param frequency: Required. The alert rule frequency in ISO8601 format.
The time granularity must be in minutes and minimum value is 5 minutes.
:type frequency: timedelta
:param detector: Required. The alert rule's detector.
:type detector: ~azure.mgmt.alertsmanagement.models.Detector
:param scope: Required. The alert rule resources scope.
:type scope: list[str]
:param action_groups: Required. The alert rule actions.
:type action_groups:
~azure.mgmt.alertsmanagement.models.ActionGroupsInformation
:param throttling: The alert rule throttling information.
:type throttling:
~azure.mgmt.alertsmanagement.models.ThrottlingInformation
"""

_validation = {
'id': {'readonly': True},
'type': {'readonly': True},
'name': {'readonly': True},
'state': {'required': True},
'severity': {'required': True},
'frequency': {'required': True},
'detector': {'required': True},
'scope': {'required': True},
'action_groups': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'state': {'key': 'properties.state', 'type': 'str'},
'severity': {'key': 'properties.severity', 'type': 'str'},
'frequency': {'key': 'properties.frequency', 'type': 'duration'},
'detector': {'key': 'properties.detector', 'type': 'Detector'},
'scope': {'key': 'properties.scope', 'type': '[str]'},
'action_groups': {'key': 'properties.actionGroups', 'type': 'ActionGroupsInformation'},
'throttling': {'key': 'properties.throttling', 'type': 'ThrottlingInformation'},
}

def __init__(self, **kwargs):
super(AlertRule, self).__init__(**kwargs)
self.description = kwargs.get('description', None)
self.state = kwargs.get('state', None)
self.severity = kwargs.get('severity', None)
self.frequency = kwargs.get('frequency', None)
self.detector = kwargs.get('detector', None)
self.scope = kwargs.get('scope', None)
self.action_groups = kwargs.get('action_groups', None)
self.throttling = kwargs.get('throttling', None)
Original file line number Diff line number Diff line change
@@ -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 AlertRulePaged(Paged):
"""
A paging container for iterating over a list of :class:`AlertRule <azure.mgmt.alertsmanagement.models.AlertRule>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[AlertRule]'}
}

def __init__(self, *args, **kwargs):

super(AlertRulePaged, self).__init__(*args, **kwargs)
Loading