diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py index 660160f0c293..1bc5fbd9c18f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py @@ -117,6 +117,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-06-01: :mod:`v2019_06_01.models` * 2019-10-17-preview: :mod:`v2019_10_17.models` * 2020-01-01-preview: :mod:`v2020_01_01_preview.models` + * 2020-05-01-preview: :mod:`v2020_05_01_preview.models` """ if api_version == '2015-04-01': from .v2015_04_01 import models @@ -175,6 +176,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-01-01-preview': from .v2020_01_01_preview import models return models + elif api_version == '2020-05-01-preview': + from .v2020_05_01_preview import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @property @@ -563,10 +567,13 @@ def scheduled_query_rules(self): """Instance depends on the API version: * 2018-04-16: :class:`ScheduledQueryRulesOperations` + * 2020-05-01-preview: :class:`ScheduledQueryRulesOperations` """ api_version = self._get_api_version('scheduled_query_rules') if api_version == '2018-04-16': from .v2018_04_16.operations import ScheduledQueryRulesOperations as OperationClass + elif api_version == '2020-05-01-preview': + from .v2020_05_01_preview.operations import ScheduledQueryRulesOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py index f01772429af5..bb3c8394d87b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py @@ -332,6 +332,10 @@ class MultiMetricCriteria(Model): :param dimensions: List of dimension conditions. :type dimensions: list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param skip_metric_validation: Allows creating an alert rule on a custom + metric that isn't yet emitted, by causing the metric validation to be + skipped. + :type skip_metric_validation: bool :param criterion_type: Required. Constant filled by server. :type criterion_type: str """ @@ -350,6 +354,7 @@ class MultiMetricCriteria(Model): 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'}, 'criterion_type': {'key': 'criterionType', 'type': 'str'}, } @@ -365,6 +370,7 @@ def __init__(self, **kwargs): self.metric_namespace = kwargs.get('metric_namespace', None) self.time_aggregation = kwargs.get('time_aggregation', None) self.dimensions = kwargs.get('dimensions', None) + self.skip_metric_validation = kwargs.get('skip_metric_validation', None) self.criterion_type = None @@ -387,6 +393,10 @@ class DynamicMetricCriteria(MultiMetricCriteria): :param dimensions: List of dimension conditions. :type dimensions: list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param skip_metric_validation: Allows creating an alert rule on a custom + metric that isn't yet emitted, by causing the metric validation to be + skipped. + :type skip_metric_validation: bool :param criterion_type: Required. Constant filled by server. :type criterion_type: str :param operator: Required. The operator used to compare the metric value @@ -427,6 +437,7 @@ class DynamicMetricCriteria(MultiMetricCriteria): 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'}, 'criterion_type': {'key': 'criterionType', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'alert_sensitivity': {'key': 'alertSensitivity', 'type': 'str'}, @@ -1057,6 +1068,10 @@ class MetricCriteria(MultiMetricCriteria): :param dimensions: List of dimension conditions. :type dimensions: list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param skip_metric_validation: Allows creating an alert rule on a custom + metric that isn't yet emitted, by causing the metric validation to be + skipped. + :type skip_metric_validation: bool :param criterion_type: Required. Constant filled by server. :type criterion_type: str :param operator: Required. the criteria operator. Possible values include: @@ -1084,6 +1099,7 @@ class MetricCriteria(MultiMetricCriteria): 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'}, 'criterion_type': {'key': 'criterionType', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'threshold': {'key': 'threshold', 'type': 'float'}, diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py index 2e6beeff0eca..dd52c49ceb7a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py @@ -332,6 +332,10 @@ class MultiMetricCriteria(Model): :param dimensions: List of dimension conditions. :type dimensions: list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param skip_metric_validation: Allows creating an alert rule on a custom + metric that isn't yet emitted, by causing the metric validation to be + skipped. + :type skip_metric_validation: bool :param criterion_type: Required. Constant filled by server. :type criterion_type: str """ @@ -350,6 +354,7 @@ class MultiMetricCriteria(Model): 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'}, 'criterion_type': {'key': 'criterionType', 'type': 'str'}, } @@ -357,7 +362,7 @@ class MultiMetricCriteria(Model): 'criterion_type': {'StaticThresholdCriterion': 'MetricCriteria', 'DynamicThresholdCriterion': 'DynamicMetricCriteria'} } - def __init__(self, *, name: str, metric_name: str, time_aggregation, additional_properties=None, metric_namespace: str=None, dimensions=None, **kwargs) -> None: + def __init__(self, *, name: str, metric_name: str, time_aggregation, additional_properties=None, metric_namespace: str=None, dimensions=None, skip_metric_validation: bool=None, **kwargs) -> None: super(MultiMetricCriteria, self).__init__(**kwargs) self.additional_properties = additional_properties self.name = name @@ -365,6 +370,7 @@ def __init__(self, *, name: str, metric_name: str, time_aggregation, additional_ self.metric_namespace = metric_namespace self.time_aggregation = time_aggregation self.dimensions = dimensions + self.skip_metric_validation = skip_metric_validation self.criterion_type = None @@ -387,6 +393,10 @@ class DynamicMetricCriteria(MultiMetricCriteria): :param dimensions: List of dimension conditions. :type dimensions: list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param skip_metric_validation: Allows creating an alert rule on a custom + metric that isn't yet emitted, by causing the metric validation to be + skipped. + :type skip_metric_validation: bool :param criterion_type: Required. Constant filled by server. :type criterion_type: str :param operator: Required. The operator used to compare the metric value @@ -427,6 +437,7 @@ class DynamicMetricCriteria(MultiMetricCriteria): 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'}, 'criterion_type': {'key': 'criterionType', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'alert_sensitivity': {'key': 'alertSensitivity', 'type': 'str'}, @@ -434,8 +445,8 @@ class DynamicMetricCriteria(MultiMetricCriteria): 'ignore_data_before': {'key': 'ignoreDataBefore', 'type': 'iso-8601'}, } - def __init__(self, *, name: str, metric_name: str, time_aggregation, operator, alert_sensitivity, failing_periods, additional_properties=None, metric_namespace: str=None, dimensions=None, ignore_data_before=None, **kwargs) -> None: - super(DynamicMetricCriteria, self).__init__(additional_properties=additional_properties, name=name, metric_name=metric_name, metric_namespace=metric_namespace, time_aggregation=time_aggregation, dimensions=dimensions, **kwargs) + def __init__(self, *, name: str, metric_name: str, time_aggregation, operator, alert_sensitivity, failing_periods, additional_properties=None, metric_namespace: str=None, dimensions=None, skip_metric_validation: bool=None, ignore_data_before=None, **kwargs) -> None: + super(DynamicMetricCriteria, self).__init__(additional_properties=additional_properties, name=name, metric_name=metric_name, metric_namespace=metric_namespace, time_aggregation=time_aggregation, dimensions=dimensions, skip_metric_validation=skip_metric_validation, **kwargs) self.operator = operator self.alert_sensitivity = alert_sensitivity self.failing_periods = failing_periods @@ -1057,6 +1068,10 @@ class MetricCriteria(MultiMetricCriteria): :param dimensions: List of dimension conditions. :type dimensions: list[~azure.mgmt.monitor.v2018_03_01.models.MetricDimension] + :param skip_metric_validation: Allows creating an alert rule on a custom + metric that isn't yet emitted, by causing the metric validation to be + skipped. + :type skip_metric_validation: bool :param criterion_type: Required. Constant filled by server. :type criterion_type: str :param operator: Required. the criteria operator. Possible values include: @@ -1084,13 +1099,14 @@ class MetricCriteria(MultiMetricCriteria): 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'time_aggregation': {'key': 'timeAggregation', 'type': 'object'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'skip_metric_validation': {'key': 'skipMetricValidation', 'type': 'bool'}, 'criterion_type': {'key': 'criterionType', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'threshold': {'key': 'threshold', 'type': 'float'}, } - def __init__(self, *, name: str, metric_name: str, time_aggregation, operator, threshold: float, additional_properties=None, metric_namespace: str=None, dimensions=None, **kwargs) -> None: - super(MetricCriteria, self).__init__(additional_properties=additional_properties, name=name, metric_name=metric_name, metric_namespace=metric_namespace, time_aggregation=time_aggregation, dimensions=dimensions, **kwargs) + def __init__(self, *, name: str, metric_name: str, time_aggregation, operator, threshold: float, additional_properties=None, metric_namespace: str=None, dimensions=None, skip_metric_validation: bool=None, **kwargs) -> None: + super(MetricCriteria, self).__init__(additional_properties=additional_properties, name=name, metric_name=metric_name, metric_namespace=metric_namespace, time_aggregation=time_aggregation, dimensions=dimensions, skip_metric_validation=skip_metric_validation, **kwargs) self.operator = operator self.threshold = threshold self.criterion_type = 'StaticThresholdCriterion' diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py new file mode 100644 index 000000000000..940dc0469831 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py @@ -0,0 +1,19 @@ +# 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 ._configuration import MonitorClientConfiguration +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient', 'MonitorClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py new file mode 100644 index 000000000000..b3de8cc8b8f3 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py @@ -0,0 +1,48 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorClientConfiguration(AzureConfiguration): + """Configuration for MonitorClient + 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: The Azure subscription Id. + :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 = 'https://management.azure.com' + + super(MonitorClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_client.py new file mode 100644 index 000000000000..9126e1c0d2cb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_client.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.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorClientConfiguration +from .operations import ScheduledQueryRulesOperations +from . import models + + +class MonitorClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorClientConfiguration + + :ivar scheduled_query_rules: ScheduledQueryRules operations + :vartype scheduled_query_rules: azure.mgmt.monitor.v2020_05_01_preview.operations.ScheduledQueryRulesOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription Id. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MonitorClientConfiguration(credentials, subscription_id, base_url) + super(MonitorClient, 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 = '2020-05-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.scheduled_query_rules = ScheduledQueryRulesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py new file mode 100644 index 000000000000..cfb550741775 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py @@ -0,0 +1,68 @@ +# 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 ._models_py3 import Action + from ._models_py3 import AzureEntityResource + from ._models_py3 import Condition + from ._models_py3 import ConditionFailingPeriods + from ._models_py3 import Dimension + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorContract, ErrorContractException + from ._models_py3 import ErrorResponse + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import ScheduledQueryRuleCriteria + from ._models_py3 import ScheduledQueryRuleResource + from ._models_py3 import ScheduledQueryRuleResourcePatch + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import Action + from ._models import AzureEntityResource + from ._models import Condition + from ._models import ConditionFailingPeriods + from ._models import Dimension + from ._models import ErrorAdditionalInfo + from ._models import ErrorContract, ErrorContractException + from ._models import ErrorResponse + from ._models import ProxyResource + from ._models import Resource + from ._models import ScheduledQueryRuleCriteria + from ._models import ScheduledQueryRuleResource + from ._models import ScheduledQueryRuleResourcePatch + from ._models import TrackedResource +from ._paged_models import ScheduledQueryRuleResourcePaged +from ._monitor_client_enums import ( + TimeAggregation, + DimensionOperator, + ConditionOperator, +) + +__all__ = [ + 'Action', + 'AzureEntityResource', + 'Condition', + 'ConditionFailingPeriods', + 'Dimension', + 'ErrorAdditionalInfo', + 'ErrorContract', 'ErrorContractException', + 'ErrorResponse', + 'ProxyResource', + 'Resource', + 'ScheduledQueryRuleCriteria', + 'ScheduledQueryRuleResource', + 'ScheduledQueryRuleResourcePatch', + 'TrackedResource', + 'ScheduledQueryRuleResourcePaged', + 'TimeAggregation', + 'DimensionOperator', + 'ConditionOperator', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py new file mode 100644 index 000000000000..268824223ee8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py @@ -0,0 +1,596 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class Action(Model): + """Actions to invoke when the alert fires. + + :param action_group_id: Action Group resource Id to invoke when the alert + fires. + :type action_group_id: str + :param web_hook_properties: The properties of a webhook object. + :type web_hook_properties: dict[str, str] + """ + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'web_hook_properties': {'key': 'webHookProperties', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Action, self).__init__(**kwargs) + self.action_group_id = kwargs.get('action_group_id', None) + self.web_hook_properties = kwargs.get('web_hook_properties', None) + + +class Resource(Model): + """Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AzureEntityResource(Resource): + """The resource model definition for a Azure Resource Manager resource with an + etag. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Condition(Model): + """A condition of the scheduled query rule. + + All required parameters must be populated in order to send to Azure. + + :param query: Log query alert + :type query: str + :param time_aggregation: Required. Aggregation type. Possible values + include: 'Count', 'Average', 'Minimum', 'Maximum', 'Total' + :type time_aggregation: str or + ~azure.mgmt.monitor.v2020_05_01_preview.models.TimeAggregation + :param metric_measure_column: The column containing the metric measure + number. + :type metric_measure_column: str + :param resource_id_column: The column containing the resource id. The + content of the column must be a uri formatted as resource id + :type resource_id_column: str + :param dimensions: List of Dimensions conditions + :type dimensions: + list[~azure.mgmt.monitor.v2020_05_01_preview.models.Dimension] + :param operator: Required. The criteria operator. Possible values include: + 'Equals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + 'LessThanOrEqual' + :type operator: str or + ~azure.mgmt.monitor.v2020_05_01_preview.models.ConditionOperator + :param threshold: Required. the criteria threshold value that activates + the alert. + :type threshold: float + :param failing_periods: The minimum number of violations required within + the selected lookback time window required to raise an alert. + :type failing_periods: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ConditionFailingPeriods + """ + + _validation = { + 'time_aggregation': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'str'}, + 'metric_measure_column': {'key': 'metricMeasureColumn', 'type': 'str'}, + 'resource_id_column': {'key': 'resourceIdColumn', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'failing_periods': {'key': 'failingPeriods', 'type': 'ConditionFailingPeriods'}, + } + + def __init__(self, **kwargs): + super(Condition, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + self.time_aggregation = kwargs.get('time_aggregation', None) + self.metric_measure_column = kwargs.get('metric_measure_column', None) + self.resource_id_column = kwargs.get('resource_id_column', None) + self.dimensions = kwargs.get('dimensions', None) + self.operator = kwargs.get('operator', None) + self.threshold = kwargs.get('threshold', None) + self.failing_periods = kwargs.get('failing_periods', None) + + +class ConditionFailingPeriods(Model): + """The minimum number of violations required within the selected lookback time + window required to raise an alert. + + :param number_of_evaluation_periods: The number of aggregated lookback + points. The lookback time window is calculated based on the aggregation + granularity (windowSize) and the selected number of aggregated points. + Default value is 1. Default value: 1 . + :type number_of_evaluation_periods: long + :param min_failing_periods_to_alert: The number of violations to trigger + an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default + value is 1. Default value: 1 . + :type min_failing_periods_to_alert: long + """ + + _attribute_map = { + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'long'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'long'}, + } + + def __init__(self, **kwargs): + super(ConditionFailingPeriods, self).__init__(**kwargs) + self.number_of_evaluation_periods = kwargs.get('number_of_evaluation_periods', 1) + self.min_failing_periods_to_alert = kwargs.get('min_failing_periods_to_alert', 1) + + +class Dimension(Model): + """Dimension splitting and filtering definition. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension + :type name: str + :param operator: Required. Operator for dimension values. Possible values + include: 'Include', 'Exclude' + :type operator: str or + ~azure.mgmt.monitor.v2020_05_01_preview.models.DimensionOperator + :param values: Required. List of dimension values + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(Dimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.operator = kwargs.get('operator', None) + self.values = kwargs.get('values', None) + + +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorContract(Model): + """Describes the format of Error response. + + :param error: The error details. + :type error: ~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(ErrorContract, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorContractException(HttpOperationError): + """Server responsed with exception of type: 'ErrorContract'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorContractException, self).__init__(deserialize, response, 'ErrorContract', *args) + + +class ErrorResponse(Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) + + +class ScheduledQueryRuleCriteria(Model): + """The rule criteria that defines the conditions of the scheduled query rule. + + :param all_of: A list of conditions to evaluate against the specified + scopes + :type all_of: + list[~azure.mgmt.monitor.v2020_05_01_preview.models.Condition] + """ + + _attribute_map = { + 'all_of': {'key': 'allOf', 'type': '[Condition]'}, + } + + def __init__(self, **kwargs): + super(ScheduledQueryRuleCriteria, self).__init__(**kwargs) + self.all_of = kwargs.get('all_of', None) + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + + +class ScheduledQueryRuleResource(TrackedResource): + """The scheduled query rule resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + :param description: The description of the scheduled query rule. + :type description: str + :param severity: Severity of the alert. Should be an integer between + [0-4]. Value of 0 is severest + :type severity: float + :param enabled: The flag which indicates whether this scheduled query rule + is enabled. Value should be true or false + :type enabled: bool + :param scopes: The list of resource id's that this scheduled query rule is + scoped to. + :type scopes: list[str] + :param evaluation_frequency: How often the scheduled query rule is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: The period of time (in ISO 8601 duration format) on + which the Alert query will be executed (bin size). + :type window_size: timedelta + :param target_resource_types: List of resource type of the target + resource(s) on which the alert is created/updated. For example if the + scope is a resource group and targetResourceTypes is + Microsoft.Compute/virtualMachines, then a different alert will be fired + for each virtual machine in the resource group which meet the alert + criteria + :type target_resource_types: list[str] + :param criteria: The rule criteria that defines the conditions of the + scheduled query rule. + :type criteria: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time + (in ISO 8601 duration format) after the alert is fired. + :type mute_actions_duration: timedelta + :param actions: + :type actions: list[~azure.mgmt.monitor.v2020_05_01_preview.models.Action] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'float'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, + 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, + 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + } + + def __init__(self, **kwargs): + super(ScheduledQueryRuleResource, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.severity = kwargs.get('severity', None) + self.enabled = kwargs.get('enabled', None) + self.scopes = kwargs.get('scopes', None) + self.evaluation_frequency = kwargs.get('evaluation_frequency', None) + self.window_size = kwargs.get('window_size', None) + self.target_resource_types = kwargs.get('target_resource_types', None) + self.criteria = kwargs.get('criteria', None) + self.mute_actions_duration = kwargs.get('mute_actions_duration', None) + self.actions = kwargs.get('actions', None) + + +class ScheduledQueryRuleResourcePatch(Model): + """The scheduled query rule resource for patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param description: The description of the scheduled query rule. + :type description: str + :param severity: Severity of the alert. Should be an integer between + [0-4]. Value of 0 is severest + :type severity: float + :param enabled: The flag which indicates whether this scheduled query rule + is enabled. Value should be true or false + :type enabled: bool + :param scopes: The list of resource id's that this scheduled query rule is + scoped to. + :type scopes: list[str] + :param evaluation_frequency: How often the scheduled query rule is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: The period of time (in ISO 8601 duration format) on + which the Alert query will be executed (bin size). + :type window_size: timedelta + :param target_resource_types: List of resource type of the target + resource(s) on which the alert is created/updated. For example if the + scope is a resource group and targetResourceTypes is + Microsoft.Compute/virtualMachines, then a different alert will be fired + for each virtual machine in the resource group which meet the alert + criteria + :type target_resource_types: list[str] + :param criteria: The rule criteria that defines the conditions of the + scheduled query rule. + :type criteria: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time + (in ISO 8601 duration format) after the alert is fired. + :type mute_actions_duration: timedelta + :param actions: + :type actions: list[~azure.mgmt.monitor.v2020_05_01_preview.models.Action] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'float'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, + 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, + 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + } + + def __init__(self, **kwargs): + super(ScheduledQueryRuleResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.description = kwargs.get('description', None) + self.severity = kwargs.get('severity', None) + self.enabled = kwargs.get('enabled', None) + self.scopes = kwargs.get('scopes', None) + self.evaluation_frequency = kwargs.get('evaluation_frequency', None) + self.window_size = kwargs.get('window_size', None) + self.target_resource_types = kwargs.get('target_resource_types', None) + self.criteria = kwargs.get('criteria', None) + self.mute_actions_duration = kwargs.get('mute_actions_duration', None) + self.actions = kwargs.get('actions', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..a573aeb843d2 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py @@ -0,0 +1,596 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class Action(Model): + """Actions to invoke when the alert fires. + + :param action_group_id: Action Group resource Id to invoke when the alert + fires. + :type action_group_id: str + :param web_hook_properties: The properties of a webhook object. + :type web_hook_properties: dict[str, str] + """ + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'web_hook_properties': {'key': 'webHookProperties', 'type': '{str}'}, + } + + def __init__(self, *, action_group_id: str=None, web_hook_properties=None, **kwargs) -> None: + super(Action, self).__init__(**kwargs) + self.action_group_id = action_group_id + self.web_hook_properties = web_hook_properties + + +class Resource(Model): + """Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AzureEntityResource(Resource): + """The resource model definition for a Azure Resource Manager resource with an + etag. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Condition(Model): + """A condition of the scheduled query rule. + + All required parameters must be populated in order to send to Azure. + + :param query: Log query alert + :type query: str + :param time_aggregation: Required. Aggregation type. Possible values + include: 'Count', 'Average', 'Minimum', 'Maximum', 'Total' + :type time_aggregation: str or + ~azure.mgmt.monitor.v2020_05_01_preview.models.TimeAggregation + :param metric_measure_column: The column containing the metric measure + number. + :type metric_measure_column: str + :param resource_id_column: The column containing the resource id. The + content of the column must be a uri formatted as resource id + :type resource_id_column: str + :param dimensions: List of Dimensions conditions + :type dimensions: + list[~azure.mgmt.monitor.v2020_05_01_preview.models.Dimension] + :param operator: Required. The criteria operator. Possible values include: + 'Equals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + 'LessThanOrEqual' + :type operator: str or + ~azure.mgmt.monitor.v2020_05_01_preview.models.ConditionOperator + :param threshold: Required. the criteria threshold value that activates + the alert. + :type threshold: float + :param failing_periods: The minimum number of violations required within + the selected lookback time window required to raise an alert. + :type failing_periods: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ConditionFailingPeriods + """ + + _validation = { + 'time_aggregation': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'str'}, + 'metric_measure_column': {'key': 'metricMeasureColumn', 'type': 'str'}, + 'resource_id_column': {'key': 'resourceIdColumn', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'failing_periods': {'key': 'failingPeriods', 'type': 'ConditionFailingPeriods'}, + } + + def __init__(self, *, time_aggregation, operator, threshold: float, query: str=None, metric_measure_column: str=None, resource_id_column: str=None, dimensions=None, failing_periods=None, **kwargs) -> None: + super(Condition, self).__init__(**kwargs) + self.query = query + self.time_aggregation = time_aggregation + self.metric_measure_column = metric_measure_column + self.resource_id_column = resource_id_column + self.dimensions = dimensions + self.operator = operator + self.threshold = threshold + self.failing_periods = failing_periods + + +class ConditionFailingPeriods(Model): + """The minimum number of violations required within the selected lookback time + window required to raise an alert. + + :param number_of_evaluation_periods: The number of aggregated lookback + points. The lookback time window is calculated based on the aggregation + granularity (windowSize) and the selected number of aggregated points. + Default value is 1. Default value: 1 . + :type number_of_evaluation_periods: long + :param min_failing_periods_to_alert: The number of violations to trigger + an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default + value is 1. Default value: 1 . + :type min_failing_periods_to_alert: long + """ + + _attribute_map = { + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'long'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'long'}, + } + + def __init__(self, *, number_of_evaluation_periods: int=1, min_failing_periods_to_alert: int=1, **kwargs) -> None: + super(ConditionFailingPeriods, self).__init__(**kwargs) + self.number_of_evaluation_periods = number_of_evaluation_periods + self.min_failing_periods_to_alert = min_failing_periods_to_alert + + +class Dimension(Model): + """Dimension splitting and filtering definition. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension + :type name: str + :param operator: Required. Operator for dimension values. Possible values + include: 'Include', 'Exclude' + :type operator: str or + ~azure.mgmt.monitor.v2020_05_01_preview.models.DimensionOperator + :param values: Required. List of dimension values + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__(self, *, name: str, operator, values, **kwargs) -> None: + super(Dimension, self).__init__(**kwargs) + self.name = name + self.operator = operator + self.values = values + + +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorContract(Model): + """Describes the format of Error response. + + :param error: The error details. + :type error: ~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorContract, self).__init__(**kwargs) + self.error = error + + +class ErrorContractException(HttpOperationError): + """Server responsed with exception of type: 'ErrorContract'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorContractException, self).__init__(deserialize, response, 'ErrorContract', *args) + + +class ErrorResponse(Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) + + +class ScheduledQueryRuleCriteria(Model): + """The rule criteria that defines the conditions of the scheduled query rule. + + :param all_of: A list of conditions to evaluate against the specified + scopes + :type all_of: + list[~azure.mgmt.monitor.v2020_05_01_preview.models.Condition] + """ + + _attribute_map = { + 'all_of': {'key': 'allOf', 'type': '[Condition]'}, + } + + def __init__(self, *, all_of=None, **kwargs) -> None: + super(ScheduledQueryRuleCriteria, self).__init__(**kwargs) + self.all_of = all_of + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class ScheduledQueryRuleResource(TrackedResource): + """The scheduled query rule resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + :param description: The description of the scheduled query rule. + :type description: str + :param severity: Severity of the alert. Should be an integer between + [0-4]. Value of 0 is severest + :type severity: float + :param enabled: The flag which indicates whether this scheduled query rule + is enabled. Value should be true or false + :type enabled: bool + :param scopes: The list of resource id's that this scheduled query rule is + scoped to. + :type scopes: list[str] + :param evaluation_frequency: How often the scheduled query rule is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: The period of time (in ISO 8601 duration format) on + which the Alert query will be executed (bin size). + :type window_size: timedelta + :param target_resource_types: List of resource type of the target + resource(s) on which the alert is created/updated. For example if the + scope is a resource group and targetResourceTypes is + Microsoft.Compute/virtualMachines, then a different alert will be fired + for each virtual machine in the resource group which meet the alert + criteria + :type target_resource_types: list[str] + :param criteria: The rule criteria that defines the conditions of the + scheduled query rule. + :type criteria: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time + (in ISO 8601 duration format) after the alert is fired. + :type mute_actions_duration: timedelta + :param actions: + :type actions: list[~azure.mgmt.monitor.v2020_05_01_preview.models.Action] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'float'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, + 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, + 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + } + + def __init__(self, *, location: str, tags=None, description: str=None, severity: float=None, enabled: bool=None, scopes=None, evaluation_frequency=None, window_size=None, target_resource_types=None, criteria=None, mute_actions_duration=None, actions=None, **kwargs) -> None: + super(ScheduledQueryRuleResource, self).__init__(tags=tags, location=location, **kwargs) + self.description = description + self.severity = severity + self.enabled = enabled + self.scopes = scopes + self.evaluation_frequency = evaluation_frequency + self.window_size = window_size + self.target_resource_types = target_resource_types + self.criteria = criteria + self.mute_actions_duration = mute_actions_duration + self.actions = actions + + +class ScheduledQueryRuleResourcePatch(Model): + """The scheduled query rule resource for patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param description: The description of the scheduled query rule. + :type description: str + :param severity: Severity of the alert. Should be an integer between + [0-4]. Value of 0 is severest + :type severity: float + :param enabled: The flag which indicates whether this scheduled query rule + is enabled. Value should be true or false + :type enabled: bool + :param scopes: The list of resource id's that this scheduled query rule is + scoped to. + :type scopes: list[str] + :param evaluation_frequency: How often the scheduled query rule is + evaluated represented in ISO 8601 duration format. + :type evaluation_frequency: timedelta + :param window_size: The period of time (in ISO 8601 duration format) on + which the Alert query will be executed (bin size). + :type window_size: timedelta + :param target_resource_types: List of resource type of the target + resource(s) on which the alert is created/updated. For example if the + scope is a resource group and targetResourceTypes is + Microsoft.Compute/virtualMachines, then a different alert will be fired + for each virtual machine in the resource group which meet the alert + criteria + :type target_resource_types: list[str] + :param criteria: The rule criteria that defines the conditions of the + scheduled query rule. + :type criteria: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time + (in ISO 8601 duration format) after the alert is fired. + :type mute_actions_duration: timedelta + :param actions: + :type actions: list[~azure.mgmt.monitor.v2020_05_01_preview.models.Action] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'float'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, + 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, + 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, + 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, + 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + } + + def __init__(self, *, tags=None, description: str=None, severity: float=None, enabled: bool=None, scopes=None, evaluation_frequency=None, window_size=None, target_resource_types=None, criteria=None, mute_actions_duration=None, actions=None, **kwargs) -> None: + super(ScheduledQueryRuleResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.description = description + self.severity = severity + self.enabled = enabled + self.scopes = scopes + self.evaluation_frequency = evaluation_frequency + self.window_size = window_size + self.target_resource_types = target_resource_types + self.criteria = criteria + self.mute_actions_duration = mute_actions_duration + self.actions = actions diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_monitor_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_monitor_client_enums.py new file mode 100644 index 000000000000..93fa54eb856b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_monitor_client_enums.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 enum import Enum + + +class TimeAggregation(str, Enum): + + count = "Count" + average = "Average" + minimum = "Minimum" + maximum = "Maximum" + total = "Total" + + +class DimensionOperator(str, Enum): + + include = "Include" + exclude = "Exclude" + + +class ConditionOperator(str, Enum): + + equals = "Equals" + greater_than = "GreaterThan" + greater_than_or_equal = "GreaterThanOrEqual" + less_than = "LessThan" + less_than_or_equal = "LessThanOrEqual" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..f84d254075a4 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_paged_models.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 ScheduledQueryRuleResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`ScheduledQueryRuleResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ScheduledQueryRuleResource]'} + } + + def __init__(self, *args, **kwargs): + + super(ScheduledQueryRuleResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/__init__.py new file mode 100644 index 000000000000..c8cedc13e4d9 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/__init__.py @@ -0,0 +1,16 @@ +# 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 ._scheduled_query_rules_operations import ScheduledQueryRulesOperations + +__all__ = [ + 'ScheduledQueryRulesOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py new file mode 100644 index 000000000000..448838fbdc5e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py @@ -0,0 +1,423 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ScheduledQueryRulesOperations(object): + """ScheduledQueryRulesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2020-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01-preview" + + self.config = config + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Retrieve a scheduled query rule definitions in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ScheduledQueryRuleResource + :rtype: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResourcePaged[~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource] + :raises: + :class:`ErrorContractException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorContractException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ScheduledQueryRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Retrieve scheduled query rule definitions in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ScheduledQueryRuleResource + :rtype: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResourcePaged[~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource] + :raises: + :class:`ErrorContractException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorContractException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ScheduledQueryRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} + + def get( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Retrieve an scheduled query rule definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param 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: ScheduledQueryRuleResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorContractException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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.ErrorContractException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ScheduledQueryRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} + + def create_or_update( + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a scheduled query rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource + :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: ScheduledQueryRuleResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorContractException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorContractException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ScheduledQueryRuleResource', response) + if response.status_code == 201: + deserialized = self._deserialize('ScheduledQueryRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} + + def update( + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Update a scheduled query rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to update. + :type parameters: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResourcePatch + :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: ScheduledQueryRuleResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorContractException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorContractException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ScheduledQueryRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} + + def delete( + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes a scheduled query rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorContractException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorContractException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/version.py new file mode 100644 index 000000000000..fc729cd31949 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/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 = "2020-05-01-preview" +