diff --git a/azure-mgmt-alertsmanagement/HISTORY.rst b/azure-mgmt-alertsmanagement/HISTORY.rst new file mode 100644 index 000000000000..2719b1b9c080 --- /dev/null +++ b/azure-mgmt-alertsmanagement/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +0.1.0 (2018-09-17) +++++++++++++++++++ + +* Initial Release diff --git a/azure-mgmt-alertsmanagement/MANIFEST.in b/azure-mgmt-alertsmanagement/MANIFEST.in new file mode 100644 index 000000000000..9ecaeb15de50 --- /dev/null +++ b/azure-mgmt-alertsmanagement/MANIFEST.in @@ -0,0 +1,2 @@ +include *.rst +include azure_bdist_wheel.py \ No newline at end of file diff --git a/azure-mgmt-alertsmanagement/README.rst b/azure-mgmt-alertsmanagement/README.rst new file mode 100644 index 000000000000..d22a2c65319f --- /dev/null +++ b/azure-mgmt-alertsmanagement/README.rst @@ -0,0 +1,49 @@ +Microsoft Azure SDK for Python +============================== + +This is the Microsoft Azure Alerts Management Client Library. + +Azure Resource Manager (ARM) is the next generation of management APIs that +replace the old Azure Service Management (ASM). + +This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. + +For the older Azure Service Management (ASM) libraries, see +`azure-servicemanagement-legacy `__ library. + +For a more complete set of Azure libraries, see the `azure `__ bundle package. + + +Compatibility +============= + +**IMPORTANT**: If you have an earlier version of the azure package +(version < 1.0), you should uninstall it before installing this package. + +You can check the version using pip: + +.. code:: shell + + pip freeze + +If you see azure==0.11.0 (or any version below 1.0), uninstall it first: + +.. code:: shell + + pip uninstall azure + + +Usage +===== + +For code examples, see `Alerts Management +`__ +on docs.microsoft.com. + + +Provide Feedback +================ + +If you encounter any bugs or have suggestions, please file an issue in the +`Issues `__ +section of the project. diff --git a/azure-mgmt-alertsmanagement/azure/__init__.py b/azure-mgmt-alertsmanagement/azure/__init__.py new file mode 100644 index 000000000000..de40ea7ca058 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/__init__.py b/azure-mgmt-alertsmanagement/azure/mgmt/__init__.py new file mode 100644 index 000000000000..de40ea7ca058 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/__init__.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/__init__.py new file mode 100644 index 000000000000..5512ab09648e --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/__init__.py @@ -0,0 +1,18 @@ +# 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 .alerts_management_client import AlertsManagementClient +from .version import VERSION + +__all__ = ['AlertsManagementClient'] + +__version__ = VERSION + diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/alerts_management_client.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/alerts_management_client.py new file mode 100644 index 000000000000..735b0c12b85c --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/alerts_management_client.py @@ -0,0 +1,95 @@ +# 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.service_client import SDKClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.operations import Operations +from .operations.alerts_operations import AlertsOperations +from .operations.smart_groups_operations import SmartGroupsOperations +from . import models + + +class AlertsManagementClientConfiguration(AzureConfiguration): + """Configuration for AlertsManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription credentials which uniquely identify + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, 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 not base_url: + base_url = 'http://localhost' + + super(AlertsManagementClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-mgmt-alertsmanagement/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class AlertsManagementClient(SDKClient): + """AlertsManagement Client + + :ivar config: Configuration for client. + :vartype config: AlertsManagementClientConfiguration + + :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 + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription credentials which uniquely identify + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = AlertsManagementClientConfiguration(credentials, subscription_id, 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.api_version = '2018-05-05' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + 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) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/__init__.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/__init__.py new file mode 100644 index 000000000000..b5d44aef16b9 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/__init__.py @@ -0,0 +1,100 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from .operation_display_py3 import OperationDisplay + from .operation_py3 import Operation + from .resource_py3 import Resource + from .essentials_py3 import Essentials + from .alert_properties_py3 import AlertProperties + from .alert_py3 import Alert + from .alert_modification_item_py3 import AlertModificationItem + from .alert_modification_properties_py3 import AlertModificationProperties + from .alert_modification_py3 import AlertModification + from .smart_group_modification_item_py3 import SmartGroupModificationItem + from .smart_group_modification_properties_py3 import SmartGroupModificationProperties + from .smart_group_modification_py3 import SmartGroupModification + from .alerts_summary_group_item_py3 import AlertsSummaryGroupItem + from .alerts_summary_group_py3 import AlertsSummaryGroup + from .alerts_summary_py3 import AlertsSummary + from .smart_group_aggregated_property_py3 import SmartGroupAggregatedProperty + from .smart_group_py3 import SmartGroup + from .smart_groups_list_py3 import SmartGroupsList +except (SyntaxError, ImportError): + from .operation_display import OperationDisplay + from .operation import Operation + from .resource import Resource + from .essentials import Essentials + from .alert_properties import AlertProperties + from .alert import Alert + from .alert_modification_item import AlertModificationItem + from .alert_modification_properties import AlertModificationProperties + from .alert_modification import AlertModification + from .smart_group_modification_item import SmartGroupModificationItem + from .smart_group_modification_properties import SmartGroupModificationProperties + from .smart_group_modification import SmartGroupModification + from .alerts_summary_group_item import AlertsSummaryGroupItem + from .alerts_summary_group import AlertsSummaryGroup + from .alerts_summary import AlertsSummary + from .smart_group_aggregated_property import SmartGroupAggregatedProperty + from .smart_group import SmartGroup + from .smart_groups_list import SmartGroupsList +from .operation_paged import OperationPaged +from .alert_paged import AlertPaged +from .alerts_management_client_enums import ( + Severity, + SignalType, + AlertState, + MonitorCondition, + MonitorService, + AlertModificationEvent, + SmartGroupModificationEvent, + State, + TimeRange, + AlertsSortByFields, + AlertsSummaryGroupByFields, + SmartGroupsSortByFields, +) + +__all__ = [ + 'OperationDisplay', + 'Operation', + 'Resource', + 'Essentials', + 'AlertProperties', + 'Alert', + 'AlertModificationItem', + 'AlertModificationProperties', + 'AlertModification', + 'SmartGroupModificationItem', + 'SmartGroupModificationProperties', + 'SmartGroupModification', + 'AlertsSummaryGroupItem', + 'AlertsSummaryGroup', + 'AlertsSummary', + 'SmartGroupAggregatedProperty', + 'SmartGroup', + 'SmartGroupsList', + 'OperationPaged', + 'AlertPaged', + 'Severity', + 'SignalType', + 'AlertState', + 'MonitorCondition', + 'MonitorService', + 'AlertModificationEvent', + 'SmartGroupModificationEvent', + 'State', + 'TimeRange', + 'AlertsSortByFields', + 'AlertsSummaryGroupByFields', + 'SmartGroupsSortByFields', +] diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert.py new file mode 100644 index 000000000000..634c2c747b17 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert.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 .resource import Resource + + +class Alert(Resource): + """An alert created in alert management service. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + :param properties: + :type properties: ~azure.mgmt.alertsmanagement.models.AlertProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'AlertProperties'}, + } + + def __init__(self, **kwargs): + super(Alert, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification.py new file mode 100644 index 000000000000..e2d77167596c --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification.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 .resource import Resource + + +class AlertModification(Resource): + """Alert Modification details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + :param properties: + :type properties: + ~azure.mgmt.alertsmanagement.models.AlertModificationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'AlertModificationProperties'}, + } + + def __init__(self, **kwargs): + super(AlertModification, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_item.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_item.py new file mode 100644 index 000000000000..50915b06ce40 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_item.py @@ -0,0 +1,54 @@ +# 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 AlertModificationItem(Model): + """Alert modification item. + + :param modification_event: Reason for the modification. Possible values + include: 'AlertCreated', 'StateChange', 'MonitorConditionChange' + :type modification_event: str or + ~azure.mgmt.alertsmanagement.models.AlertModificationEvent + :param old_value: Old value + :type old_value: str + :param new_value: New value + :type new_value: str + :param modified_at: Modified date and time + :type modified_at: str + :param modified_by: Modified user details (Principal client name) + :type modified_by: str + :param comments: Modification comments + :type comments: str + :param description: Description of the modification + :type description: str + """ + + _attribute_map = { + 'modification_event': {'key': 'modificationEvent', 'type': 'AlertModificationEvent'}, + 'old_value': {'key': 'oldValue', 'type': 'str'}, + 'new_value': {'key': 'newValue', 'type': 'str'}, + 'modified_at': {'key': 'modifiedAt', 'type': 'str'}, + 'modified_by': {'key': 'modifiedBy', 'type': 'str'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AlertModificationItem, self).__init__(**kwargs) + self.modification_event = kwargs.get('modification_event', None) + self.old_value = kwargs.get('old_value', None) + self.new_value = kwargs.get('new_value', None) + self.modified_at = kwargs.get('modified_at', None) + self.modified_by = kwargs.get('modified_by', None) + self.comments = kwargs.get('comments', None) + self.description = kwargs.get('description', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_item_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_item_py3.py new file mode 100644 index 000000000000..b051daad6d2a --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_item_py3.py @@ -0,0 +1,54 @@ +# 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 AlertModificationItem(Model): + """Alert modification item. + + :param modification_event: Reason for the modification. Possible values + include: 'AlertCreated', 'StateChange', 'MonitorConditionChange' + :type modification_event: str or + ~azure.mgmt.alertsmanagement.models.AlertModificationEvent + :param old_value: Old value + :type old_value: str + :param new_value: New value + :type new_value: str + :param modified_at: Modified date and time + :type modified_at: str + :param modified_by: Modified user details (Principal client name) + :type modified_by: str + :param comments: Modification comments + :type comments: str + :param description: Description of the modification + :type description: str + """ + + _attribute_map = { + 'modification_event': {'key': 'modificationEvent', 'type': 'AlertModificationEvent'}, + 'old_value': {'key': 'oldValue', 'type': 'str'}, + 'new_value': {'key': 'newValue', 'type': 'str'}, + 'modified_at': {'key': 'modifiedAt', 'type': 'str'}, + 'modified_by': {'key': 'modifiedBy', 'type': 'str'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, modification_event=None, old_value: str=None, new_value: str=None, modified_at: str=None, modified_by: str=None, comments: str=None, description: str=None, **kwargs) -> None: + super(AlertModificationItem, self).__init__(**kwargs) + self.modification_event = modification_event + self.old_value = old_value + self.new_value = new_value + self.modified_at = modified_at + self.modified_by = modified_by + self.comments = comments + self.description = description diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_properties.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_properties.py new file mode 100644 index 000000000000..c1d1b8123ecd --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_properties.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 AlertModificationProperties(Model): + """Properties of the alert modification item. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar alert_id: Unique Id of the alert for which the history is being + retrieved + :vartype alert_id: str + :param modifications: Modification details + :type modifications: + list[~azure.mgmt.alertsmanagement.models.AlertModificationItem] + """ + + _validation = { + 'alert_id': {'readonly': True}, + } + + _attribute_map = { + 'alert_id': {'key': 'alertId', 'type': 'str'}, + 'modifications': {'key': 'modifications', 'type': '[AlertModificationItem]'}, + } + + def __init__(self, **kwargs): + super(AlertModificationProperties, self).__init__(**kwargs) + self.alert_id = None + self.modifications = kwargs.get('modifications', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_properties_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_properties_py3.py new file mode 100644 index 000000000000..51e67637a07a --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_properties_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 AlertModificationProperties(Model): + """Properties of the alert modification item. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar alert_id: Unique Id of the alert for which the history is being + retrieved + :vartype alert_id: str + :param modifications: Modification details + :type modifications: + list[~azure.mgmt.alertsmanagement.models.AlertModificationItem] + """ + + _validation = { + 'alert_id': {'readonly': True}, + } + + _attribute_map = { + 'alert_id': {'key': 'alertId', 'type': 'str'}, + 'modifications': {'key': 'modifications', 'type': '[AlertModificationItem]'}, + } + + def __init__(self, *, modifications=None, **kwargs) -> None: + super(AlertModificationProperties, self).__init__(**kwargs) + self.alert_id = None + self.modifications = modifications diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_py3.py new file mode 100644 index 000000000000..b7cae8114091 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_modification_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 .resource_py3 import Resource + + +class AlertModification(Resource): + """Alert Modification details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + :param properties: + :type properties: + ~azure.mgmt.alertsmanagement.models.AlertModificationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'AlertModificationProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(AlertModification, self).__init__(**kwargs) + self.properties = properties diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_paged.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_paged.py new file mode 100644 index 000000000000..2ae2c88ee2e1 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_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 AlertPaged(Paged): + """ + A paging container for iterating over a list of :class:`Alert ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Alert]'} + } + + def __init__(self, *args, **kwargs): + + super(AlertPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_properties.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_properties.py new file mode 100644 index 000000000000..a8c7b761aba5 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_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 AlertProperties(Model): + """Alert property bag. + + :param essentials: + :type essentials: ~azure.mgmt.alertsmanagement.models.Essentials + :param context: + :type context: object + :param egress_config: + :type egress_config: object + """ + + _attribute_map = { + 'essentials': {'key': 'essentials', 'type': 'Essentials'}, + 'context': {'key': 'context', 'type': 'object'}, + 'egress_config': {'key': 'egressConfig', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(AlertProperties, self).__init__(**kwargs) + self.essentials = kwargs.get('essentials', None) + self.context = kwargs.get('context', None) + self.egress_config = kwargs.get('egress_config', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_properties_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_properties_py3.py new file mode 100644 index 000000000000..a6c9cf43db24 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_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 AlertProperties(Model): + """Alert property bag. + + :param essentials: + :type essentials: ~azure.mgmt.alertsmanagement.models.Essentials + :param context: + :type context: object + :param egress_config: + :type egress_config: object + """ + + _attribute_map = { + 'essentials': {'key': 'essentials', 'type': 'Essentials'}, + 'context': {'key': 'context', 'type': 'object'}, + 'egress_config': {'key': 'egressConfig', 'type': 'object'}, + } + + def __init__(self, *, essentials=None, context=None, egress_config=None, **kwargs) -> None: + super(AlertProperties, self).__init__(**kwargs) + self.essentials = essentials + self.context = context + self.egress_config = egress_config diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_py3.py new file mode 100644 index 000000000000..4068ed33b63a --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alert_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 .resource_py3 import Resource + + +class Alert(Resource): + """An alert created in alert management service. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + :param properties: + :type properties: ~azure.mgmt.alertsmanagement.models.AlertProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'AlertProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(Alert, self).__init__(**kwargs) + self.properties = properties diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_management_client_enums.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_management_client_enums.py new file mode 100644 index 000000000000..f3295fc6ef88 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_management_client_enums.py @@ -0,0 +1,122 @@ +# 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 enum import Enum + + +class Severity(str, Enum): + + sev0 = "Sev0" + sev1 = "Sev1" + sev2 = "Sev2" + sev3 = "Sev3" + sev4 = "Sev4" + + +class SignalType(str, Enum): + + metric = "Metric" + log = "Log" + unknown = "Unknown" + + +class AlertState(str, Enum): + + new = "New" + acknowledged = "Acknowledged" + closed = "Closed" + + +class MonitorCondition(str, Enum): + + fired = "Fired" + resolved = "Resolved" + + +class MonitorService(str, Enum): + + application_insights = "Application Insights" + activity_log_administrative = "ActivityLog Administrative" + activity_log_security = "ActivityLog Security" + activity_log_recommendation = "ActivityLog Recommendation" + activity_log_policy = "ActivityLog Policy" + activity_log_autoscale = "ActivityLog Autoscale" + log_analytics = "Log Analytics" + nagios = "Nagios" + platform = "Platform" + scom = "SCOM" + service_health = "ServiceHealth" + smart_detector = "SmartDetector" + vm_insights = "VM Insights" + zabbix = "Zabbix" + + +class AlertModificationEvent(str, Enum): + + alert_created = "AlertCreated" + state_change = "StateChange" + monitor_condition_change = "MonitorConditionChange" + + +class SmartGroupModificationEvent(str, Enum): + + smart_group_created = "SmartGroupCreated" + state_change = "StateChange" + alert_added = "AlertAdded" + alert_removed = "AlertRemoved" + + +class State(str, Enum): + + new = "New" + acknowledged = "Acknowledged" + closed = "Closed" + + +class TimeRange(str, Enum): + + oneh = "1h" + oned = "1d" + sevend = "7d" + three_zerod = "30d" + + +class AlertsSortByFields(str, Enum): + + name = "name" + severity = "severity" + alert_state = "alertState" + monitor_condition = "monitorCondition" + target_resource = "targetResource" + target_resource_name = "targetResourceName" + target_resource_group = "targetResourceGroup" + target_resource_type = "targetResourceType" + start_date_time = "startDateTime" + last_modified_date_time = "lastModifiedDateTime" + + +class AlertsSummaryGroupByFields(str, Enum): + + severity = "severity" + alert_state = "alertState" + monitor_condition = "monitorCondition" + monitor_service = "monitorService" + signal_type = "signalType" + alert_rule = "alertRule" + + +class SmartGroupsSortByFields(str, Enum): + + alerts_count = "alertsCount" + state = "state" + severity = "severity" + start_date_time = "startDateTime" + last_modified_date_time = "lastModifiedDateTime" diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary.py new file mode 100644 index 000000000000..9521d5cb5d32 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary.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 .resource import Resource + + +class AlertsSummary(Resource): + """Summary of alerts based on the input filters and 'groupby' parameters. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + :param properties: + :type properties: ~azure.mgmt.alertsmanagement.models.AlertsSummaryGroup + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'AlertsSummaryGroup'}, + } + + def __init__(self, **kwargs): + super(AlertsSummary, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group.py new file mode 100644 index 000000000000..470f52f8efdf --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group.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 AlertsSummaryGroup(Model): + """Group the result set. + + :param total: Total count of the result set. + :type total: int + :param smart_groups_count: Total count of the smart groups. + :type smart_groups_count: int + :param groupedby: Name of the field aggregated + :type groupedby: str + :param values: List of the items + :type values: + list[~azure.mgmt.alertsmanagement.models.AlertsSummaryGroupItem] + """ + + _attribute_map = { + 'total': {'key': 'total', 'type': 'int'}, + 'smart_groups_count': {'key': 'smartGroupsCount', 'type': 'int'}, + 'groupedby': {'key': 'groupedby', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[AlertsSummaryGroupItem]'}, + } + + def __init__(self, **kwargs): + super(AlertsSummaryGroup, self).__init__(**kwargs) + self.total = kwargs.get('total', None) + self.smart_groups_count = kwargs.get('smart_groups_count', None) + self.groupedby = kwargs.get('groupedby', None) + self.values = kwargs.get('values', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group_item.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group_item.py new file mode 100644 index 000000000000..232fd9f12e08 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group_item.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 AlertsSummaryGroupItem(Model): + """Alerts summary group item. + + :param name: Value of the aggregated field + :type name: str + :param count: Count of the aggregated field + :type count: int + :param groupedby: Name of the field aggregated + :type groupedby: str + :param values: List of the items + :type values: + list[~azure.mgmt.alertsmanagement.models.AlertsSummaryGroupItem] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + 'groupedby': {'key': 'groupedby', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[AlertsSummaryGroupItem]'}, + } + + def __init__(self, **kwargs): + super(AlertsSummaryGroupItem, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.count = kwargs.get('count', None) + self.groupedby = kwargs.get('groupedby', None) + self.values = kwargs.get('values', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group_item_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group_item_py3.py new file mode 100644 index 000000000000..f802c4f1eaa3 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group_item_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 AlertsSummaryGroupItem(Model): + """Alerts summary group item. + + :param name: Value of the aggregated field + :type name: str + :param count: Count of the aggregated field + :type count: int + :param groupedby: Name of the field aggregated + :type groupedby: str + :param values: List of the items + :type values: + list[~azure.mgmt.alertsmanagement.models.AlertsSummaryGroupItem] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + 'groupedby': {'key': 'groupedby', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[AlertsSummaryGroupItem]'}, + } + + def __init__(self, *, name: str=None, count: int=None, groupedby: str=None, values=None, **kwargs) -> None: + super(AlertsSummaryGroupItem, self).__init__(**kwargs) + self.name = name + self.count = count + self.groupedby = groupedby + self.values = values diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group_py3.py new file mode 100644 index 000000000000..b9d4c71d3403 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_group_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 AlertsSummaryGroup(Model): + """Group the result set. + + :param total: Total count of the result set. + :type total: int + :param smart_groups_count: Total count of the smart groups. + :type smart_groups_count: int + :param groupedby: Name of the field aggregated + :type groupedby: str + :param values: List of the items + :type values: + list[~azure.mgmt.alertsmanagement.models.AlertsSummaryGroupItem] + """ + + _attribute_map = { + 'total': {'key': 'total', 'type': 'int'}, + 'smart_groups_count': {'key': 'smartGroupsCount', 'type': 'int'}, + 'groupedby': {'key': 'groupedby', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[AlertsSummaryGroupItem]'}, + } + + def __init__(self, *, total: int=None, smart_groups_count: int=None, groupedby: str=None, values=None, **kwargs) -> None: + super(AlertsSummaryGroup, self).__init__(**kwargs) + self.total = total + self.smart_groups_count = smart_groups_count + self.groupedby = groupedby + self.values = values diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_py3.py new file mode 100644 index 000000000000..ed41ea6d10de --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/alerts_summary_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 .resource_py3 import Resource + + +class AlertsSummary(Resource): + """Summary of alerts based on the input filters and 'groupby' parameters. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + :param properties: + :type properties: ~azure.mgmt.alertsmanagement.models.AlertsSummaryGroup + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'AlertsSummaryGroup'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(AlertsSummary, self).__init__(**kwargs) + self.properties = properties diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/essentials.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/essentials.py new file mode 100644 index 000000000000..a333d42f1b82 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/essentials.py @@ -0,0 +1,138 @@ +# 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 Essentials(Model): + """This object contains normalized fields across different monitor service and + also contains state related fields. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar severity: Severity of alert Sev0 being highest and Sev3 being + lowest. Possible values include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4' + :vartype severity: str or ~azure.mgmt.alertsmanagement.models.Severity + :ivar signal_type: Log based alert or metric based alert. Possible values + include: 'Metric', 'Log', 'Unknown' + :vartype signal_type: str or + ~azure.mgmt.alertsmanagement.models.SignalType + :ivar alert_state: Alert object state, which is modified by the user. + Possible values include: 'New', 'Acknowledged', 'Closed' + :vartype alert_state: str or + ~azure.mgmt.alertsmanagement.models.AlertState + :ivar monitor_condition: Represents rule condition(Fired/Resolved) + maintained by monitor service depending on the state of the state. + Possible values include: 'Fired', 'Resolved' + :vartype monitor_condition: str or + ~azure.mgmt.alertsmanagement.models.MonitorCondition + :param target_resource: Target ARM resource, on which alert got created. + :type target_resource: str + :param target_resource_name: Name of the target ARM resource name, on + which alert got created. + :type target_resource_name: str + :param target_resource_group: Resource group of target ARM resource, on + which alert got created. + :type target_resource_group: str + :param target_resource_type: Resource type of target ARM resource, on + which alert got created. + :type target_resource_type: str + :ivar monitor_service: Monitor service on which the rule(monitor) is set. + Possible values include: 'Application Insights', 'ActivityLog + Administrative', 'ActivityLog Security', 'ActivityLog Recommendation', + 'ActivityLog Policy', 'ActivityLog Autoscale', 'Log Analytics', 'Nagios', + 'Platform', 'SCOM', 'ServiceHealth', 'SmartDetector', 'VM Insights', + 'Zabbix' + :vartype monitor_service: str or + ~azure.mgmt.alertsmanagement.models.MonitorService + :ivar alert_rule: Rule(monitor) which fired alert instance. Depending on + the monitor service, this would be ARM id or name of the rule. + :vartype alert_rule: str + :ivar source_created_id: Unique Id created by monitor service for each + alert instance. This could be used to track the issue at the monitor + service, in case of Nagios, Zabbix, SCOM etc. + :vartype source_created_id: str + :ivar smart_group_id: Unique Id of the smart group + :vartype smart_group_id: str + :ivar smart_grouping_reason: Verbose reason describing the reason why this + alert instance is added to a smart group + :vartype smart_grouping_reason: str + :ivar start_date_time: Creation time(ISO-8601 format) of alert instance. + :vartype start_date_time: datetime + :ivar last_modified_date_time: Last modification time(ISO-8601 format) of + alert instance. + :vartype last_modified_date_time: datetime + :ivar monitor_condition_resolved_date_time: Resolved time(ISO-8601 format) + of alert instance. This will be updated when monitor service resolves the + alert instance because of the rule condition is not met. + :vartype monitor_condition_resolved_date_time: datetime + :ivar last_modified_user_name: User who last modified the alert, in case + of monitor service updates user would be 'system', otherwise name of the + user. + :vartype last_modified_user_name: str + """ + + _validation = { + 'severity': {'readonly': True}, + 'signal_type': {'readonly': True}, + 'alert_state': {'readonly': True}, + 'monitor_condition': {'readonly': True}, + 'monitor_service': {'readonly': True}, + 'alert_rule': {'readonly': True}, + 'source_created_id': {'readonly': True}, + 'smart_group_id': {'readonly': True}, + 'smart_grouping_reason': {'readonly': True}, + 'start_date_time': {'readonly': True}, + 'last_modified_date_time': {'readonly': True}, + 'monitor_condition_resolved_date_time': {'readonly': True}, + 'last_modified_user_name': {'readonly': True}, + } + + _attribute_map = { + 'severity': {'key': 'severity', 'type': 'str'}, + 'signal_type': {'key': 'signalType', 'type': 'str'}, + 'alert_state': {'key': 'alertState', 'type': 'str'}, + 'monitor_condition': {'key': 'monitorCondition', 'type': 'str'}, + 'target_resource': {'key': 'targetResource', 'type': 'str'}, + 'target_resource_name': {'key': 'targetResourceName', 'type': 'str'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + 'target_resource_type': {'key': 'targetResourceType', 'type': 'str'}, + 'monitor_service': {'key': 'monitorService', 'type': 'str'}, + 'alert_rule': {'key': 'alertRule', 'type': 'str'}, + 'source_created_id': {'key': 'sourceCreatedId', 'type': 'str'}, + 'smart_group_id': {'key': 'smartGroupId', 'type': 'str'}, + 'smart_grouping_reason': {'key': 'smartGroupingReason', 'type': 'str'}, + 'start_date_time': {'key': 'startDateTime', 'type': 'iso-8601'}, + 'last_modified_date_time': {'key': 'lastModifiedDateTime', 'type': 'iso-8601'}, + 'monitor_condition_resolved_date_time': {'key': 'monitorConditionResolvedDateTime', 'type': 'iso-8601'}, + 'last_modified_user_name': {'key': 'lastModifiedUserName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Essentials, self).__init__(**kwargs) + self.severity = None + self.signal_type = None + self.alert_state = None + self.monitor_condition = None + self.target_resource = kwargs.get('target_resource', None) + self.target_resource_name = kwargs.get('target_resource_name', None) + self.target_resource_group = kwargs.get('target_resource_group', None) + self.target_resource_type = kwargs.get('target_resource_type', None) + self.monitor_service = None + self.alert_rule = None + self.source_created_id = None + self.smart_group_id = None + self.smart_grouping_reason = None + self.start_date_time = None + self.last_modified_date_time = None + self.monitor_condition_resolved_date_time = None + self.last_modified_user_name = None diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/essentials_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/essentials_py3.py new file mode 100644 index 000000000000..01052b35702e --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/essentials_py3.py @@ -0,0 +1,138 @@ +# 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 Essentials(Model): + """This object contains normalized fields across different monitor service and + also contains state related fields. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar severity: Severity of alert Sev0 being highest and Sev3 being + lowest. Possible values include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4' + :vartype severity: str or ~azure.mgmt.alertsmanagement.models.Severity + :ivar signal_type: Log based alert or metric based alert. Possible values + include: 'Metric', 'Log', 'Unknown' + :vartype signal_type: str or + ~azure.mgmt.alertsmanagement.models.SignalType + :ivar alert_state: Alert object state, which is modified by the user. + Possible values include: 'New', 'Acknowledged', 'Closed' + :vartype alert_state: str or + ~azure.mgmt.alertsmanagement.models.AlertState + :ivar monitor_condition: Represents rule condition(Fired/Resolved) + maintained by monitor service depending on the state of the state. + Possible values include: 'Fired', 'Resolved' + :vartype monitor_condition: str or + ~azure.mgmt.alertsmanagement.models.MonitorCondition + :param target_resource: Target ARM resource, on which alert got created. + :type target_resource: str + :param target_resource_name: Name of the target ARM resource name, on + which alert got created. + :type target_resource_name: str + :param target_resource_group: Resource group of target ARM resource, on + which alert got created. + :type target_resource_group: str + :param target_resource_type: Resource type of target ARM resource, on + which alert got created. + :type target_resource_type: str + :ivar monitor_service: Monitor service on which the rule(monitor) is set. + Possible values include: 'Application Insights', 'ActivityLog + Administrative', 'ActivityLog Security', 'ActivityLog Recommendation', + 'ActivityLog Policy', 'ActivityLog Autoscale', 'Log Analytics', 'Nagios', + 'Platform', 'SCOM', 'ServiceHealth', 'SmartDetector', 'VM Insights', + 'Zabbix' + :vartype monitor_service: str or + ~azure.mgmt.alertsmanagement.models.MonitorService + :ivar alert_rule: Rule(monitor) which fired alert instance. Depending on + the monitor service, this would be ARM id or name of the rule. + :vartype alert_rule: str + :ivar source_created_id: Unique Id created by monitor service for each + alert instance. This could be used to track the issue at the monitor + service, in case of Nagios, Zabbix, SCOM etc. + :vartype source_created_id: str + :ivar smart_group_id: Unique Id of the smart group + :vartype smart_group_id: str + :ivar smart_grouping_reason: Verbose reason describing the reason why this + alert instance is added to a smart group + :vartype smart_grouping_reason: str + :ivar start_date_time: Creation time(ISO-8601 format) of alert instance. + :vartype start_date_time: datetime + :ivar last_modified_date_time: Last modification time(ISO-8601 format) of + alert instance. + :vartype last_modified_date_time: datetime + :ivar monitor_condition_resolved_date_time: Resolved time(ISO-8601 format) + of alert instance. This will be updated when monitor service resolves the + alert instance because of the rule condition is not met. + :vartype monitor_condition_resolved_date_time: datetime + :ivar last_modified_user_name: User who last modified the alert, in case + of monitor service updates user would be 'system', otherwise name of the + user. + :vartype last_modified_user_name: str + """ + + _validation = { + 'severity': {'readonly': True}, + 'signal_type': {'readonly': True}, + 'alert_state': {'readonly': True}, + 'monitor_condition': {'readonly': True}, + 'monitor_service': {'readonly': True}, + 'alert_rule': {'readonly': True}, + 'source_created_id': {'readonly': True}, + 'smart_group_id': {'readonly': True}, + 'smart_grouping_reason': {'readonly': True}, + 'start_date_time': {'readonly': True}, + 'last_modified_date_time': {'readonly': True}, + 'monitor_condition_resolved_date_time': {'readonly': True}, + 'last_modified_user_name': {'readonly': True}, + } + + _attribute_map = { + 'severity': {'key': 'severity', 'type': 'str'}, + 'signal_type': {'key': 'signalType', 'type': 'str'}, + 'alert_state': {'key': 'alertState', 'type': 'str'}, + 'monitor_condition': {'key': 'monitorCondition', 'type': 'str'}, + 'target_resource': {'key': 'targetResource', 'type': 'str'}, + 'target_resource_name': {'key': 'targetResourceName', 'type': 'str'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + 'target_resource_type': {'key': 'targetResourceType', 'type': 'str'}, + 'monitor_service': {'key': 'monitorService', 'type': 'str'}, + 'alert_rule': {'key': 'alertRule', 'type': 'str'}, + 'source_created_id': {'key': 'sourceCreatedId', 'type': 'str'}, + 'smart_group_id': {'key': 'smartGroupId', 'type': 'str'}, + 'smart_grouping_reason': {'key': 'smartGroupingReason', 'type': 'str'}, + 'start_date_time': {'key': 'startDateTime', 'type': 'iso-8601'}, + 'last_modified_date_time': {'key': 'lastModifiedDateTime', 'type': 'iso-8601'}, + 'monitor_condition_resolved_date_time': {'key': 'monitorConditionResolvedDateTime', 'type': 'iso-8601'}, + 'last_modified_user_name': {'key': 'lastModifiedUserName', 'type': 'str'}, + } + + def __init__(self, *, target_resource: str=None, target_resource_name: str=None, target_resource_group: str=None, target_resource_type: str=None, **kwargs) -> None: + super(Essentials, self).__init__(**kwargs) + self.severity = None + self.signal_type = None + self.alert_state = None + self.monitor_condition = None + self.target_resource = target_resource + self.target_resource_name = target_resource_name + self.target_resource_group = target_resource_group + self.target_resource_type = target_resource_type + self.monitor_service = None + self.alert_rule = None + self.source_created_id = None + self.smart_group_id = None + self.smart_grouping_reason = None + self.start_date_time = None + self.last_modified_date_time = None + self.monitor_condition_resolved_date_time = None + self.last_modified_user_name = None diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation.py new file mode 100644 index 000000000000..1b5fea4ff02a --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation.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 Operation(Model): + """Operation provided by provider. + + :param name: Name of the operation + :type name: str + :param display: Properties of the operation + :type display: ~azure.mgmt.alertsmanagement.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_display.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_display.py new file mode 100644 index 000000000000..89c4bdd6ccb6 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_display.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 OperationDisplay(Model): + """Properties of the operation. + + :param provider: Provider name + :type provider: str + :param resource: Resource name + :type resource: str + :param operation: Operation name + :type operation: str + :param description: Description of the operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_display_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_display_py3.py new file mode 100644 index 000000000000..fa3740dfc655 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_display_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 OperationDisplay(Model): + """Properties of the operation. + + :param provider: Provider name + :type provider: str + :param resource: Resource name + :type resource: str + :param operation: Operation name + :type operation: str + :param description: Description of the operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_paged.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_paged.py new file mode 100644 index 000000000000..3794d02c84f1 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_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 OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_py3.py new file mode 100644 index 000000000000..ee66b4cfa181 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/operation_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 Operation(Model): + """Operation provided by provider. + + :param name: Name of the operation + :type name: str + :param display: Properties of the operation + :type display: ~azure.mgmt.alertsmanagement.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/resource.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/resource.py new file mode 100644 index 000000000000..7454d56b9033 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/resource.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 Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/resource_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/resource_py3.py new file mode 100644 index 000000000000..83ff9951fb91 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/resource_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 Resource(Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group.py new file mode 100644 index 000000000000..b1754f67fb4c --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group.py @@ -0,0 +1,118 @@ +# 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 SmartGroup(Resource): + """Set of related alerts grouped together smartly by AMS. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + :param alerts_count: Total number of alerts in smart group + :type alerts_count: int + :ivar smart_group_state: Smart group state. Possible values include: + 'New', 'Acknowledged', 'Closed' + :vartype smart_group_state: str or + ~azure.mgmt.alertsmanagement.models.State + :ivar severity: Severity of smart group is the highest(Sev0 >... > Sev4) + severity of all the alerts in the group. Possible values include: 'Sev0', + 'Sev1', 'Sev2', 'Sev3', 'Sev4' + :vartype severity: str or ~azure.mgmt.alertsmanagement.models.Severity + :ivar start_date_time: Creation time of smart group. Date-Time in ISO-8601 + format. + :vartype start_date_time: datetime + :ivar last_modified_date_time: Last updated time of smart group. Date-Time + in ISO-8601 format. + :vartype last_modified_date_time: datetime + :ivar last_modified_user_name: Last modified by user name. + :vartype last_modified_user_name: str + :param resources: Summary of target resources in the smart group + :type resources: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param resource_types: Summary of target resource types in the smart group + :type resource_types: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param resource_groups: Summary of target resource groups in the smart + group + :type resource_groups: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param monitor_services: Summary of monitorServices in the smart group + :type monitor_services: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param monitor_conditions: Summary of monitorConditions in the smart group + :type monitor_conditions: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param alert_states: Summary of alertStates in the smart group + :type alert_states: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param alert_severities: Summary of alertSeverities in the smart group + :type alert_severities: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param next_link: The URI to fetch the next page of alerts. Call + ListNext() with this URI to fetch the next page alerts. + :type next_link: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'smart_group_state': {'readonly': True}, + 'severity': {'readonly': True}, + 'start_date_time': {'readonly': True}, + 'last_modified_date_time': {'readonly': True}, + 'last_modified_user_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'alerts_count': {'key': 'properties.alertsCount', 'type': 'int'}, + 'smart_group_state': {'key': 'properties.smartGroupState', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'start_date_time': {'key': 'properties.startDateTime', 'type': 'iso-8601'}, + 'last_modified_date_time': {'key': 'properties.lastModifiedDateTime', 'type': 'iso-8601'}, + 'last_modified_user_name': {'key': 'properties.lastModifiedUserName', 'type': 'str'}, + 'resources': {'key': 'properties.resources', 'type': '[SmartGroupAggregatedProperty]'}, + 'resource_types': {'key': 'properties.resourceTypes', 'type': '[SmartGroupAggregatedProperty]'}, + 'resource_groups': {'key': 'properties.resourceGroups', 'type': '[SmartGroupAggregatedProperty]'}, + 'monitor_services': {'key': 'properties.monitorServices', 'type': '[SmartGroupAggregatedProperty]'}, + 'monitor_conditions': {'key': 'properties.monitorConditions', 'type': '[SmartGroupAggregatedProperty]'}, + 'alert_states': {'key': 'properties.alertStates', 'type': '[SmartGroupAggregatedProperty]'}, + 'alert_severities': {'key': 'properties.alertSeverities', 'type': '[SmartGroupAggregatedProperty]'}, + 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SmartGroup, self).__init__(**kwargs) + self.alerts_count = kwargs.get('alerts_count', None) + self.smart_group_state = None + self.severity = None + self.start_date_time = None + self.last_modified_date_time = None + self.last_modified_user_name = None + self.resources = kwargs.get('resources', None) + self.resource_types = kwargs.get('resource_types', None) + self.resource_groups = kwargs.get('resource_groups', None) + self.monitor_services = kwargs.get('monitor_services', None) + self.monitor_conditions = kwargs.get('monitor_conditions', None) + self.alert_states = kwargs.get('alert_states', None) + self.alert_severities = kwargs.get('alert_severities', None) + self.next_link = kwargs.get('next_link', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_aggregated_property.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_aggregated_property.py new file mode 100644 index 000000000000..4681ff600eff --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_aggregated_property.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 SmartGroupAggregatedProperty(Model): + """Aggregated property of each type. + + :param name: Name of the type. + :type name: str + :param count: Total number of items of type. + :type count: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(SmartGroupAggregatedProperty, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.count = kwargs.get('count', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_aggregated_property_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_aggregated_property_py3.py new file mode 100644 index 000000000000..5a6bfb2d896e --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_aggregated_property_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 SmartGroupAggregatedProperty(Model): + """Aggregated property of each type. + + :param name: Name of the type. + :type name: str + :param count: Total number of items of type. + :type count: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__(self, *, name: str=None, count: int=None, **kwargs) -> None: + super(SmartGroupAggregatedProperty, self).__init__(**kwargs) + self.name = name + self.count = count diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification.py new file mode 100644 index 000000000000..b0c27ebc02c4 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification.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 .resource import Resource + + +class SmartGroupModification(Resource): + """Alert Modification details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + :param properties: + :type properties: + ~azure.mgmt.alertsmanagement.models.SmartGroupModificationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'SmartGroupModificationProperties'}, + } + + def __init__(self, **kwargs): + super(SmartGroupModification, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_item.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_item.py new file mode 100644 index 000000000000..b87b7a06465d --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_item.py @@ -0,0 +1,54 @@ +# 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 SmartGroupModificationItem(Model): + """smartGroup modification item. + + :param modification_event: Reason for the modification. Possible values + include: 'SmartGroupCreated', 'StateChange', 'AlertAdded', 'AlertRemoved' + :type modification_event: str or + ~azure.mgmt.alertsmanagement.models.SmartGroupModificationEvent + :param old_value: Old value + :type old_value: str + :param new_value: New value + :type new_value: str + :param modified_at: Modified date and time + :type modified_at: str + :param modified_by: Modified user details (Principal client name) + :type modified_by: str + :param comments: Modification comments + :type comments: str + :param description: Description of the modification + :type description: str + """ + + _attribute_map = { + 'modification_event': {'key': 'modificationEvent', 'type': 'SmartGroupModificationEvent'}, + 'old_value': {'key': 'oldValue', 'type': 'str'}, + 'new_value': {'key': 'newValue', 'type': 'str'}, + 'modified_at': {'key': 'modifiedAt', 'type': 'str'}, + 'modified_by': {'key': 'modifiedBy', 'type': 'str'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SmartGroupModificationItem, self).__init__(**kwargs) + self.modification_event = kwargs.get('modification_event', None) + self.old_value = kwargs.get('old_value', None) + self.new_value = kwargs.get('new_value', None) + self.modified_at = kwargs.get('modified_at', None) + self.modified_by = kwargs.get('modified_by', None) + self.comments = kwargs.get('comments', None) + self.description = kwargs.get('description', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_item_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_item_py3.py new file mode 100644 index 000000000000..aa07075fb384 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_item_py3.py @@ -0,0 +1,54 @@ +# 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 SmartGroupModificationItem(Model): + """smartGroup modification item. + + :param modification_event: Reason for the modification. Possible values + include: 'SmartGroupCreated', 'StateChange', 'AlertAdded', 'AlertRemoved' + :type modification_event: str or + ~azure.mgmt.alertsmanagement.models.SmartGroupModificationEvent + :param old_value: Old value + :type old_value: str + :param new_value: New value + :type new_value: str + :param modified_at: Modified date and time + :type modified_at: str + :param modified_by: Modified user details (Principal client name) + :type modified_by: str + :param comments: Modification comments + :type comments: str + :param description: Description of the modification + :type description: str + """ + + _attribute_map = { + 'modification_event': {'key': 'modificationEvent', 'type': 'SmartGroupModificationEvent'}, + 'old_value': {'key': 'oldValue', 'type': 'str'}, + 'new_value': {'key': 'newValue', 'type': 'str'}, + 'modified_at': {'key': 'modifiedAt', 'type': 'str'}, + 'modified_by': {'key': 'modifiedBy', 'type': 'str'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, modification_event=None, old_value: str=None, new_value: str=None, modified_at: str=None, modified_by: str=None, comments: str=None, description: str=None, **kwargs) -> None: + super(SmartGroupModificationItem, self).__init__(**kwargs) + self.modification_event = modification_event + self.old_value = old_value + self.new_value = new_value + self.modified_at = modified_at + self.modified_by = modified_by + self.comments = comments + self.description = description diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_properties.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_properties.py new file mode 100644 index 000000000000..5535552813b3 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_properties.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 SmartGroupModificationProperties(Model): + """Properties of the smartGroup modification item. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar smart_group_id: Unique Id of the smartGroup for which the history is + being retrieved + :vartype smart_group_id: str + :param modifications: Modification details + :type modifications: + list[~azure.mgmt.alertsmanagement.models.SmartGroupModificationItem] + :param next_link: URL to fetch the next set of results. + :type next_link: str + """ + + _validation = { + 'smart_group_id': {'readonly': True}, + } + + _attribute_map = { + 'smart_group_id': {'key': 'smartGroupId', 'type': 'str'}, + 'modifications': {'key': 'modifications', 'type': '[SmartGroupModificationItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SmartGroupModificationProperties, self).__init__(**kwargs) + self.smart_group_id = None + self.modifications = kwargs.get('modifications', None) + self.next_link = kwargs.get('next_link', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_properties_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_properties_py3.py new file mode 100644 index 000000000000..40d128112187 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_properties_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 SmartGroupModificationProperties(Model): + """Properties of the smartGroup modification item. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar smart_group_id: Unique Id of the smartGroup for which the history is + being retrieved + :vartype smart_group_id: str + :param modifications: Modification details + :type modifications: + list[~azure.mgmt.alertsmanagement.models.SmartGroupModificationItem] + :param next_link: URL to fetch the next set of results. + :type next_link: str + """ + + _validation = { + 'smart_group_id': {'readonly': True}, + } + + _attribute_map = { + 'smart_group_id': {'key': 'smartGroupId', 'type': 'str'}, + 'modifications': {'key': 'modifications', 'type': '[SmartGroupModificationItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, modifications=None, next_link: str=None, **kwargs) -> None: + super(SmartGroupModificationProperties, self).__init__(**kwargs) + self.smart_group_id = None + self.modifications = modifications + self.next_link = next_link diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_py3.py new file mode 100644 index 000000000000..b8cb946b706a --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_modification_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 .resource_py3 import Resource + + +class SmartGroupModification(Resource): + """Alert Modification details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + :param properties: + :type properties: + ~azure.mgmt.alertsmanagement.models.SmartGroupModificationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'SmartGroupModificationProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(SmartGroupModification, self).__init__(**kwargs) + self.properties = properties diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_py3.py new file mode 100644 index 000000000000..a0c00f029485 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_group_py3.py @@ -0,0 +1,118 @@ +# 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 SmartGroup(Resource): + """Set of related alerts grouped together smartly by AMS. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Azure resource Id + :vartype id: str + :ivar type: Azure resource type + :vartype type: str + :ivar name: Azure resource name + :vartype name: str + :param alerts_count: Total number of alerts in smart group + :type alerts_count: int + :ivar smart_group_state: Smart group state. Possible values include: + 'New', 'Acknowledged', 'Closed' + :vartype smart_group_state: str or + ~azure.mgmt.alertsmanagement.models.State + :ivar severity: Severity of smart group is the highest(Sev0 >... > Sev4) + severity of all the alerts in the group. Possible values include: 'Sev0', + 'Sev1', 'Sev2', 'Sev3', 'Sev4' + :vartype severity: str or ~azure.mgmt.alertsmanagement.models.Severity + :ivar start_date_time: Creation time of smart group. Date-Time in ISO-8601 + format. + :vartype start_date_time: datetime + :ivar last_modified_date_time: Last updated time of smart group. Date-Time + in ISO-8601 format. + :vartype last_modified_date_time: datetime + :ivar last_modified_user_name: Last modified by user name. + :vartype last_modified_user_name: str + :param resources: Summary of target resources in the smart group + :type resources: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param resource_types: Summary of target resource types in the smart group + :type resource_types: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param resource_groups: Summary of target resource groups in the smart + group + :type resource_groups: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param monitor_services: Summary of monitorServices in the smart group + :type monitor_services: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param monitor_conditions: Summary of monitorConditions in the smart group + :type monitor_conditions: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param alert_states: Summary of alertStates in the smart group + :type alert_states: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param alert_severities: Summary of alertSeverities in the smart group + :type alert_severities: + list[~azure.mgmt.alertsmanagement.models.SmartGroupAggregatedProperty] + :param next_link: The URI to fetch the next page of alerts. Call + ListNext() with this URI to fetch the next page alerts. + :type next_link: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'smart_group_state': {'readonly': True}, + 'severity': {'readonly': True}, + 'start_date_time': {'readonly': True}, + 'last_modified_date_time': {'readonly': True}, + 'last_modified_user_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'alerts_count': {'key': 'properties.alertsCount', 'type': 'int'}, + 'smart_group_state': {'key': 'properties.smartGroupState', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'start_date_time': {'key': 'properties.startDateTime', 'type': 'iso-8601'}, + 'last_modified_date_time': {'key': 'properties.lastModifiedDateTime', 'type': 'iso-8601'}, + 'last_modified_user_name': {'key': 'properties.lastModifiedUserName', 'type': 'str'}, + 'resources': {'key': 'properties.resources', 'type': '[SmartGroupAggregatedProperty]'}, + 'resource_types': {'key': 'properties.resourceTypes', 'type': '[SmartGroupAggregatedProperty]'}, + 'resource_groups': {'key': 'properties.resourceGroups', 'type': '[SmartGroupAggregatedProperty]'}, + 'monitor_services': {'key': 'properties.monitorServices', 'type': '[SmartGroupAggregatedProperty]'}, + 'monitor_conditions': {'key': 'properties.monitorConditions', 'type': '[SmartGroupAggregatedProperty]'}, + 'alert_states': {'key': 'properties.alertStates', 'type': '[SmartGroupAggregatedProperty]'}, + 'alert_severities': {'key': 'properties.alertSeverities', 'type': '[SmartGroupAggregatedProperty]'}, + 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, + } + + def __init__(self, *, alerts_count: int=None, resources=None, resource_types=None, resource_groups=None, monitor_services=None, monitor_conditions=None, alert_states=None, alert_severities=None, next_link: str=None, **kwargs) -> None: + super(SmartGroup, self).__init__(**kwargs) + self.alerts_count = alerts_count + self.smart_group_state = None + self.severity = None + self.start_date_time = None + self.last_modified_date_time = None + self.last_modified_user_name = None + self.resources = resources + self.resource_types = resource_types + self.resource_groups = resource_groups + self.monitor_services = monitor_services + self.monitor_conditions = monitor_conditions + self.alert_states = alert_states + self.alert_severities = alert_severities + self.next_link = next_link diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_groups_list.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_groups_list.py new file mode 100644 index 000000000000..17302096edc5 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_groups_list.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 SmartGroupsList(Model): + """List the alerts. + + :param next_link: URL to fetch the next set of alerts. + :type next_link: str + :param value: List of alerts + :type value: list[~azure.mgmt.alertsmanagement.models.SmartGroup] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[SmartGroup]'}, + } + + def __init__(self, **kwargs): + super(SmartGroupsList, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_groups_list_py3.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_groups_list_py3.py new file mode 100644 index 000000000000..538de5af7747 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/models/smart_groups_list_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 SmartGroupsList(Model): + """List the alerts. + + :param next_link: URL to fetch the next set of alerts. + :type next_link: str + :param value: List of alerts + :type value: list[~azure.mgmt.alertsmanagement.models.SmartGroup] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[SmartGroup]'}, + } + + def __init__(self, *, next_link: str=None, value=None, **kwargs) -> None: + super(SmartGroupsList, self).__init__(**kwargs) + self.next_link = next_link + self.value = value diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/__init__.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/__init__.py new file mode 100644 index 000000000000..9341f4bfee3b --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/__init__.py @@ -0,0 +1,20 @@ +# 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 .operations import Operations +from .alerts_operations import AlertsOperations +from .smart_groups_operations import SmartGroupsOperations + +__all__ = [ + 'Operations', + 'AlertsOperations', + 'SmartGroupsOperations', +] diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/alerts_operations.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/alerts_operations.py new file mode 100644 index 000000000000..fd15f46bc817 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/alerts_operations.py @@ -0,0 +1,522 @@ +# 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 AlertsOperations(object): + """AlertsOperations 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: API version. Constant value: "2018-05-05". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-05" + + self.config = config + + def get_all( + self, target_resource=None, target_resource_type=None, target_resource_group=None, monitor_service=None, monitor_condition=None, severity=None, alert_state=None, alert_rule=None, smart_group_id=None, include_context=None, include_egress_config=None, page_count=None, sort_by=None, sort_order=None, select=None, time_range=None, custom_time_range=None, custom_headers=None, raw=False, **operation_config): + """List all the existing alerts, where the results can be selective by + passing multiple filter parameters including time range and sorted on + specific fields. . + + :param target_resource: Filter by target resource( which is full ARM + ID) Default value is select all. + :type target_resource: str + :param target_resource_type: Filter by target resource type. Default + value is select all. + :type target_resource_type: str + :param target_resource_group: Filter by target resource group name. + Default value is select all. + :type target_resource_group: str + :param monitor_service: Filter by monitor service which is the source + of the alert instance. Default value is select all. Possible values + include: 'Application Insights', 'ActivityLog Administrative', + 'ActivityLog Security', 'ActivityLog Recommendation', 'ActivityLog + Policy', 'ActivityLog Autoscale', 'Log Analytics', 'Nagios', + 'Platform', 'SCOM', 'ServiceHealth', 'SmartDetector', 'VM Insights', + 'Zabbix' + :type monitor_service: str or + ~azure.mgmt.alertsmanagement.models.MonitorService + :param monitor_condition: Filter by monitor condition which is the + state of the monitor(alertRule) at monitor service. Default value is + to select all. Possible values include: 'Fired', 'Resolved' + :type monitor_condition: str or + ~azure.mgmt.alertsmanagement.models.MonitorCondition + :param severity: Filter by severity. Defaut value is select all. + Possible values include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4' + :type severity: str or ~azure.mgmt.alertsmanagement.models.Severity + :param alert_state: Filter by state of the alert instance. Default + value is to select all. Possible values include: 'New', + 'Acknowledged', 'Closed' + :type alert_state: str or + ~azure.mgmt.alertsmanagement.models.AlertState + :param alert_rule: Filter by alert rule(monitor) which fired alert + instance. Default value is to select all. + :type alert_rule: str + :param smart_group_id: Filter the alerts list by the Smart Group Id. + Default value is none. + :type smart_group_id: str + :param include_context: Include context which has data contextual to + the monitor service. Default value is false' + :type include_context: bool + :param include_egress_config: Include egress config which would be + used for displaying the content in portal. Default value is 'false'. + :type include_egress_config: bool + :param page_count: Determines number of alerts returned per page in + response. Permissible value is between 1 to 250. When the + "includeContent" filter is selected, maximum value allowed is 25. + Default value is 25. + :type page_count: int + :param sort_by: Sort the query results by input field, Default value + is 'lastModifiedDateTime'. Possible values include: 'name', + 'severity', 'alertState', 'monitorCondition', 'targetResource', + 'targetResourceName', 'targetResourceGroup', 'targetResourceType', + 'startDateTime', 'lastModifiedDateTime' + :type sort_by: str or + ~azure.mgmt.alertsmanagement.models.AlertsSortByFields + :param sort_order: Sort the query results order in either ascending or + descending. Default value is 'desc' for time fields and 'asc' for + others. Possible values include: 'asc', 'desc' + :type sort_order: str + :param select: This filter allows to selection of the fields(comma + seperated) which would be part of the the essential section. This + would allow to project only the required fields rather than getting + entire content. Default is to fetch all the fields in the essentials + section. + :type select: str + :param time_range: Filter by time range by below listed values. + Default value is 1 day. Possible values include: '1h', '1d', '7d', + '30d' + :type time_range: str or ~azure.mgmt.alertsmanagement.models.TimeRange + :param custom_time_range: Filter by custom time range in the format + / where time is in (ISO-8601 format)'. + Permissible values is within 30 days from query time. Either + timeRange or customTimeRange could be used but not both. Default is + none. + :type custom_time_range: 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 Alert + :rtype: + ~azure.mgmt.alertsmanagement.models.AlertPaged[~azure.mgmt.alertsmanagement.models.Alert] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.get_all.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 = {} + if target_resource is not None: + query_parameters['targetResource'] = self._serialize.query("target_resource", target_resource, 'str') + if target_resource_type is not None: + query_parameters['targetResourceType'] = self._serialize.query("target_resource_type", target_resource_type, 'str') + if target_resource_group is not None: + query_parameters['targetResourceGroup'] = self._serialize.query("target_resource_group", target_resource_group, 'str') + if monitor_service is not None: + query_parameters['monitorService'] = self._serialize.query("monitor_service", monitor_service, 'str') + if monitor_condition is not None: + query_parameters['monitorCondition'] = self._serialize.query("monitor_condition", monitor_condition, 'str') + if severity is not None: + query_parameters['severity'] = self._serialize.query("severity", severity, 'str') + if alert_state is not None: + query_parameters['alertState'] = self._serialize.query("alert_state", alert_state, 'str') + if alert_rule is not None: + query_parameters['alertRule'] = self._serialize.query("alert_rule", alert_rule, 'str') + if smart_group_id is not None: + query_parameters['smartGroupId'] = self._serialize.query("smart_group_id", smart_group_id, 'str') + if include_context is not None: + query_parameters['includeContext'] = self._serialize.query("include_context", include_context, 'bool') + if include_egress_config is not None: + query_parameters['includeEgressConfig'] = self._serialize.query("include_egress_config", include_egress_config, 'bool') + if page_count is not None: + query_parameters['pageCount'] = self._serialize.query("page_count", page_count, 'int') + if sort_by is not None: + query_parameters['sortBy'] = self._serialize.query("sort_by", sort_by, 'str') + if sort_order is not None: + query_parameters['sortOrder'] = self._serialize.query("sort_order", sort_order, 'str') + if select is not None: + query_parameters['select'] = self._serialize.query("select", select, 'str') + if time_range is not None: + query_parameters['timeRange'] = self._serialize.query("time_range", time_range, 'str') + if custom_time_range is not None: + query_parameters['customTimeRange'] = self._serialize.query("custom_time_range", custom_time_range, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.AlertPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.AlertPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + get_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts'} + + def get_by_id( + self, alert_id, custom_headers=None, raw=False, **operation_config): + """Get a specific alert. + + Get information related to a specific alert. + + :param alert_id: Unique ID of an alert instance. + :type alert_id: 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: Alert or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.alertsmanagement.models.Alert or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'alertId': self._serialize.url("alert_id", alert_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['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Alert', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId}'} + + def change_state( + self, alert_id, new_state, custom_headers=None, raw=False, **operation_config): + """Change the state of the alert. + + :param alert_id: Unique ID of an alert instance. + :type alert_id: str + :param new_state: New state of the alert. Possible values include: + 'New', 'Acknowledged', 'Closed' + :type new_state: str or ~azure.mgmt.alertsmanagement.models.AlertState + :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: Alert or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.alertsmanagement.models.Alert or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.change_state.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'alertId': self._serialize.url("alert_id", alert_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') + query_parameters['newState'] = self._serialize.query("new_state", new_state, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Alert', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + change_state.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId}/changestate'} + + def get_history( + self, alert_id, custom_headers=None, raw=False, **operation_config): + """Get the history of the changes of an alert. + + :param alert_id: Unique ID of an alert instance. + :type alert_id: 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: AlertModification or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.alertsmanagement.models.AlertModification or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_history.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'alertId': self._serialize.url("alert_id", alert_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['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AlertModification', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_history.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId}/history'} + + def get_summary( + self, groupby, include_smart_groups_count=None, target_resource=None, target_resource_type=None, target_resource_group=None, monitor_service=None, monitor_condition=None, severity=None, alert_state=None, alert_rule=None, time_range=None, custom_time_range=None, custom_headers=None, raw=False, **operation_config): + """Summary of alerts with the count each severity. + + :param groupby: This parameter allows the result set to be aggregated + by input fields. For example, groupby=severity,alertstate. Possible + values include: 'severity', 'alertState', 'monitorCondition', + 'monitorService', 'signalType', 'alertRule' + :type groupby: str or + ~azure.mgmt.alertsmanagement.models.AlertsSummaryGroupByFields + :param include_smart_groups_count: Include count of the SmartGroups as + part of the summary. Default value is 'false'. + :type include_smart_groups_count: bool + :param target_resource: Filter by target resource( which is full ARM + ID) Default value is select all. + :type target_resource: str + :param target_resource_type: Filter by target resource type. Default + value is select all. + :type target_resource_type: str + :param target_resource_group: Filter by target resource group name. + Default value is select all. + :type target_resource_group: str + :param monitor_service: Filter by monitor service which is the source + of the alert instance. Default value is select all. Possible values + include: 'Application Insights', 'ActivityLog Administrative', + 'ActivityLog Security', 'ActivityLog Recommendation', 'ActivityLog + Policy', 'ActivityLog Autoscale', 'Log Analytics', 'Nagios', + 'Platform', 'SCOM', 'ServiceHealth', 'SmartDetector', 'VM Insights', + 'Zabbix' + :type monitor_service: str or + ~azure.mgmt.alertsmanagement.models.MonitorService + :param monitor_condition: Filter by monitor condition which is the + state of the monitor(alertRule) at monitor service. Default value is + to select all. Possible values include: 'Fired', 'Resolved' + :type monitor_condition: str or + ~azure.mgmt.alertsmanagement.models.MonitorCondition + :param severity: Filter by severity. Defaut value is select all. + Possible values include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4' + :type severity: str or ~azure.mgmt.alertsmanagement.models.Severity + :param alert_state: Filter by state of the alert instance. Default + value is to select all. Possible values include: 'New', + 'Acknowledged', 'Closed' + :type alert_state: str or + ~azure.mgmt.alertsmanagement.models.AlertState + :param alert_rule: Filter by alert rule(monitor) which fired alert + instance. Default value is to select all. + :type alert_rule: str + :param time_range: Filter by time range by below listed values. + Default value is 1 day. Possible values include: '1h', '1d', '7d', + '30d' + :type time_range: str or ~azure.mgmt.alertsmanagement.models.TimeRange + :param custom_time_range: Filter by custom time range in the format + / where time is in (ISO-8601 format)'. + Permissible values is within 30 days from query time. Either + timeRange or customTimeRange could be used but not both. Default is + none. + :type custom_time_range: 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: AlertsSummary or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.alertsmanagement.models.AlertsSummary or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_summary.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['groupby'] = self._serialize.query("groupby", groupby, 'str') + if include_smart_groups_count is not None: + query_parameters['includeSmartGroupsCount'] = self._serialize.query("include_smart_groups_count", include_smart_groups_count, 'bool') + if target_resource is not None: + query_parameters['targetResource'] = self._serialize.query("target_resource", target_resource, 'str') + if target_resource_type is not None: + query_parameters['targetResourceType'] = self._serialize.query("target_resource_type", target_resource_type, 'str') + if target_resource_group is not None: + query_parameters['targetResourceGroup'] = self._serialize.query("target_resource_group", target_resource_group, 'str') + if monitor_service is not None: + query_parameters['monitorService'] = self._serialize.query("monitor_service", monitor_service, 'str') + if monitor_condition is not None: + query_parameters['monitorCondition'] = self._serialize.query("monitor_condition", monitor_condition, 'str') + if severity is not None: + query_parameters['severity'] = self._serialize.query("severity", severity, 'str') + if alert_state is not None: + query_parameters['alertState'] = self._serialize.query("alert_state", alert_state, 'str') + if alert_rule is not None: + query_parameters['alertRule'] = self._serialize.query("alert_rule", alert_rule, 'str') + if time_range is not None: + query_parameters['timeRange'] = self._serialize.query("time_range", time_range, 'str') + if custom_time_range is not None: + query_parameters['customTimeRange'] = self._serialize.query("custom_time_range", custom_time_range, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AlertsSummary', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_summary.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alertsSummary'} diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/operations.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/operations.py new file mode 100644 index 000000000000..9718bb4566f6 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/operations.py @@ -0,0 +1,99 @@ +# 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 Operations(object): + """Operations 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: API version. Constant value: "2018-05-05". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-05" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """List all operations available through Azure Alerts Management Resource + Provider. + + :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 Operation + :rtype: + ~azure.mgmt.alertsmanagement.models.OperationPaged[~azure.mgmt.alertsmanagement.models.Operation] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # 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['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.AlertsManagement/operations'} diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/smart_groups_operations.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/smart_groups_operations.py new file mode 100644 index 000000000000..8ff2c33ae120 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/operations/smart_groups_operations.py @@ -0,0 +1,357 @@ +# 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 SmartGroupsOperations(object): + """SmartGroupsOperations 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: API version. Constant value: "2018-05-05". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-05" + + self.config = config + + def get_all( + self, target_resource=None, target_resource_group=None, target_resource_type=None, monitor_service=None, monitor_condition=None, severity=None, smart_group_state=None, time_range=None, page_count=None, sort_by=None, sort_order=None, custom_headers=None, raw=False, **operation_config): + """Get all smartGroups within the subscription. + + List all the smartGroups within the specified subscription. . + + :param target_resource: Filter by target resource( which is full ARM + ID) Default value is select all. + :type target_resource: str + :param target_resource_group: Filter by target resource group name. + Default value is select all. + :type target_resource_group: str + :param target_resource_type: Filter by target resource type. Default + value is select all. + :type target_resource_type: str + :param monitor_service: Filter by monitor service which is the source + of the alert instance. Default value is select all. Possible values + include: 'Application Insights', 'ActivityLog Administrative', + 'ActivityLog Security', 'ActivityLog Recommendation', 'ActivityLog + Policy', 'ActivityLog Autoscale', 'Log Analytics', 'Nagios', + 'Platform', 'SCOM', 'ServiceHealth', 'SmartDetector', 'VM Insights', + 'Zabbix' + :type monitor_service: str or + ~azure.mgmt.alertsmanagement.models.MonitorService + :param monitor_condition: Filter by monitor condition which is the + state of the monitor(alertRule) at monitor service. Default value is + to select all. Possible values include: 'Fired', 'Resolved' + :type monitor_condition: str or + ~azure.mgmt.alertsmanagement.models.MonitorCondition + :param severity: Filter by severity. Defaut value is select all. + Possible values include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4' + :type severity: str or ~azure.mgmt.alertsmanagement.models.Severity + :param smart_group_state: Filter by state of the smart group. Default + value is to select all. Possible values include: 'New', + 'Acknowledged', 'Closed' + :type smart_group_state: str or + ~azure.mgmt.alertsmanagement.models.AlertState + :param time_range: Filter by time range by below listed values. + Default value is 1 day. Possible values include: '1h', '1d', '7d', + '30d' + :type time_range: str or ~azure.mgmt.alertsmanagement.models.TimeRange + :param page_count: Determines number of alerts returned per page in + response. Permissible value is between 1 to 250. When the + "includeContent" filter is selected, maximum value allowed is 25. + Default value is 25. + :type page_count: int + :param sort_by: Sort the query results by input field Default value + is sort by 'lastModifiedDateTime'. Possible values include: + 'alertsCount', 'state', 'severity', 'startDateTime', + 'lastModifiedDateTime' + :type sort_by: str or + ~azure.mgmt.alertsmanagement.models.SmartGroupsSortByFields + :param sort_order: Sort the query results order in either ascending or + descending. Default value is 'desc' for time fields and 'asc' for + others. Possible values include: 'asc', 'desc' + :type sort_order: 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: SmartGroupsList or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.alertsmanagement.models.SmartGroupsList or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_all.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 = {} + if target_resource is not None: + query_parameters['targetResource'] = self._serialize.query("target_resource", target_resource, 'str') + if target_resource_group is not None: + query_parameters['targetResourceGroup'] = self._serialize.query("target_resource_group", target_resource_group, 'str') + if target_resource_type is not None: + query_parameters['targetResourceType'] = self._serialize.query("target_resource_type", target_resource_type, 'str') + if monitor_service is not None: + query_parameters['monitorService'] = self._serialize.query("monitor_service", monitor_service, 'str') + if monitor_condition is not None: + query_parameters['monitorCondition'] = self._serialize.query("monitor_condition", monitor_condition, 'str') + if severity is not None: + query_parameters['severity'] = self._serialize.query("severity", severity, 'str') + if smart_group_state is not None: + query_parameters['smartGroupState'] = self._serialize.query("smart_group_state", smart_group_state, 'str') + if time_range is not None: + query_parameters['timeRange'] = self._serialize.query("time_range", time_range, 'str') + if page_count is not None: + query_parameters['pageCount'] = self._serialize.query("page_count", page_count, 'int') + if sort_by is not None: + query_parameters['sortBy'] = self._serialize.query("sort_by", sort_by, 'str') + if sort_order is not None: + query_parameters['sortOrder'] = self._serialize.query("sort_order", sort_order, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SmartGroupsList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups'} + + def get_by_id( + self, smart_group_id, custom_headers=None, raw=False, **operation_config): + """Get information of smart alerts group. + + Get details of smart group. + + :param smart_group_id: Smart group unique id. + :type smart_group_id: 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: SmartGroup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.alertsmanagement.models.SmartGroup or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'smartGroupId': self._serialize.url("smart_group_id", smart_group_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['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('SmartGroup', response) + header_dict = { + 'x-ms-request-id': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId}'} + + def change_state( + self, smart_group_id, new_state, custom_headers=None, raw=False, **operation_config): + """Change the state from unresolved to resolved and all the alerts within + the smart group will also be resolved. + + :param smart_group_id: Smart group unique id. + :type smart_group_id: str + :param new_state: New state of the alert. Possible values include: + 'New', 'Acknowledged', 'Closed' + :type new_state: str or ~azure.mgmt.alertsmanagement.models.AlertState + :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: SmartGroup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.alertsmanagement.models.SmartGroup or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.change_state.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'smartGroupId': self._serialize.url("smart_group_id", smart_group_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') + query_parameters['newState'] = self._serialize.query("new_state", new_state, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('SmartGroup', response) + header_dict = { + 'x-ms-request-id': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + change_state.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId}/changeState'} + + def get_history( + self, smart_group_id, custom_headers=None, raw=False, **operation_config): + """Get the history of the changes of smart group. + + :param smart_group_id: Smart group unique id. + :type smart_group_id: 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: SmartGroupModification or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.alertsmanagement.models.SmartGroupModification or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_history.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'smartGroupId': self._serialize.url("smart_group_id", smart_group_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['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SmartGroupModification', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_history.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId}/history'} diff --git a/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/version.py b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/version.py new file mode 100644 index 000000000000..e0ec669828cb --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" + diff --git a/azure-mgmt-alertsmanagement/azure_bdist_wheel.py b/azure-mgmt-alertsmanagement/azure_bdist_wheel.py new file mode 100644 index 000000000000..8a81d1b61775 --- /dev/null +++ b/azure-mgmt-alertsmanagement/azure_bdist_wheel.py @@ -0,0 +1,54 @@ +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +from distutils import log as logger +import os.path + +from wheel.bdist_wheel import bdist_wheel +class azure_bdist_wheel(bdist_wheel): + """The purpose of this class is to build wheel a little differently than the sdist, + without requiring to build the wheel from the sdist (i.e. you can build the wheel + directly from source). + """ + + description = "Create an Azure wheel distribution" + + user_options = bdist_wheel.user_options + \ + [('azure-namespace-package=', None, + "Name of the deepest nspkg used")] + + def initialize_options(self): + bdist_wheel.initialize_options(self) + self.azure_namespace_package = None + + def finalize_options(self): + bdist_wheel.finalize_options(self) + if self.azure_namespace_package and not self.azure_namespace_package.endswith("-nspkg"): + raise ValueError("azure_namespace_package must finish by -nspkg") + + def run(self): + if not self.distribution.install_requires: + self.distribution.install_requires = [] + self.distribution.install_requires.append( + "{}>=2.0.0".format(self.azure_namespace_package)) + bdist_wheel.run(self) + + def write_record(self, bdist_dir, distinfo_dir): + if self.azure_namespace_package: + # Split and remove last part, assuming it's "nspkg" + subparts = self.azure_namespace_package.split('-')[0:-1] + folder_with_init = [os.path.join(*subparts[0:i+1]) for i in range(len(subparts))] + for azure_sub_package in folder_with_init: + init_file = os.path.join(bdist_dir, azure_sub_package, '__init__.py') + if os.path.isfile(init_file): + logger.info("manually remove {} while building the wheel".format(init_file)) + os.remove(init_file) + else: + raise ValueError("Unable to find {}. Are you sure of your namespace package?".format(init_file)) + bdist_wheel.write_record(self, bdist_dir, distinfo_dir) +cmdclass = { + 'bdist_wheel': azure_bdist_wheel, +} diff --git a/azure-mgmt-alertsmanagement/sdk_packaging.toml b/azure-mgmt-alertsmanagement/sdk_packaging.toml new file mode 100644 index 000000000000..079caeb63e3a --- /dev/null +++ b/azure-mgmt-alertsmanagement/sdk_packaging.toml @@ -0,0 +1,6 @@ +[packaging] +package_name = "azure-mgmt-alertsmanagement" +package_pprint_name = "Alerts Management" +package_doc_id = "" +is_stable = false +is_arm = true diff --git a/azure-mgmt-alertsmanagement/setup.cfg b/azure-mgmt-alertsmanagement/setup.cfg new file mode 100644 index 000000000000..856f4164982c --- /dev/null +++ b/azure-mgmt-alertsmanagement/setup.cfg @@ -0,0 +1,3 @@ +[bdist_wheel] +universal=1 +azure-namespace-package=azure-mgmt-nspkg \ No newline at end of file diff --git a/azure-mgmt-alertsmanagement/setup.py b/azure-mgmt-alertsmanagement/setup.py new file mode 100644 index 000000000000..42249bcfcac5 --- /dev/null +++ b/azure-mgmt-alertsmanagement/setup.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup +try: + from azure_bdist_wheel import cmdclass +except ImportError: + from distutils import log as logger + logger.warn("Wheel is not available, disabling bdist_wheel hook") + cmdclass = {} + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-alertsmanagement" +PACKAGE_PPRINT_NAME = "Alerts Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.rst', encoding='utf-8') as f: + readme = f.read() +with open('HISTORY.rst', encoding='utf-8') as f: + history = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + history, + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=["tests"]), + install_requires=[ + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + cmdclass=cmdclass +)