diff --git a/azure-mgmt-monitor/MANIFEST.in b/azure-mgmt-monitor/MANIFEST.in index 9ecaeb15de50..bb37a2723dae 100644 --- a/azure-mgmt-monitor/MANIFEST.in +++ b/azure-mgmt-monitor/MANIFEST.in @@ -1,2 +1 @@ include *.rst -include azure_bdist_wheel.py \ No newline at end of file diff --git a/azure-mgmt-monitor/azure/__init__.py b/azure-mgmt-monitor/azure/__init__.py index 849489fca33c..0260537a02bb 100644 --- a/azure-mgmt-monitor/azure/__init__.py +++ b/azure-mgmt-monitor/azure/__init__.py @@ -1 +1 @@ -__import__('pkg_resources').declare_namespace(__name__) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-monitor/azure/mgmt/__init__.py b/azure-mgmt-monitor/azure/mgmt/__init__.py index 849489fca33c..0260537a02bb 100644 --- a/azure-mgmt-monitor/azure/mgmt/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/__init__.py @@ -1 +1 @@ -__import__('pkg_resources').declare_namespace(__name__) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py index 164f6e58b0ce..25fa23f3e26c 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py @@ -97,6 +97,8 @@ from .metric_dimension_py3 import MetricDimension from .metric_criteria_py3 import MetricCriteria from .metric_alert_single_resource_multiple_metric_criteria_py3 import MetricAlertSingleResourceMultipleMetricCriteria + from .multi_metric_criteria_py3 import MultiMetricCriteria + from .metric_alert_multiple_resource_multiple_metric_criteria_py3 import MetricAlertMultipleResourceMultipleMetricCriteria from .source_py3 import Source from .schedule_py3 import Schedule from .action_py3 import Action @@ -106,6 +108,9 @@ from .trigger_condition_py3 import TriggerCondition from .az_ns_action_group_py3 import AzNsActionGroup from .alerting_action_py3 import AlertingAction + from .dimension_py3 import Dimension + from .criteria_py3 import Criteria + from .log_to_metric_action_py3 import LogToMetricAction from .metric_namespace_name_py3 import MetricNamespaceName from .metric_namespace_py3 import MetricNamespace except (SyntaxError, ImportError): @@ -196,6 +201,8 @@ from .metric_dimension import MetricDimension from .metric_criteria import MetricCriteria from .metric_alert_single_resource_multiple_metric_criteria import MetricAlertSingleResourceMultipleMetricCriteria + from .multi_metric_criteria import MultiMetricCriteria + from .metric_alert_multiple_resource_multiple_metric_criteria import MetricAlertMultipleResourceMultipleMetricCriteria from .source import Source from .schedule import Schedule from .action import Action @@ -205,6 +212,9 @@ from .trigger_condition import TriggerCondition from .az_ns_action_group import AzNsActionGroup from .alerting_action import AlertingAction + from .dimension import Dimension + from .criteria import Criteria + from .log_to_metric_action import LogToMetricAction from .metric_namespace_name import MetricNamespaceName from .metric_namespace import MetricNamespace from .autoscale_setting_resource_paged import AutoscaleSettingResourcePaged @@ -331,6 +341,8 @@ 'MetricDimension', 'MetricCriteria', 'MetricAlertSingleResourceMultipleMetricCriteria', + 'MultiMetricCriteria', + 'MetricAlertMultipleResourceMultipleMetricCriteria', 'Source', 'Schedule', 'Action', @@ -340,6 +352,9 @@ 'TriggerCondition', 'AzNsActionGroup', 'AlertingAction', + 'Dimension', + 'Criteria', + 'LogToMetricAction', 'MetricNamespaceName', 'MetricNamespace', 'AutoscaleSettingResourcePaged', diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py index 2a4aa290f9f1..494f5e696a81 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py @@ -16,7 +16,7 @@ class Action(Model): """Action descriptor. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AlertingAction + sub-classes are: AlertingAction, LogToMetricAction All required parameters must be populated in order to send to Azure. @@ -33,7 +33,7 @@ class Action(Model): } _subtype_map = { - 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction'} + 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction', 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction': 'LogToMetricAction'} } def __init__(self, **kwargs): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py index cb4ea038d5b8..354eb4565038 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py @@ -16,7 +16,7 @@ class Action(Model): """Action descriptor. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AlertingAction + sub-classes are: AlertingAction, LogToMetricAction All required parameters must be populated in order to send to Azure. @@ -33,7 +33,7 @@ class Action(Model): } _subtype_map = { - 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction'} + 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction', 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction': 'LogToMetricAction'} } def __init__(self, **kwargs) -> None: diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria.py new file mode 100644 index 000000000000..34bb08dd5fce --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Criteria(Model): + """Specifies the criteria for converting log to metric. + + All required parameters must be populated in order to send to Azure. + + :param metric_name: Required. Name of the metric + :type metric_name: str + :param dimensions: List of Dimensions for creating metric + :type dimensions: list[~azure.mgmt.monitor.models.Dimension] + """ + + _validation = { + 'metric_name': {'required': True}, + } + + _attribute_map = { + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + } + + def __init__(self, **kwargs): + super(Criteria, self).__init__(**kwargs) + self.metric_name = kwargs.get('metric_name', None) + self.dimensions = kwargs.get('dimensions', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria_py3.py new file mode 100644 index 000000000000..e6266bc19003 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria_py3.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Criteria(Model): + """Specifies the criteria for converting log to metric. + + All required parameters must be populated in order to send to Azure. + + :param metric_name: Required. Name of the metric + :type metric_name: str + :param dimensions: List of Dimensions for creating metric + :type dimensions: list[~azure.mgmt.monitor.models.Dimension] + """ + + _validation = { + 'metric_name': {'required': True}, + } + + _attribute_map = { + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + } + + def __init__(self, *, metric_name: str, dimensions=None, **kwargs) -> None: + super(Criteria, self).__init__(**kwargs) + self.metric_name = metric_name + self.dimensions = dimensions diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension.py new file mode 100644 index 000000000000..82826c978cd8 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Dimension(Model): + """Specifies the criteria for converting log to metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension + :type name: str + :ivar operator: Required. Operator for dimension values. Default value: + "Include" . + :vartype operator: str + :param values: Required. List of dimension values + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True, 'constant': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + operator = "Include" + + def __init__(self, **kwargs): + super(Dimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.values = kwargs.get('values', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension_py3.py new file mode 100644 index 000000000000..d506b33189c4 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension_py3.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Dimension(Model): + """Specifies the criteria for converting log to metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension + :type name: str + :ivar operator: Required. Operator for dimension values. Default value: + "Include" . + :vartype operator: str + :param values: Required. List of dimension values + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True, 'constant': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + operator = "Include" + + def __init__(self, *, name: str, values, **kwargs) -> None: + super(Dimension, self).__init__(**kwargs) + self.name = name + self.values = values diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py index fc531623e212..d094c78d6478 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py @@ -44,7 +44,8 @@ class LogSearchRuleResource(Resource): ~azure.mgmt.monitor.models.ProvisioningState :param source: Required. Data Source against which rule will Query Data :type source: ~azure.mgmt.monitor.models.Source - :param schedule: Required. Schedule (Frequnecy, Time Window) for rule. + :param schedule: Schedule (Frequnecy, Time Window) for rule. Required for + action type - AlertingAction :type schedule: ~azure.mgmt.monitor.models.Schedule :param action: Required. Action needs to be taken on rule execution. :type action: ~azure.mgmt.monitor.models.Action @@ -58,7 +59,6 @@ class LogSearchRuleResource(Resource): 'last_updated_time': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'source': {'required': True}, - 'schedule': {'required': True}, 'action': {'required': True}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py index 5cee5f349023..d184c4e9b046 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py @@ -44,7 +44,8 @@ class LogSearchRuleResource(Resource): ~azure.mgmt.monitor.models.ProvisioningState :param source: Required. Data Source against which rule will Query Data :type source: ~azure.mgmt.monitor.models.Source - :param schedule: Required. Schedule (Frequnecy, Time Window) for rule. + :param schedule: Schedule (Frequnecy, Time Window) for rule. Required for + action type - AlertingAction :type schedule: ~azure.mgmt.monitor.models.Schedule :param action: Required. Action needs to be taken on rule execution. :type action: ~azure.mgmt.monitor.models.Action @@ -58,7 +59,6 @@ class LogSearchRuleResource(Resource): 'last_updated_time': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'source': {'required': True}, - 'schedule': {'required': True}, 'action': {'required': True}, } @@ -77,7 +77,7 @@ class LogSearchRuleResource(Resource): 'action': {'key': 'properties.action', 'type': 'Action'}, } - def __init__(self, *, location: str, source, schedule, action, tags=None, description: str=None, enabled=None, **kwargs) -> None: + def __init__(self, *, location: str, source, action, tags=None, description: str=None, enabled=None, schedule=None, **kwargs) -> None: super(LogSearchRuleResource, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.enabled = enabled diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.py new file mode 100644 index 000000000000..06588cd4ddcf --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.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 .action import Action + + +class LogToMetricAction(Action): + """Specifiy action need to be taken when rule type is converting log to + metric. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param criteria: Required. Severity of the alert + :type criteria: ~azure.mgmt.monitor.models.Criteria + """ + + _validation = { + 'odatatype': {'required': True}, + 'criteria': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'Criteria'}, + } + + def __init__(self, **kwargs): + super(LogToMetricAction, self).__init__(**kwargs) + self.criteria = kwargs.get('criteria', None) + self.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action_py3.py new file mode 100644 index 000000000000..8cb17d1a2a8c --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action_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 .action_py3 import Action + + +class LogToMetricAction(Action): + """Specifiy action need to be taken when rule type is converting log to + metric. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param criteria: Required. Severity of the alert + :type criteria: ~azure.mgmt.monitor.models.Criteria + """ + + _validation = { + 'odatatype': {'required': True}, + 'criteria': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'Criteria'}, + } + + def __init__(self, *, criteria, **kwargs) -> None: + super(LogToMetricAction, self).__init__(**kwargs) + self.criteria = criteria + self.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria.py index e09cd7cbd52a..f9f8acd7ccb3 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria.py @@ -16,7 +16,8 @@ class MetricAlertCriteria(Model): """The rule criteria that defines the conditions of the alert rule. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MetricAlertSingleResourceMultipleMetricCriteria + sub-classes are: MetricAlertSingleResourceMultipleMetricCriteria, + MetricAlertMultipleResourceMultipleMetricCriteria All required parameters must be populated in order to send to Azure. @@ -37,7 +38,7 @@ class MetricAlertCriteria(Model): } _subtype_map = { - 'odatatype': {'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria': 'MetricAlertSingleResourceMultipleMetricCriteria'} + 'odatatype': {'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria': 'MetricAlertSingleResourceMultipleMetricCriteria', 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria': 'MetricAlertMultipleResourceMultipleMetricCriteria'} } def __init__(self, **kwargs): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria_py3.py index c7efb60b1ddc..7f03ef71dd0e 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_criteria_py3.py @@ -16,7 +16,8 @@ class MetricAlertCriteria(Model): """The rule criteria that defines the conditions of the alert rule. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MetricAlertSingleResourceMultipleMetricCriteria + sub-classes are: MetricAlertSingleResourceMultipleMetricCriteria, + MetricAlertMultipleResourceMultipleMetricCriteria All required parameters must be populated in order to send to Azure. @@ -37,7 +38,7 @@ class MetricAlertCriteria(Model): } _subtype_map = { - 'odatatype': {'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria': 'MetricAlertSingleResourceMultipleMetricCriteria'} + 'odatatype': {'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria': 'MetricAlertSingleResourceMultipleMetricCriteria', 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria': 'MetricAlertMultipleResourceMultipleMetricCriteria'} } def __init__(self, *, additional_properties=None, **kwargs) -> None: diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_multiple_resource_multiple_metric_criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_multiple_resource_multiple_metric_criteria.py new file mode 100644 index 000000000000..244a6c6161f4 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_multiple_resource_multiple_metric_criteria.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .metric_alert_criteria import MetricAlertCriteria + + +class MetricAlertMultipleResourceMultipleMetricCriteria(MetricAlertCriteria): + """Speficies the metric alert criteria for multiple resource that has multiple + metric criteria. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param all_of: the list of multiple metric criteria for this 'all of' + operation. + :type all_of: list[~azure.mgmt.monitor.models.MultiMetricCriteria] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'all_of': {'key': 'allOf', 'type': '[MultiMetricCriteria]'}, + } + + def __init__(self, **kwargs): + super(MetricAlertMultipleResourceMultipleMetricCriteria, self).__init__(**kwargs) + self.all_of = kwargs.get('all_of', None) + self.odatatype = 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_multiple_resource_multiple_metric_criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_multiple_resource_multiple_metric_criteria_py3.py new file mode 100644 index 000000000000..0e6dc1a7808a --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_multiple_resource_multiple_metric_criteria_py3.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .metric_alert_criteria_py3 import MetricAlertCriteria + + +class MetricAlertMultipleResourceMultipleMetricCriteria(MetricAlertCriteria): + """Speficies the metric alert criteria for multiple resource that has multiple + metric criteria. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param all_of: the list of multiple metric criteria for this 'all of' + operation. + :type all_of: list[~azure.mgmt.monitor.models.MultiMetricCriteria] + """ + + _validation = { + 'odatatype': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'all_of': {'key': 'allOf', 'type': '[MultiMetricCriteria]'}, + } + + def __init__(self, *, additional_properties=None, all_of=None, **kwargs) -> None: + super(MetricAlertMultipleResourceMultipleMetricCriteria, self).__init__(additional_properties=additional_properties, **kwargs) + self.all_of = all_of + self.odatatype = 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py index 98ac70d43bb1..34cf760db014 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py @@ -47,6 +47,14 @@ class MetricAlertResource(Resource): :param window_size: Required. the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. :type window_size: timedelta + :param target_resource_type: the resource type of the target resource(s) + on which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_type: str + :param target_resource_region: the region of the target resource(s) on + which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_region: str :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria @@ -86,6 +94,8 @@ class MetricAlertResource(Resource): 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_type': {'key': 'properties.targetResourceType', 'type': 'str'}, + 'target_resource_region': {'key': 'properties.targetResourceRegion', 'type': 'str'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, @@ -100,6 +110,8 @@ def __init__(self, **kwargs): self.scopes = kwargs.get('scopes', None) self.evaluation_frequency = kwargs.get('evaluation_frequency', None) self.window_size = kwargs.get('window_size', None) + self.target_resource_type = kwargs.get('target_resource_type', None) + self.target_resource_region = kwargs.get('target_resource_region', None) self.criteria = kwargs.get('criteria', None) self.auto_mitigate = kwargs.get('auto_mitigate', None) self.actions = kwargs.get('actions', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py index 72bca9080e59..d87f339743ae 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py @@ -39,6 +39,14 @@ class MetricAlertResourcePatch(Model): :param window_size: Required. the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. :type window_size: timedelta + :param target_resource_type: the resource type of the target resource(s) + on which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_type: str + :param target_resource_region: the region of the target resource(s) on + which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_region: str :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria @@ -70,6 +78,8 @@ class MetricAlertResourcePatch(Model): 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_type': {'key': 'properties.targetResourceType', 'type': 'str'}, + 'target_resource_region': {'key': 'properties.targetResourceRegion', 'type': 'str'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, @@ -85,6 +95,8 @@ def __init__(self, **kwargs): self.scopes = kwargs.get('scopes', None) self.evaluation_frequency = kwargs.get('evaluation_frequency', None) self.window_size = kwargs.get('window_size', None) + self.target_resource_type = kwargs.get('target_resource_type', None) + self.target_resource_region = kwargs.get('target_resource_region', None) self.criteria = kwargs.get('criteria', None) self.auto_mitigate = kwargs.get('auto_mitigate', None) self.actions = kwargs.get('actions', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py index c415f69e489b..9a0728a74a81 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py @@ -39,6 +39,14 @@ class MetricAlertResourcePatch(Model): :param window_size: Required. the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. :type window_size: timedelta + :param target_resource_type: the resource type of the target resource(s) + on which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_type: str + :param target_resource_region: the region of the target resource(s) on + which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_region: str :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria @@ -70,13 +78,15 @@ class MetricAlertResourcePatch(Model): 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_type': {'key': 'properties.targetResourceType', 'type': 'str'}, + 'target_resource_region': {'key': 'properties.targetResourceRegion', 'type': 'str'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } - def __init__(self, *, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, auto_mitigate: bool=None, actions=None, **kwargs) -> None: + def __init__(self, *, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, target_resource_type: str=None, target_resource_region: str=None, auto_mitigate: bool=None, actions=None, **kwargs) -> None: super(MetricAlertResourcePatch, self).__init__(**kwargs) self.tags = tags self.description = description @@ -85,6 +95,8 @@ def __init__(self, *, description: str, severity: int, enabled: bool, evaluation self.scopes = scopes self.evaluation_frequency = evaluation_frequency self.window_size = window_size + self.target_resource_type = target_resource_type + self.target_resource_region = target_resource_region self.criteria = criteria self.auto_mitigate = auto_mitigate self.actions = actions diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py index a116607117c6..fe32ef5bb1f1 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py @@ -47,6 +47,14 @@ class MetricAlertResource(Resource): :param window_size: Required. the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. :type window_size: timedelta + :param target_resource_type: the resource type of the target resource(s) + on which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_type: str + :param target_resource_region: the region of the target resource(s) on + which the alert is created/updated. Mandatory for + MultipleResourceMultipleMetricCriteria. + :type target_resource_region: str :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria @@ -86,13 +94,15 @@ class MetricAlertResource(Resource): 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_type': {'key': 'properties.targetResourceType', 'type': 'str'}, + 'target_resource_region': {'key': 'properties.targetResourceRegion', 'type': 'str'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } - def __init__(self, *, location: str, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, auto_mitigate: bool=None, actions=None, **kwargs) -> None: + def __init__(self, *, location: str, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, target_resource_type: str=None, target_resource_region: str=None, auto_mitigate: bool=None, actions=None, **kwargs) -> None: super(MetricAlertResource, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.severity = severity @@ -100,6 +110,8 @@ def __init__(self, *, location: str, description: str, severity: int, enabled: b self.scopes = scopes self.evaluation_frequency = evaluation_frequency self.window_size = window_size + self.target_resource_type = target_resource_type + self.target_resource_region = target_resource_region self.criteria = criteria self.auto_mitigate = auto_mitigate self.actions = actions diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py index 9c5d9e538415..726e08b77eef 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py @@ -9,14 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from .multi_metric_criteria import MultiMetricCriteria -class MetricCriteria(Model): +class MetricCriteria(MultiMetricCriteria): """Criterion to filter metrics. All required parameters must be populated in order to send to Azure. + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str :param name: Required. Name of the criteria. :type name: str :param metric_name: Required. Name of the metric. @@ -35,6 +40,7 @@ class MetricCriteria(Model): """ _validation = { + 'criterion_type': {'required': True}, 'name': {'required': True}, 'metric_name': {'required': True}, 'operator': {'required': True}, @@ -43,6 +49,8 @@ class MetricCriteria(Model): } _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'metric_name': {'key': 'metricName', 'type': 'str'}, 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, @@ -61,3 +69,4 @@ def __init__(self, **kwargs): self.time_aggregation = kwargs.get('time_aggregation', None) self.threshold = kwargs.get('threshold', None) self.dimensions = kwargs.get('dimensions', None) + self.criterion_type = 'StaticThresholdCriterion' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria_py3.py index 92b41eba937f..7b0a1edc9dbb 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria_py3.py @@ -9,14 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from .multi_metric_criteria_py3 import MultiMetricCriteria -class MetricCriteria(Model): +class MetricCriteria(MultiMetricCriteria): """Criterion to filter metrics. All required parameters must be populated in order to send to Azure. + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str :param name: Required. Name of the criteria. :type name: str :param metric_name: Required. Name of the metric. @@ -35,6 +40,7 @@ class MetricCriteria(Model): """ _validation = { + 'criterion_type': {'required': True}, 'name': {'required': True}, 'metric_name': {'required': True}, 'operator': {'required': True}, @@ -43,6 +49,8 @@ class MetricCriteria(Model): } _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'metric_name': {'key': 'metricName', 'type': 'str'}, 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, @@ -52,8 +60,8 @@ class MetricCriteria(Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, *, name: str, metric_name: str, operator, time_aggregation, threshold: float, metric_namespace: str=None, dimensions=None, **kwargs) -> None: - super(MetricCriteria, self).__init__(**kwargs) + def __init__(self, *, name: str, metric_name: str, operator, time_aggregation, threshold: float, additional_properties=None, metric_namespace: str=None, dimensions=None, **kwargs) -> None: + super(MetricCriteria, self).__init__(additional_properties=additional_properties, **kwargs) self.name = name self.metric_name = metric_name self.metric_namespace = metric_namespace @@ -61,3 +69,4 @@ def __init__(self, *, name: str, metric_name: str, operator, time_aggregation, t self.time_aggregation = time_aggregation self.threshold = threshold self.dimensions = dimensions + self.criterion_type = 'StaticThresholdCriterion' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension.py index a81cb14b5060..54e286156ce6 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension.py @@ -19,7 +19,8 @@ class MetricDimension(Model): :param name: Required. Name of the dimension. :type name: str - :param operator: Required. the dimension operator. + :param operator: Required. the dimension operator. Only 'Include' and + 'Exclude' are supported :type operator: str :param values: Required. list of dimension values. :type values: list[str] diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension_py3.py index 545c571e2ffe..d25bac118b87 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension_py3.py @@ -19,7 +19,8 @@ class MetricDimension(Model): :param name: Required. Name of the dimension. :type name: str - :param operator: Required. the dimension operator. + :param operator: Required. the dimension operator. Only 'Include' and + 'Exclude' are supported :type operator: str :param values: Required. list of dimension values. :type values: list[str] diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria.py new file mode 100644 index 000000000000..03c567924a33 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MultiMetricCriteria(Model): + """The types of conditions for a multi resource alert. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MetricCriteria + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + """ + + _validation = { + 'criterion_type': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + } + + _subtype_map = { + 'criterion_type': {'StaticThresholdCriterion': 'MetricCriteria'} + } + + def __init__(self, **kwargs): + super(MultiMetricCriteria, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.criterion_type = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria_py3.py new file mode 100644 index 000000000000..20c983aab667 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/multi_metric_criteria_py3.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MultiMetricCriteria(Model): + """The types of conditions for a multi resource alert. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MetricCriteria + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param criterion_type: Required. Constant filled by server. + :type criterion_type: str + """ + + _validation = { + 'criterion_type': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'criterion_type': {'key': 'criterionType', 'type': 'str'}, + } + + _subtype_map = { + 'criterion_type': {'StaticThresholdCriterion': 'MetricCriteria'} + } + + def __init__(self, *, additional_properties=None, **kwargs) -> None: + super(MultiMetricCriteria, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.criterion_type = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py index 4c305b2d49ba..b36c44a8fc20 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py @@ -17,7 +17,7 @@ class Source(Model): All required parameters must be populated in order to send to Azure. - :param query: Required. Log search query. + :param query: Log search query. Required for action type - AlertingAction :type query: str :param authorized_resources: List of Resource referred into query :type authorized_resources: list[str] @@ -30,7 +30,6 @@ class Source(Model): """ _validation = { - 'query': {'required': True}, 'data_source_id': {'required': True}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py index 77655c4b55b5..ef333528e077 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py @@ -17,7 +17,7 @@ class Source(Model): All required parameters must be populated in order to send to Azure. - :param query: Required. Log search query. + :param query: Log search query. Required for action type - AlertingAction :type query: str :param authorized_resources: List of Resource referred into query :type authorized_resources: list[str] @@ -30,7 +30,6 @@ class Source(Model): """ _validation = { - 'query': {'required': True}, 'data_source_id': {'required': True}, } @@ -41,7 +40,7 @@ class Source(Model): 'query_type': {'key': 'queryType', 'type': 'str'}, } - def __init__(self, *, query: str, data_source_id: str, authorized_resources=None, query_type=None, **kwargs) -> None: + def __init__(self, *, data_source_id: str, query: str=None, authorized_resources=None, query_type=None, **kwargs) -> None: super(Source, self).__init__(**kwargs) self.query = query self.authorized_resources = authorized_resources diff --git a/azure-mgmt-monitor/azure_bdist_wheel.py b/azure-mgmt-monitor/azure_bdist_wheel.py deleted file mode 100644 index 8a81d1b61775..000000000000 --- a/azure-mgmt-monitor/azure_bdist_wheel.py +++ /dev/null @@ -1,54 +0,0 @@ -#------------------------------------------------------------------------- -# 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-monitor/setup.cfg b/azure-mgmt-monitor/setup.cfg index 856f4164982c..3c6e79cf31da 100644 --- a/azure-mgmt-monitor/setup.cfg +++ b/azure-mgmt-monitor/setup.cfg @@ -1,3 +1,2 @@ [bdist_wheel] universal=1 -azure-namespace-package=azure-mgmt-nspkg \ No newline at end of file diff --git a/azure-mgmt-monitor/setup.py b/azure-mgmt-monitor/setup.py index ffcda8384968..e26e0db3cc39 100644 --- a/azure-mgmt-monitor/setup.py +++ b/azure-mgmt-monitor/setup.py @@ -10,12 +10,6 @@ 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-monitor" @@ -76,11 +70,18 @@ 'License :: OSI Approved :: MIT License', ], zip_safe=False, - packages=find_packages(exclude=["tests"]), + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), install_requires=[ 'msrest>=0.5.0', 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', ], - cmdclass=cmdclass + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } )