Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ReleasePR azure-mgmt-alertsmanagement] Fixed ActionRule's polymorphism via discriminator #13932

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 @@ -13,10 +13,10 @@
from msrest import Serializer, Deserializer

from ._configuration import AlertsManagementClientConfiguration
from .operations import ActionRulesOperations
from .operations import Operations
from .operations import AlertsOperations
from .operations import SmartGroupsOperations
from .operations import ActionRulesOperations
from .operations import SmartDetectorAlertRulesOperations
from . import models

Expand All @@ -27,14 +27,14 @@ class AlertsManagementClient(SDKClient):
:ivar config: Configuration for client.
:vartype config: AlertsManagementClientConfiguration

:ivar action_rules: ActionRules operations
:vartype action_rules: azure.mgmt.alertsmanagement.operations.ActionRulesOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.alertsmanagement.operations.Operations
:ivar alerts: Alerts operations
:vartype alerts: azure.mgmt.alertsmanagement.operations.AlertsOperations
:ivar smart_groups: SmartGroups operations
:vartype smart_groups: azure.mgmt.alertsmanagement.operations.SmartGroupsOperations
:ivar action_rules: ActionRules operations
:vartype action_rules: azure.mgmt.alertsmanagement.operations.ActionRulesOperations
:ivar smart_detector_alert_rules: SmartDetectorAlertRules operations
:vartype smart_detector_alert_rules: azure.mgmt.alertsmanagement.operations.SmartDetectorAlertRulesOperations

Expand All @@ -43,26 +43,28 @@ class AlertsManagementClient(SDKClient):
object<msrestazure.azure_active_directory>`
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param subscription_id1: The ID of the target subscription.
:type subscription_id1: str
:param str base_url: Service URL
"""

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

self.config = AlertsManagementClientConfiguration(credentials, subscription_id, base_url)
self.config = AlertsManagementClientConfiguration(credentials, subscription_id, subscription_id1, 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)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.action_rules = ActionRulesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.alerts = AlertsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.smart_groups = SmartGroupsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.action_rules = ActionRulesOperations(
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 @@ -23,16 +23,20 @@ class AlertsManagementClientConfiguration(AzureConfiguration):
object<msrestazure.azure_active_directory>`
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param subscription_id1: The ID of the target subscription.
:type subscription_id1: str
:param str base_url: Service URL
"""

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

if credentials is None:
raise ValueError("Parameter 'credentials' 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 not base_url:
base_url = 'https://management.azure.com'

Expand All @@ -46,3 +50,4 @@ def __init__(

self.credentials = credentials
self.subscription_id = subscription_id
self.subscription_id1 = subscription_id1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from ._models_py3 import Detector
from ._models_py3 import Diagnostics
from ._models_py3 import ErrorResponse, ErrorResponseException
from ._models_py3 import ErrorResponse1, ErrorResponse1Exception
from ._models_py3 import ErrorResponseBody
from ._models_py3 import Essentials
from ._models_py3 import ManagedResource
Expand All @@ -43,6 +42,7 @@
from ._models_py3 import PatchObject
from ._models_py3 import Resource
from ._models_py3 import Scope
from ._models_py3 import SmartDetectorErrorResponse, SmartDetectorErrorResponseException
from ._models_py3 import SmartGroup
from ._models_py3 import SmartGroupAggregatedProperty
from ._models_py3 import SmartGroupModification
Expand Down Expand Up @@ -75,7 +75,6 @@
from ._models import Detector
from ._models import Diagnostics
from ._models import ErrorResponse, ErrorResponseException
from ._models import ErrorResponse1, ErrorResponse1Exception
from ._models import ErrorResponseBody
from ._models import Essentials
from ._models import ManagedResource
Expand All @@ -86,6 +85,7 @@
from ._models import PatchObject
from ._models import Resource
from ._models import Scope
from ._models import SmartDetectorErrorResponse, SmartDetectorErrorResponseException
from ._models import SmartGroup
from ._models import SmartGroupAggregatedProperty
from ._models import SmartGroupModification
Expand All @@ -101,6 +101,10 @@
from ._paged_models import OperationPaged
from ._paged_models import SmartGroupPaged
from ._alerts_management_client_enums import (
ScopeType,
Operator,
SuppressionType,
ActionRuleStatus,
Severity,
SignalType,
AlertState,
Expand All @@ -109,10 +113,6 @@
AlertModificationEvent,
SmartGroupModificationEvent,
State,
ScopeType,
Operator,
SuppressionType,
ActionRuleStatus,
AlertRuleState,
TimeRange,
AlertsSortByFields,
Expand Down Expand Up @@ -143,7 +143,6 @@
'Detector',
'Diagnostics',
'ErrorResponse', 'ErrorResponseException',
'ErrorResponse1', 'ErrorResponse1Exception',
'ErrorResponseBody',
'Essentials',
'ManagedResource',
Expand All @@ -154,6 +153,7 @@
'PatchObject',
'Resource',
'Scope',
'SmartDetectorErrorResponse', 'SmartDetectorErrorResponseException',
'SmartGroup',
'SmartGroupAggregatedProperty',
'SmartGroupModification',
Expand All @@ -163,11 +163,15 @@
'SuppressionConfig',
'SuppressionSchedule',
'ThrottlingInformation',
'ActionRulePaged',
'OperationPaged',
'AlertPaged',
'SmartGroupPaged',
'ActionRulePaged',
'AlertRulePaged',
'ScopeType',
'Operator',
'SuppressionType',
'ActionRuleStatus',
'Severity',
'SignalType',
'AlertState',
Expand All @@ -176,10 +180,6 @@
'AlertModificationEvent',
'SmartGroupModificationEvent',
'State',
'ScopeType',
'Operator',
'SuppressionType',
'ActionRuleStatus',
'AlertRuleState',
'TimeRange',
'AlertsSortByFields',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@
from enum import Enum


class ScopeType(str, Enum):

resource_group = "ResourceGroup"
resource = "Resource"
subscription = "Subscription"


class Operator(str, Enum):

equals = "Equals"
not_equals = "NotEquals"
contains = "Contains"
does_not_contain = "DoesNotContain"


class SuppressionType(str, Enum):

always = "Always"
once = "Once"
daily = "Daily"
weekly = "Weekly"
monthly = "Monthly"


class ActionRuleStatus(str, Enum):

enabled = "Enabled"
disabled = "Disabled"


class Severity(str, Enum):

sev0 = "Sev0"
Expand Down Expand Up @@ -64,6 +94,12 @@ class AlertModificationEvent(str, Enum):
alert_created = "AlertCreated"
state_change = "StateChange"
monitor_condition_change = "MonitorConditionChange"
severity_change = "SeverityChange"
action_rule_triggered = "ActionRuleTriggered"
action_rule_suppressed = "ActionRuleSuppressed"
actions_triggered = "ActionsTriggered"
actions_suppressed = "ActionsSuppressed"
actions_failed = "ActionsFailed"


class SmartGroupModificationEvent(str, Enum):
Expand All @@ -81,35 +117,6 @@ class State(str, Enum):
closed = "Closed"


class ScopeType(str, Enum):

resource_group = "ResourceGroup"
resource = "Resource"


class Operator(str, Enum):

equals = "Equals"
not_equals = "NotEquals"
contains = "Contains"
does_not_contain = "DoesNotContain"


class SuppressionType(str, Enum):

always = "Always"
once = "Once"
daily = "Daily"
weekly = "Weekly"
monthly = "Monthly"


class ActionRuleStatus(str, Enum):

enabled = "Enabled"
disabled = "Disabled"


class AlertRuleState(str, Enum):

enabled = "Enabled"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ class AlertModificationItem(Model):
"""Alert modification item.

:param modification_event: Reason for the modification. Possible values
include: 'AlertCreated', 'StateChange', 'MonitorConditionChange'
include: 'AlertCreated', 'StateChange', 'MonitorConditionChange',
'SeverityChange', 'ActionRuleTriggered', 'ActionRuleSuppressed',
'ActionsTriggered', 'ActionsSuppressed', 'ActionsFailed'
:type modification_event: str or
~azure.mgmt.alertsmanagement.models.AlertModificationEvent
:param old_value: Old value
Expand Down Expand Up @@ -993,38 +995,6 @@ def __init__(self, deserialize, response, *args):
super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args)


class ErrorResponse1(Model):
"""Describe the format of an Error response.

:param code: Error code
:type code: str
:param message: Error message indicating why the operation failed.
:type message: str
"""

_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}

def __init__(self, **kwargs):
super(ErrorResponse1, self).__init__(**kwargs)
self.code = kwargs.get('code', None)
self.message = kwargs.get('message', None)


class ErrorResponse1Exception(HttpOperationError):
"""Server responsed with exception of type: 'ErrorResponse1'.

:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(ErrorResponse1Exception, self).__init__(deserialize, response, 'ErrorResponse1', *args)


class ErrorResponseBody(Model):
"""Details of error response.

Expand Down Expand Up @@ -1306,7 +1276,7 @@ class Scope(Model):
resources from the scope subscription as well.

:param scope_type: type of target scope. Possible values include:
'ResourceGroup', 'Resource'
'ResourceGroup', 'Resource', 'Subscription'
:type scope_type: str or ~azure.mgmt.alertsmanagement.models.ScopeType
:param values: list of ARM IDs of the given scope type which will be the
target of the given action rule.
Expand All @@ -1324,6 +1294,38 @@ def __init__(self, **kwargs):
self.values = kwargs.get('values', None)


class SmartDetectorErrorResponse(Model):
"""Describe the format of an Error response.

:param code: Error code
:type code: str
:param message: Error message indicating why the operation failed.
:type message: str
"""

_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}

def __init__(self, **kwargs):
super(SmartDetectorErrorResponse, self).__init__(**kwargs)
self.code = kwargs.get('code', None)
self.message = kwargs.get('message', None)


class SmartDetectorErrorResponseException(HttpOperationError):
"""Server responsed with exception of type: 'SmartDetectorErrorResponse'.

:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(SmartDetectorErrorResponseException, self).__init__(deserialize, response, 'SmartDetectorErrorResponse', *args)


class SmartGroup(Resource):
"""Set of related alerts grouped together smartly by AMS.

Expand Down
Loading