Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

[AutoPR monitor/resource-manager] Adding patch support for SQR API #2886

Merged
merged 4 commits into from
Jun 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 8 additions & 31 deletions lib/services/monitorManagement/lib/models/alertingAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ class AlertingAction extends models['Action'] {
* Create a AlertingAction.
* @member {string} severity Severity of the alert. Possible values include:
* '0', '1', '2', '3', '4'
* @member {object} aznsAction azns notification group reference.
* @member {array} [aznsAction.actionGroup] Azure Group reference.
* @member {string} [aznsAction.emailSubject] Custom subject for Azns email
* @member {string} [aznsAction.customWebhookPayload] Custom webhook payload
* to be send to azns action group
* @member {object} aznsAction Azure action group reference.
* @member {array} [aznsAction.actionGroup] Azure Action Group reference.
* @member {string} [aznsAction.emailSubject] Custom subject override for all
* email ids in Azure action group
* @member {string} [aznsAction.customWebhookPayload] Custom payload to be
* sent for all webook URI in Azure action group
* @member {number} [throttlingInMin] time (in minutes) for which Alerts
* should be throttled
* should be throttled or suppressed.
* @member {object} trigger The trigger condition that results in the alert
* rule being.
* @member {string} [trigger.thresholdOperator] Evaluation operation for rule
Expand All @@ -38,34 +39,10 @@ class AlertingAction extends models['Action'] {
* which rule should be triggered.
* @member {object} [trigger.metricTrigger] Trigger condition for metric
* query rule
* @member {string} [trigger.metricTrigger.metricName] the name of the metric
* that defines what the rule monitors.
* @member {string} [trigger.metricTrigger.metricResourceUri] the resource
* identifier of the resource the rule monitors.
* @member {moment.duration} [trigger.metricTrigger.timeGrain] the
* granularity of metrics the rule monitors. Must be one of the predefined
* values returned from metric definitions for the metric. Must be between 12
* hours and 1 minute.
* @member {string} [trigger.metricTrigger.statistic] the metric statistic
* type. How the metrics from multiple instances are combined. Possible
* values include: 'Average', 'Min', 'Max', 'Sum'
* @member {moment.duration} [trigger.metricTrigger.timeWindow] the range of
* time in which instance data is collected. This value must be greater than
* the delay in metric collection, which can vary from resource-to-resource.
* Must be between 12 hours and 5 minutes.
* @member {string} [trigger.metricTrigger.timeAggregation] 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'
* @member {string} [trigger.metricTrigger.operator] the operator that is
* used to compare the metric data and the threshold. Possible values
* include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual',
* 'LessThan', 'LessThanOrEqual'
* @member {number} [trigger.metricTrigger.threshold] the threshold of the
* metric that triggers the scale action.
* @member {string} [trigger.metricTrigger.thresholdOperator] Evaluation
* operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible
* values include: 'GreaterThan', 'LessThan', 'Equal'
* @member {number} [trigger.metricTrigger.threshold]
* @member {string} [trigger.metricTrigger.metricTriggerType] Metric Trigger
* Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive',
* 'Total'
Expand Down
11 changes: 6 additions & 5 deletions lib/services/monitorManagement/lib/models/azNsActionGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@
'use strict';

/**
* azns notification group
* Azure action group
*
*/
class AzNsActionGroup {
/**
* Create a AzNsActionGroup.
* @member {array} [actionGroup] Azure Group reference.
* @member {string} [emailSubject] Custom subject for Azns email
* @member {string} [customWebhookPayload] Custom webhook payload to be send
* to azns action group
* @member {array} [actionGroup] Azure Action Group reference.
* @member {string} [emailSubject] Custom subject override for all email ids
* in Azure action group
* @member {string} [customWebhookPayload] Custom payload to be sent for all
* webook URI in Azure action group
*/
constructor() {
}
Expand Down
145 changes: 58 additions & 87 deletions lib/services/monitorManagement/lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ export interface ScaleCapacity {
* 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'
* @member {number} threshold the threshold of the metric that triggers the
* scale action.
* @member {string} [thresholdOperator] Evaluation operation for Metric
* -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include:
* 'GreaterThan', 'LessThan', 'Equal'
* @member {string} [metricTriggerType] Metric Trigger Type - 'Consecutive' or
* 'Total'. Possible values include: 'Consecutive', 'Total'
* @member {string} [metricColumn] Evaluation of metric on a particular column
*/
export interface MetricTrigger {
metricName: string;
Expand All @@ -100,9 +94,6 @@ export interface MetricTrigger {
timeAggregation: string;
operator: string;
threshold: number;
thresholdOperator?: string;
metricTriggerType?: string;
metricColumn?: string;
}

/**
Expand Down Expand Up @@ -163,13 +154,6 @@ export interface ScaleAction {
* 'LessThanOrEqual'
* @member {number} [metricTrigger.threshold] the threshold of the metric that
* triggers the scale action.
* @member {string} [metricTrigger.thresholdOperator] Evaluation operation for
* Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include:
* 'GreaterThan', 'LessThan', 'Equal'
* @member {string} [metricTrigger.metricTriggerType] Metric Trigger Type -
* 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total'
* @member {string} [metricTrigger.metricColumn] Evaluation of metric on a
* particular column
* @member {object} scaleAction the parameters for the scaling action.
* @member {string} [scaleAction.direction] the scale direction. Whether the
* scaling action increases or decreases the number of instances. Possible
Expand Down Expand Up @@ -2216,16 +2200,15 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA
*
* @member {string} query Log search query.
* @member {array} [authorizedResources] List of Resource referred into query
* @member {string} datasourceId The resource uri over which log search query
* @member {string} dataSourceId The resource uri over which log search query
* is to be run.
* @member {string} [queryType] Set value to ResultCount if query should be
* returning search result count. Set it to Number if its a metric query.
* Possible values include: 'ResultCount'
* @member {string} [queryType] Set value to 'ResultCount'. Possible values
* include: 'ResultCount'
*/
export interface Source {
query: string;
authorizedResources?: string[];
datasourceId: string;
dataSourceId: string;
queryType?: string;
}

Expand Down Expand Up @@ -2264,11 +2247,10 @@ export interface Schedule {
* @member {string} [source.query] Log search query.
* @member {array} [source.authorizedResources] List of Resource referred into
* query
* @member {string} [source.datasourceId] The resource uri over which log
* @member {string} [source.dataSourceId] The resource uri over which log
* search query is to be run.
* @member {string} [source.queryType] Set value to ResultCount if query should
* be returning search result count. Set it to Number if its a metric query.
* Possible values include: 'ResultCount'
* @member {string} [source.queryType] Set value to 'ResultCount'. Possible
* values include: 'ResultCount'
* @member {object} schedule Schedule (Frequnecy, Time Window) for rule.
* @member {number} [schedule.frequencyInMinutes] frequency (in minutes) at
* which rule condition should be evaluated.
Expand All @@ -2290,6 +2272,41 @@ export interface LogSearchRuleResource extends Resource {
action: Action;
}

/**
* @class
* Initializes a new instance of the LogSearchRuleResourcePatch class.
* @constructor
* The log search rule resource for patch operations.
*
* @member {object} [tags] Resource tags
* @member {string} [enabled] The flag which indicates whether the Log Search
* rule is enabled. Value should be true or false. Possible values include:
* 'true', 'false'
*/
export interface LogSearchRuleResourcePatch {
tags?: { [propertyName: string]: string };
enabled?: string;
}

/**
* @class
* Initializes a new instance of the LogMetricTrigger class.
* @constructor
* @member {string} [thresholdOperator] Evaluation operation for Metric
* -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include:
* 'GreaterThan', 'LessThan', 'Equal'
* @member {number} [threshold]
* @member {string} [metricTriggerType] Metric Trigger Type - 'Consecutive' or
* 'Total'. Possible values include: 'Consecutive', 'Total'
* @member {string} [metricColumn] Evaluation of metric on a particular column
*/
export interface LogMetricTrigger {
thresholdOperator?: string;
threshold?: number;
metricTriggerType?: string;
metricColumn?: string;
}

/**
* @class
* Initializes a new instance of the TriggerCondition class.
Expand All @@ -2302,34 +2319,10 @@ export interface LogSearchRuleResource extends Resource {
* @member {number} threshold Result or count threshold based on which rule
* should be triggered.
* @member {object} [metricTrigger] Trigger condition for metric query rule
* @member {string} [metricTrigger.metricName] the name of the metric that
* defines what the rule monitors.
* @member {string} [metricTrigger.metricResourceUri] the resource identifier
* of the resource the rule monitors.
* @member {moment.duration} [metricTrigger.timeGrain] the granularity of
* metrics the rule monitors. Must be one of the predefined values returned
* from metric definitions for the metric. Must be between 12 hours and 1
* minute.
* @member {string} [metricTrigger.statistic] the metric statistic type. How
* the metrics from multiple instances are combined. Possible values include:
* 'Average', 'Min', 'Max', 'Sum'
* @member {moment.duration} [metricTrigger.timeWindow] the range of time in
* which instance data is collected. This value must be greater than the delay
* in metric collection, which can vary from resource-to-resource. Must be
* between 12 hours and 5 minutes.
* @member {string} [metricTrigger.timeAggregation] 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'
* @member {string} [metricTrigger.operator] the operator that is used to
* compare the metric data and the threshold. Possible values include:
* 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan',
* 'LessThanOrEqual'
* @member {number} [metricTrigger.threshold] the threshold of the metric that
* triggers the scale action.
* @member {string} [metricTrigger.thresholdOperator] Evaluation operation for
* Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include:
* 'GreaterThan', 'LessThan', 'Equal'
* @member {number} [metricTrigger.threshold]
* @member {string} [metricTrigger.metricTriggerType] Metric Trigger Type -
* 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total'
* @member {string} [metricTrigger.metricColumn] Evaluation of metric on a
Expand All @@ -2338,19 +2331,20 @@ export interface LogSearchRuleResource extends Resource {
export interface TriggerCondition {
thresholdOperator: string;
threshold: number;
metricTrigger?: MetricTrigger;
metricTrigger?: LogMetricTrigger;
}

/**
* @class
* Initializes a new instance of the AzNsActionGroup class.
* @constructor
* azns notification group
* Azure action group
*
* @member {array} [actionGroup] Azure Group reference.
* @member {string} [emailSubject] Custom subject for Azns email
* @member {string} [customWebhookPayload] Custom webhook payload to be send to
* azns action group
* @member {array} [actionGroup] Azure Action Group reference.
* @member {string} [emailSubject] Custom subject override for all email ids in
* Azure action group
* @member {string} [customWebhookPayload] Custom payload to be sent for all
* webook URI in Azure action group
*/
export interface AzNsActionGroup {
actionGroup?: string[];
Expand All @@ -2366,13 +2360,14 @@ export interface AzNsActionGroup {
*
* @member {string} severity Severity of the alert. Possible values include:
* '0', '1', '2', '3', '4'
* @member {object} aznsAction azns notification group reference.
* @member {array} [aznsAction.actionGroup] Azure Group reference.
* @member {string} [aznsAction.emailSubject] Custom subject for Azns email
* @member {string} [aznsAction.customWebhookPayload] Custom webhook payload to
* be send to azns action group
* @member {object} aznsAction Azure action group reference.
* @member {array} [aznsAction.actionGroup] Azure Action Group reference.
* @member {string} [aznsAction.emailSubject] Custom subject override for all
* email ids in Azure action group
* @member {string} [aznsAction.customWebhookPayload] Custom payload to be sent
* for all webook URI in Azure action group
* @member {number} [throttlingInMin] time (in minutes) for which Alerts should
* be throttled
* be throttled or suppressed.
* @member {object} trigger The trigger condition that results in the alert
* rule being.
* @member {string} [trigger.thresholdOperator] Evaluation operation for rule -
Expand All @@ -2382,34 +2377,10 @@ export interface AzNsActionGroup {
* which rule should be triggered.
* @member {object} [trigger.metricTrigger] Trigger condition for metric query
* rule
* @member {string} [trigger.metricTrigger.metricName] the name of the metric
* that defines what the rule monitors.
* @member {string} [trigger.metricTrigger.metricResourceUri] the resource
* identifier of the resource the rule monitors.
* @member {moment.duration} [trigger.metricTrigger.timeGrain] the granularity
* of metrics the rule monitors. Must be one of the predefined values returned
* from metric definitions for the metric. Must be between 12 hours and 1
* minute.
* @member {string} [trigger.metricTrigger.statistic] the metric statistic
* type. How the metrics from multiple instances are combined. Possible values
* include: 'Average', 'Min', 'Max', 'Sum'
* @member {moment.duration} [trigger.metricTrigger.timeWindow] the range of
* time in which instance data is collected. This value must be greater than
* the delay in metric collection, which can vary from resource-to-resource.
* Must be between 12 hours and 5 minutes.
* @member {string} [trigger.metricTrigger.timeAggregation] 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'
* @member {string} [trigger.metricTrigger.operator] the operator that is used
* to compare the metric data and the threshold. Possible values include:
* 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan',
* 'LessThanOrEqual'
* @member {number} [trigger.metricTrigger.threshold] the threshold of the
* metric that triggers the scale action.
* @member {string} [trigger.metricTrigger.thresholdOperator] Evaluation
* operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible
* values include: 'GreaterThan', 'LessThan', 'Equal'
* @member {number} [trigger.metricTrigger.threshold]
* @member {string} [trigger.metricTrigger.metricTriggerType] Metric Trigger
* Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive',
* 'Total'
Expand Down
2 changes: 2 additions & 0 deletions lib/services/monitorManagement/lib/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ exports.MetricAlertSingleResourceMultipleMetricCriteria = require('./metricAlert
exports.Source = require('./source');
exports.Schedule = require('./schedule');
exports.LogSearchRuleResource = require('./logSearchRuleResource');
exports.LogSearchRuleResourcePatch = require('./logSearchRuleResourcePatch');
exports.LogMetricTrigger = require('./logMetricTrigger');
exports.TriggerCondition = require('./triggerCondition');
exports.AzNsActionGroup = require('./azNsActionGroup');
exports.AlertingAction = require('./alertingAction');
Expand Down
Loading