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

Commit

Permalink
[AutoPR monitor/resource-manager] Adding patch support for SQR API (#…
Browse files Browse the repository at this point in the history
…2886)

* Generated from f53526896e5c001f79bd46ca892f825172b53abf

Merge branch 'master' into patchsupport

* Generated from 0fa2c60b9a9e552cdcb523005b2136ae474a4d89

Updated description for queryType

Updated description for queryType

* Generated from b37d3ace14508e3bc3f87ee29b7f2ad0b7025f67

Resolving multiple model issue

Changes - 
1. Renamed "MetricTrigger" to "LogMetricTrigger"
2. Aligned "Resources" to other specs

* Generated from b37d3ace14508e3bc3f87ee29b7f2ad0b7025f67

Resolving multiple model issue

Changes - 
1. Renamed "MetricTrigger" to "LogMetricTrigger"
2. Aligned "Resources" to other specs
  • Loading branch information
AutorestCI authored Jun 5, 2018
1 parent ba36e4b commit 3ccff0d
Show file tree
Hide file tree
Showing 12 changed files with 556 additions and 180 deletions.
26 changes: 1 addition & 25 deletions lib/services/monitorManagement/lib/models/alertingAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,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
115 changes: 42 additions & 73 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,9 +2200,8 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA
* @member {array} [authorizedResources] List of Resource referred into 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;
Expand Down Expand Up @@ -2274,9 +2257,8 @@ export interface Action {
* query
* @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 @@ -2296,6 +2278,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 @@ -2308,34 +2325,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 @@ -2344,7 +2337,7 @@ export interface LogSearchRuleResource extends Resource {
export interface TriggerCondition {
thresholdOperator: string;
threshold: number;
metricTrigger?: MetricTrigger;
metricTrigger?: LogMetricTrigger;
}

/**
Expand Down Expand Up @@ -2390,34 +2383,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 @@ -109,6 +109,8 @@ exports.Source = require('./source');
exports.Schedule = require('./schedule');
exports.Action = require('./action');
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
79 changes: 79 additions & 0 deletions lib/services/monitorManagement/lib/models/logMetricTrigger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* 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.
*/

'use strict';

/**
* Class representing a LogMetricTrigger.
*/
class LogMetricTrigger {
/**
* Create a LogMetricTrigger.
* @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
*/
constructor() {
}

/**
* Defines the metadata of LogMetricTrigger
*
* @returns {object} metadata of LogMetricTrigger
*
*/
mapper() {
return {
required: false,
serializedName: 'LogMetricTrigger',
type: {
name: 'Composite',
className: 'LogMetricTrigger',
modelProperties: {
thresholdOperator: {
required: false,
serializedName: 'thresholdOperator',
type: {
name: 'String'
}
},
threshold: {
required: false,
serializedName: 'threshold',
type: {
name: 'Number'
}
},
metricTriggerType: {
required: false,
serializedName: 'metricTriggerType',
type: {
name: 'String'
}
},
metricColumn: {
required: false,
serializedName: 'metricColumn',
type: {
name: 'String'
}
}
}
}
};
}
}

module.exports = LogMetricTrigger;
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ class LogSearchRuleResource extends models['Resource'] {
* into query
* @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 Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* 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.
*/

'use strict';

/**
* The log search rule resource for patch operations.
*
*/
class LogSearchRuleResourcePatch {
/**
* Create a LogSearchRuleResourcePatch.
* @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'
*/
constructor() {
}

/**
* Defines the metadata of LogSearchRuleResourcePatch
*
* @returns {object} metadata of LogSearchRuleResourcePatch
*
*/
mapper() {
return {
required: false,
serializedName: 'LogSearchRuleResourcePatch',
type: {
name: 'Composite',
className: 'LogSearchRuleResourcePatch',
modelProperties: {
tags: {
required: false,
serializedName: 'tags',
type: {
name: 'Dictionary',
value: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
},
enabled: {
required: false,
serializedName: 'properties.enabled',
type: {
name: 'String'
}
}
}
}
};
}
}

module.exports = LogSearchRuleResourcePatch;
Loading

0 comments on commit 3ccff0d

Please sign in to comment.