diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py index 1f76267967cf..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,11 @@ 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): from .resource import Resource from .scale_capacity import ScaleCapacity @@ -194,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 @@ -203,6 +212,11 @@ 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 from .incident_paged import IncidentPaged from .alert_rule_resource_paged import AlertRuleResourcePaged @@ -214,6 +228,7 @@ from .metric_definition_paged import MetricDefinitionPaged from .metric_alert_resource_paged import MetricAlertResourcePaged from .log_search_rule_resource_paged import LogSearchRuleResourcePaged +from .metric_namespace_paged import MetricNamespacePaged from .monitor_management_client_enums import ( MetricStatisticType, TimeAggregationType, @@ -326,6 +341,8 @@ 'MetricDimension', 'MetricCriteria', 'MetricAlertSingleResourceMultipleMetricCriteria', + 'MultiMetricCriteria', + 'MetricAlertMultipleResourceMultipleMetricCriteria', 'Source', 'Schedule', 'Action', @@ -335,6 +352,11 @@ 'TriggerCondition', 'AzNsActionGroup', 'AlertingAction', + 'Dimension', + 'Criteria', + 'LogToMetricAction', + 'MetricNamespaceName', + 'MetricNamespace', 'AutoscaleSettingResourcePaged', 'IncidentPaged', 'AlertRuleResourcePaged', @@ -346,6 +368,7 @@ 'MetricDefinitionPaged', 'MetricAlertResourcePaged', 'LogSearchRuleResourcePaged', + 'MetricNamespacePaged', 'MetricStatisticType', 'TimeAggregationType', 'ComparisonOperationType', diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py index 97c98e4fc86c..494f5e696a81 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py @@ -13,10 +13,10 @@ class Action(Model): - """Action. + """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 c8217283cc29..354eb4565038 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py @@ -13,10 +13,10 @@ class Action(Model): - """Action. + """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/diagnostic_settings_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource.py index 09cbca388e28..c5f28afc8219 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource.py @@ -27,6 +27,9 @@ class DiagnosticSettingsResource(ProxyOnlyResource): :param storage_account_id: The resource ID of the storage account to which you would like to send Diagnostic Logs. :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic + setting. This is here to maintain backwards compatibility. + :type service_bus_rule_id: str :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. :type event_hub_authorization_rule_id: str @@ -55,6 +58,7 @@ class DiagnosticSettingsResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, @@ -65,6 +69,7 @@ class DiagnosticSettingsResource(ProxyOnlyResource): def __init__(self, **kwargs): super(DiagnosticSettingsResource, self).__init__(**kwargs) self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) self.event_hub_name = kwargs.get('event_hub_name', None) self.metrics = kwargs.get('metrics', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource_py3.py index 8d02b9e280ca..454c57f52765 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_resource_py3.py @@ -27,6 +27,9 @@ class DiagnosticSettingsResource(ProxyOnlyResource): :param storage_account_id: The resource ID of the storage account to which you would like to send Diagnostic Logs. :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic + setting. This is here to maintain backwards compatibility. + :type service_bus_rule_id: str :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. :type event_hub_authorization_rule_id: str @@ -55,6 +58,7 @@ class DiagnosticSettingsResource(ProxyOnlyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, @@ -62,9 +66,10 @@ class DiagnosticSettingsResource(ProxyOnlyResource): 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, } - def __init__(self, *, storage_account_id: str=None, event_hub_authorization_rule_id: str=None, event_hub_name: str=None, metrics=None, logs=None, workspace_id: str=None, **kwargs) -> None: + def __init__(self, *, storage_account_id: str=None, service_bus_rule_id: str=None, event_hub_authorization_rule_id: str=None, event_hub_name: str=None, metrics=None, logs=None, workspace_id: str=None, **kwargs) -> None: super(DiagnosticSettingsResource, self).__init__(**kwargs) self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id self.event_hub_authorization_rule_id = event_hub_authorization_rule_id self.event_hub_name = event_hub_name self.metrics = metrics 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/event_data.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/event_data.py index 392b04f3e4a6..e9bb3647f764 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/event_data.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/event_data.py @@ -18,7 +18,7 @@ class EventData(Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar authorization: + :ivar authorization: The sender authorization information. :vartype authorization: ~azure.mgmt.monitor.models.SenderAuthorization :ivar claims: key value pairs to identify ARM permissions. :vartype claims: dict[str, str] diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/event_data_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/event_data_py3.py index 79ca08143d5c..3a345291877b 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/event_data_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/event_data_py3.py @@ -18,7 +18,7 @@ class EventData(Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar authorization: + :ivar authorization: The sender authorization information. :vartype authorization: ~azure.mgmt.monitor.models.SenderAuthorization :ivar claims: key value pairs to identify ARM permissions. :vartype claims: dict[str, str] diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py index 754ab30066fc..519d58917a67 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py @@ -13,14 +13,14 @@ class LogMetricTrigger(Model): - """LogMetricTrigger. + """A log metrics trigger descriptor. :param threshold_operator: Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', 'LessThan', 'Equal' :type threshold_operator: str or ~azure.mgmt.monitor.models.ConditionalOperator - :param threshold: + :param threshold: The threshold of the metric trigger. :type threshold: float :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_py3.py index bcf1cfa94dc5..08ae46234456 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_py3.py @@ -13,14 +13,14 @@ class LogMetricTrigger(Model): - """LogMetricTrigger. + """A log metrics trigger descriptor. :param threshold_operator: Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', 'LessThan', 'Equal' :type threshold_operator: str or ~azure.mgmt.monitor.models.ConditionalOperator - :param threshold: + :param threshold: The threshold of the metric trigger. :type threshold: float :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total' 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_action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py index 426d3cef5664..e4d2bb01a9a9 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py @@ -17,7 +17,7 @@ class MetricAlertAction(Model): :param action_group_id: the id of the action group to use. :type action_group_id: str - :param webhook_properties: + :param webhook_properties: The properties of a webhook object. :type webhook_properties: dict[str, str] """ diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py index da06ee03df07..e2bdeaf22ea7 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py @@ -17,7 +17,7 @@ class MetricAlertAction(Model): :param action_group_id: the id of the action group to use. :type action_group_id: str - :param webhook_properties: + :param webhook_properties: The properties of a webhook object. :type webhook_properties: dict[str, str] """ 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_alert_status_properties.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties.py index dbb20a8f55e4..a0893812d8bd 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties.py @@ -15,7 +15,7 @@ class MetricAlertStatusProperties(Model): """An alert status properties. - :param dimensions: + :param dimensions: An object describing the type of the dimensions. :type dimensions: dict[str, str] :param status: status value :type status: str diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties_py3.py index 5990828126e4..5f5896ac6361 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_status_properties_py3.py @@ -15,7 +15,7 @@ class MetricAlertStatusProperties(Model): """An alert status properties. - :param dimensions: + :param dimensions: An object describing the type of the dimensions. :type dimensions: dict[str, str] :param status: status value :type status: str 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 b9c0298fe117..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): - """MetricCriteria. +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 65c32e4e0f08..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): - """MetricCriteria. +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 a2c5882d0892..54e286156ce6 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_dimension.py @@ -13,13 +13,14 @@ class MetricDimension(Model): - """MetricDimension. + """Specifies a metric dimension. 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. 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 3bad2ed539b3..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 @@ -13,13 +13,14 @@ class MetricDimension(Model): - """MetricDimension. + """Specifies a metric dimension. 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. 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_namespace.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace.py new file mode 100644 index 000000000000..f550b7b247d4 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MetricNamespace(Model): + """Metric namespace class specifies the metadata for a metric namespace. + + :param id: The ID of the metricNamespace. + :type id: str + :param type: The type of the namespace. + :type type: str + :param name: The name of the namespace. + :type name: str + :param properties: Properties which include the fully qualified namespace + name. + :type properties: ~azure.mgmt.monitor.models.MetricNamespaceName + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MetricNamespaceName'}, + } + + def __init__(self, **kwargs): + super(MetricNamespace, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_name.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_name.py new file mode 100644 index 000000000000..504355e9d43e --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_name.py @@ -0,0 +1,28 @@ +# 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 MetricNamespaceName(Model): + """The fully qualified metric namespace name. + + :param metric_namespace_name: The metric namespace name. + :type metric_namespace_name: str + """ + + _attribute_map = { + 'metric_namespace_name': {'key': 'metricNamespaceName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricNamespaceName, self).__init__(**kwargs) + self.metric_namespace_name = kwargs.get('metric_namespace_name', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_name_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_name_py3.py new file mode 100644 index 000000000000..b4fe63755fcb --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_name_py3.py @@ -0,0 +1,28 @@ +# 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 MetricNamespaceName(Model): + """The fully qualified metric namespace name. + + :param metric_namespace_name: The metric namespace name. + :type metric_namespace_name: str + """ + + _attribute_map = { + 'metric_namespace_name': {'key': 'metricNamespaceName', 'type': 'str'}, + } + + def __init__(self, *, metric_namespace_name: str=None, **kwargs) -> None: + super(MetricNamespaceName, self).__init__(**kwargs) + self.metric_namespace_name = metric_namespace_name diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_paged.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_paged.py new file mode 100644 index 000000000000..9c3a60df700f --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class MetricNamespacePaged(Paged): + """ + A paging container for iterating over a list of :class:`MetricNamespace ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MetricNamespace]'} + } + + def __init__(self, *args, **kwargs): + + super(MetricNamespacePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_py3.py new file mode 100644 index 000000000000..6f81045b10e3 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace_py3.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MetricNamespace(Model): + """Metric namespace class specifies the metadata for a metric namespace. + + :param id: The ID of the metricNamespace. + :type id: str + :param type: The type of the namespace. + :type type: str + :param name: The name of the namespace. + :type name: str + :param properties: Properties which include the fully qualified namespace + name. + :type properties: ~azure.mgmt.monitor.models.MetricNamespaceName + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MetricNamespaceName'}, + } + + def __init__(self, *, id: str=None, type: str=None, name: str=None, properties=None, **kwargs) -> None: + super(MetricNamespace, self).__init__(**kwargs) + self.id = id + self.type = type + self.name = name + self.properties = properties diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py index 0bc042577bb6..8163abe26bac 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py @@ -39,7 +39,7 @@ class MetricTrigger(Model): :param time_aggregation: Required. time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'Average', 'Minimum', 'Maximum', - 'Total', 'Count' + 'Total', 'Count', 'Last' :type time_aggregation: str or ~azure.mgmt.monitor.models.TimeAggregationType :param operator: Required. the operator that is used to compare the metric diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py index 991b29d2707c..f4fe3daf85d7 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py @@ -39,7 +39,7 @@ class MetricTrigger(Model): :param time_aggregation: Required. time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'Average', 'Minimum', 'Maximum', - 'Total', 'Count' + 'Total', 'Count', 'Last' :type time_aggregation: str or ~azure.mgmt.monitor.models.TimeAggregationType :param operator: Required. the operator that is used to compare the metric diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py index d2bda057fbd3..20e7684fe31a 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py @@ -27,6 +27,7 @@ class TimeAggregationType(str, Enum): maximum = "Maximum" total = "Total" count = "Count" + last = "Last" class ComparisonOperationType(str, Enum): 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/recurrence.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrence.py index d9034ce60be9..02da42a83b77 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrence.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrence.py @@ -20,8 +20,11 @@ class Recurrence(Model): :param frequency: Required. the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each - week will have the same set of profiles. Possible values include: 'None', - 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' + week will have the same set of profiles. For example, to set a daily + schedule, set **schedule** to every day of the week. The frequency + property specifies that the schedule is repeated weekly. Possible values + include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', + 'Year' :type frequency: str or ~azure.mgmt.monitor.models.RecurrenceFrequency :param schedule: Required. the scheduling constraints for when the profile begins. diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrence_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrence_py3.py index 759577e56a12..7e6ada9974a0 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrence_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrence_py3.py @@ -20,8 +20,11 @@ class Recurrence(Model): :param frequency: Required. the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each - week will have the same set of profiles. Possible values include: 'None', - 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' + week will have the same set of profiles. For example, to set a daily + schedule, set **schedule** to every day of the week. The frequency + property specifies that the schedule is repeated weekly. Possible values + include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', + 'Year' :type frequency: str or ~azure.mgmt.monitor.models.RecurrenceFrequency :param schedule: Required. the scheduling constraints for when the profile begins. 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/mgmt/monitor/monitor_management_client.py b/azure-mgmt-monitor/azure/mgmt/monitor/monitor_management_client.py index f27f5bbcbefa..4580a30fc42e 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/monitor_management_client.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/monitor_management_client.py @@ -31,6 +31,7 @@ from .operations.metric_alerts_operations import MetricAlertsOperations from .operations.metric_alerts_status_operations import MetricAlertsStatusOperations from .operations.scheduled_query_rules_operations import ScheduledQueryRulesOperations +from .operations.metric_namespaces_operations import MetricNamespacesOperations from . import models @@ -108,6 +109,8 @@ class MonitorManagementClient(SDKClient): :vartype metric_alerts_status: azure.mgmt.monitor.operations.MetricAlertsStatusOperations :ivar scheduled_query_rules: ScheduledQueryRules operations :vartype scheduled_query_rules: azure.mgmt.monitor.operations.ScheduledQueryRulesOperations + :ivar metric_namespaces: MetricNamespaces operations + :vartype metric_namespaces: azure.mgmt.monitor.operations.MetricNamespacesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -163,3 +166,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.scheduled_query_rules = ScheduledQueryRulesOperations( self._client, self.config, self._serialize, self._deserialize) + self.metric_namespaces = MetricNamespacesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py index 17a5cbbab15e..bec73c3cf3a2 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py @@ -27,6 +27,7 @@ from .metric_alerts_operations import MetricAlertsOperations from .metric_alerts_status_operations import MetricAlertsStatusOperations from .scheduled_query_rules_operations import ScheduledQueryRulesOperations +from .metric_namespaces_operations import MetricNamespacesOperations __all__ = [ 'AutoscaleSettingsOperations', @@ -47,4 +48,5 @@ 'MetricAlertsOperations', 'MetricAlertsStatusOperations', 'ScheduledQueryRulesOperations', + 'MetricNamespacesOperations', ] diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/action_groups_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/action_groups_operations.py index 763b3361a9f0..4b18fda2f671 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/action_groups_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/action_groups_operations.py @@ -72,6 +72,7 @@ def create_or_update( # 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()) @@ -84,9 +85,8 @@ def create_or_update( body_content = self._serialize.body(action_group, 'ActionGroupResource') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -139,7 +139,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -148,8 +148,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -199,7 +199,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -208,8 +207,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -262,6 +261,7 @@ def update( # 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()) @@ -274,9 +274,8 @@ def update( body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -328,7 +327,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -337,9 +336,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -395,7 +393,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -404,9 +402,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -475,9 +472,8 @@ def enable_receiver( body_content = self._serialize.body(enable_request, 'EnableRequest') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 409]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/activity_log_alerts_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/activity_log_alerts_operations.py index 0aaf7dd13957..fa5a879120ad 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/activity_log_alerts_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/activity_log_alerts_operations.py @@ -74,6 +74,7 @@ def create_or_update( # 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()) @@ -86,9 +87,8 @@ def create_or_update( body_content = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -141,7 +141,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -150,8 +150,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -201,7 +201,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -210,8 +209,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -264,6 +263,7 @@ def update( # 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()) @@ -276,9 +276,8 @@ def update( body_content = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertPatchBody') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -330,7 +329,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -339,9 +338,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -397,7 +395,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -406,9 +404,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/activity_logs_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/activity_logs_operations.py index 80be5ac874ae..eb69376d8ed4 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/activity_logs_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/activity_logs_operations.py @@ -103,7 +103,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -112,9 +112,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/alert_rule_incidents_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/alert_rule_incidents_operations.py index 7c2795a91d2c..b8f3675c8d8c 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/alert_rule_incidents_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/alert_rule_incidents_operations.py @@ -74,7 +74,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -83,8 +83,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -141,7 +141,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -150,9 +150,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/alert_rules_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/alert_rules_operations.py index 593948b4b5d8..932efbdd92c6 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/alert_rules_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/alert_rules_operations.py @@ -73,6 +73,7 @@ def create_or_update( # 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()) @@ -85,9 +86,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'AlertRuleResource') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -138,7 +138,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -147,8 +146,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -193,7 +192,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -202,8 +201,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -260,6 +259,7 @@ def update( # 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()) @@ -272,9 +272,8 @@ def update( body_content = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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, 201]: raise models.ErrorResponseException(self._deserialize, response) @@ -330,7 +329,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -339,9 +338,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -360,3 +358,67 @@ def internal_paging(next_link=None, raw=False): return deserialized list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """List the alert rules within 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 AlertRuleResource + :rtype: + ~azure.mgmt.monitor.models.AlertRuleResourcePaged[~azure.mgmt.monitor.models.AlertRuleResource] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + 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) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.AlertRuleResourcePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.AlertRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules'} diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/autoscale_settings_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/autoscale_settings_operations.py index 2d4163d0a8c0..040160a20222 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/autoscale_settings_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/autoscale_settings_operations.py @@ -74,7 +74,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -83,9 +83,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -139,6 +138,7 @@ def create_or_update( # 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()) @@ -151,9 +151,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'AutoscaleSettingResource') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -205,7 +204,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -214,8 +212,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -259,7 +257,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -268,8 +266,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -325,6 +323,7 @@ def update( # 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()) @@ -337,9 +336,8 @@ def update( body_content = self._serialize.body(autoscale_setting_resource, 'AutoscaleSettingResourcePatch') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -355,3 +353,66 @@ def update( return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Lists the autoscale settings for 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 AutoscaleSettingResource + :rtype: + ~azure.mgmt.monitor.models.AutoscaleSettingResourcePaged[~azure.mgmt.monitor.models.AutoscaleSettingResource] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + 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) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.AutoscaleSettingResourcePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.AutoscaleSettingResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings'} diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/diagnostic_settings_category_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/diagnostic_settings_category_operations.py index 513c8b42319b..a6509c52d127 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/diagnostic_settings_category_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/diagnostic_settings_category_operations.py @@ -70,7 +70,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -79,8 +79,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -129,7 +129,7 @@ def list( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -138,8 +138,8 @@ def list( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/diagnostic_settings_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/diagnostic_settings_operations.py index 3b4877132de5..e5b4c8d632cc 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/diagnostic_settings_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/diagnostic_settings_operations.py @@ -69,7 +69,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -78,8 +78,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -132,6 +132,7 @@ def create_or_update( # 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()) @@ -144,9 +145,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'DiagnosticSettingsResource') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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]: raise models.ErrorResponseException(self._deserialize, response) @@ -195,7 +195,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -204,8 +203,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -247,7 +246,7 @@ def list( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -256,8 +255,8 @@ def list( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/event_categories_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/event_categories_operations.py index 27decf32205f..69e9fc5bf3ff 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/event_categories_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/event_categories_operations.py @@ -69,7 +69,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -78,9 +78,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/log_profiles_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/log_profiles_operations.py index 7f63519373ad..31c7332b3cc6 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/log_profiles_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/log_profiles_operations.py @@ -66,7 +66,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -75,8 +74,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -119,7 +118,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -128,8 +127,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -178,6 +177,7 @@ def create_or_update( # 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()) @@ -190,9 +190,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LogProfileResource') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -246,6 +245,7 @@ def update( # 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()) @@ -258,9 +258,8 @@ def update( body_content = self._serialize.body(log_profiles_resource, 'LogProfileResourcePatch') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -311,7 +310,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -320,9 +319,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_operations.py index 0f42e68bb6c3..7e68bb187a8e 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_operations.py @@ -72,7 +72,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -81,9 +81,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -139,7 +138,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -148,9 +147,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -202,7 +200,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -211,8 +209,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -265,6 +263,7 @@ def create_or_update( # 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()) @@ -277,9 +276,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'MetricAlertResource') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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]: raise models.ErrorResponseException(self._deserialize, response) @@ -332,6 +330,7 @@ def update( # 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()) @@ -344,9 +343,8 @@ def update( body_content = self._serialize.body(parameters, 'MetricAlertResourcePatch') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -395,7 +393,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -404,8 +401,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_status_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_status_operations.py index a30a72eed057..3cc2b07983a3 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_status_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_alerts_status_operations.py @@ -70,7 +70,7 @@ def list( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -79,8 +79,8 @@ def list( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -134,7 +134,7 @@ def list_by_name( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -143,8 +143,8 @@ def list_by_name( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_baseline_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_baseline_operations.py index e324b95d16e7..29561c7199eb 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_baseline_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_baseline_operations.py @@ -99,7 +99,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -108,8 +108,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -164,6 +164,7 @@ def calculate_baseline( # 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()) @@ -176,9 +177,8 @@ def calculate_baseline( body_content = self._serialize.body(time_series_information, 'TimeSeriesInformation') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(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.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_definitions_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_definitions_operations.py index ddd2271eb4ed..2a8314656421 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_definitions_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_definitions_operations.py @@ -78,7 +78,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -87,9 +87,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_namespaces_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_namespaces_operations.py new file mode 100644 index 000000000000..8dd5d6eab792 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metric_namespaces_operations.py @@ -0,0 +1,107 @@ +# 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 MetricNamespacesOperations(object): + """MetricNamespacesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-12-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-12-01-preview" + + self.config = config + + def list( + self, resource_uri, start_time=None, custom_headers=None, raw=False, **operation_config): + """Lists the metric namespaces for the resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param start_time: The ISO 8601 conform Date start time from which to + query for metric namespaces. + :type start_time: 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 MetricNamespace + :rtype: + ~azure.mgmt.monitor.models.MetricNamespacePaged[~azure.mgmt.monitor.models.MetricNamespace] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True) + } + 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') + if start_time is not None: + query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.MetricNamespacePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.MetricNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricNamespaces'} diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metrics_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metrics_operations.py index 0afa3bf09ab1..5d5dd9e7f491 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/metrics_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/metrics_operations.py @@ -122,7 +122,7 @@ def list( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -131,8 +131,8 @@ def list( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/operations.py index db6ee418bb9b..3d97da861138 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/operations.py @@ -60,7 +60,7 @@ def list( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -69,8 +69,8 @@ def list( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py index 16230f44386c..880112f3daef 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py @@ -72,6 +72,7 @@ def create_or_update( # 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()) @@ -84,9 +85,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LogSearchRuleResource') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -139,7 +139,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -148,8 +148,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -208,6 +208,7 @@ def update( # 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()) @@ -220,9 +221,8 @@ def update( body_content = self._serialize.body(parameters, 'LogSearchRuleResourcePatch') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -272,7 +272,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -281,8 +280,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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.ErrorResponseException(self._deserialize, response) @@ -333,7 +332,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -342,9 +341,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -406,7 +404,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -415,9 +413,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/tenant_activity_logs_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/tenant_activity_logs_operations.py index ead85d629064..661a649e0085 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/tenant_activity_logs_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/tenant_activity_logs_operations.py @@ -105,7 +105,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -114,9 +114,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/version.py b/azure-mgmt-monitor/azure/mgmt/monitor/version.py index 3c93989b8fef..266f5a486d79 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/version.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.5.2" +VERSION = "0.5.0"