diff --git a/lib/services/monitorManagement/lib/models/criteria.js b/lib/services/monitorManagement/lib/models/criteria.js new file mode 100644 index 0000000000..00c198d834 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/criteria.js @@ -0,0 +1,68 @@ +/* + * 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'; + +/** + * Specifies the criteria for converting log to metric. + * + */ +class Criteria { + /** + * Create a Criteria. + * @member {string} metricName Name of the metric + * @member {array} [dimensions] List of Dimensions for creating metric + */ + constructor() { + } + + /** + * Defines the metadata of Criteria + * + * @returns {object} metadata of Criteria + * + */ + mapper() { + return { + required: false, + serializedName: 'Criteria', + type: { + name: 'Composite', + className: 'Criteria', + modelProperties: { + metricName: { + required: true, + serializedName: 'metricName', + type: { + name: 'String' + } + }, + dimensions: { + required: false, + serializedName: 'dimensions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DimensionElementType', + type: { + name: 'Composite', + className: 'Dimension' + } + } + } + } + } + } + }; + } +} + +module.exports = Criteria; diff --git a/lib/services/monitorManagement/lib/models/dimension.js b/lib/services/monitorManagement/lib/models/dimension.js new file mode 100644 index 0000000000..f5d573c594 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/dimension.js @@ -0,0 +1,76 @@ +/* + * 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'; + +/** + * Specifies the criteria for converting log to metric. + * + */ +class Dimension { + /** + * Create a Dimension. + * @member {string} name Name of the dimension + * @member {array} values List of dimension values + */ + constructor() { + } + + /** + * Defines the metadata of Dimension + * + * @returns {object} metadata of Dimension + * + */ + mapper() { + return { + required: false, + serializedName: 'Dimension', + type: { + name: 'Composite', + className: 'Dimension', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + operator: { + required: true, + isConstant: true, + serializedName: 'operator', + defaultValue: 'Include', + type: { + name: 'String' + } + }, + values: { + required: true, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Dimension; diff --git a/lib/services/monitorManagement/lib/models/index.d.ts b/lib/services/monitorManagement/lib/models/index.d.ts index b77dd1d7aa..3e97ff6c00 100644 --- a/lib/services/monitorManagement/lib/models/index.d.ts +++ b/lib/services/monitorManagement/lib/models/index.d.ts @@ -2210,7 +2210,8 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA * @constructor * Specifies the log search query. * - * @member {string} query Log search query. + * @member {string} [query] Log search query. Required for action type - + * AlertingAction * @member {array} [authorizedResources] List of Resource referred into query * @member {string} dataSourceId The resource uri over which log search query * is to be run. @@ -2218,7 +2219,7 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA * include: 'ResultCount' */ export interface Source { - query: string; + query?: string; authorizedResources?: string[]; dataSourceId: string; queryType?: string; @@ -2268,14 +2269,16 @@ export interface Action { * scheduledquery rule. Possible values include: 'Succeeded', 'Deploying', * 'Canceled', 'Failed' * @member {object} source Data Source against which rule will Query Data - * @member {string} [source.query] Log search query. + * @member {string} [source.query] Log search query. Required for action type - + * AlertingAction * @member {array} [source.authorizedResources] List of Resource referred 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'. Possible * values include: 'ResultCount' - * @member {object} schedule Schedule (Frequnecy, Time Window) for rule. + * @member {object} [schedule] Schedule (Frequnecy, Time Window) for rule. + * Required for action type - AlertingAction * @member {number} [schedule.frequencyInMinutes] frequency (in minutes) at * which rule condition should be evaluated. * @member {number} [schedule.timeWindowInMinutes] Time window for which data @@ -2290,7 +2293,7 @@ export interface LogSearchRuleResource extends Resource { readonly lastUpdatedTime?: Date; readonly provisioningState?: string; source: Source; - schedule: Schedule; + schedule?: Schedule; action: Action; } @@ -2420,6 +2423,48 @@ export interface AlertingAction extends Action { trigger: TriggerCondition; } +/** + * @class + * Initializes a new instance of the Dimension class. + * @constructor + * Specifies the criteria for converting log to metric. + * + * @member {string} name Name of the dimension + * @member {array} values List of dimension values + */ +export interface Dimension { + name: string; + values: string[]; +} + +/** + * @class + * Initializes a new instance of the Criteria class. + * @constructor + * Specifies the criteria for converting log to metric. + * + * @member {string} metricName Name of the metric + * @member {array} [dimensions] List of Dimensions for creating metric + */ +export interface Criteria { + metricName: string; + dimensions?: Dimension[]; +} + +/** + * @class + * Initializes a new instance of the LogToMetricAction class. + * @constructor + * Specifiy action need to be taken when rule type is converting log to metric + * + * @member {object} criteria Severity of the alert + * @member {string} [criteria.metricName] Name of the metric + * @member {array} [criteria.dimensions] List of Dimensions for creating metric + */ +export interface LogToMetricAction extends Action { + criteria: Criteria; +} + /** * @class * Initializes a new instance of the MetricNamespaceName class. diff --git a/lib/services/monitorManagement/lib/models/index.js b/lib/services/monitorManagement/lib/models/index.js index 542841f1c7..70b9445a7f 100644 --- a/lib/services/monitorManagement/lib/models/index.js +++ b/lib/services/monitorManagement/lib/models/index.js @@ -114,6 +114,9 @@ exports.LogMetricTrigger = require('./logMetricTrigger'); exports.TriggerCondition = require('./triggerCondition'); exports.AzNsActionGroup = require('./azNsActionGroup'); exports.AlertingAction = require('./alertingAction'); +exports.Dimension = require('./dimension'); +exports.Criteria = require('./criteria'); +exports.LogToMetricAction = require('./logToMetricAction'); exports.MetricNamespaceName = require('./metricNamespaceName'); exports.MetricNamespace = require('./metricNamespace'); exports.AutoscaleSettingResourceCollection = require('./autoscaleSettingResourceCollection'); @@ -142,5 +145,6 @@ exports.discriminators = { 'MetricAlertCriteria' : exports.MetricAlertCriteria, 'MetricAlertCriteria.Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria' : exports.MetricAlertSingleResourceMultipleMetricCriteria, 'Action' : exports.Action, - 'Action.Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction' : exports.AlertingAction + 'Action.Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction' : exports.AlertingAction, + 'Action.Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction' : exports.LogToMetricAction }; diff --git a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js index 138f18b726..10804b4040 100644 --- a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js +++ b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js @@ -30,14 +30,16 @@ class LogSearchRuleResource extends models['Resource'] { * scheduledquery rule. Possible values include: 'Succeeded', 'Deploying', * 'Canceled', 'Failed' * @member {object} source Data Source against which rule will Query Data - * @member {string} [source.query] Log search query. + * @member {string} [source.query] Log search query. Required for action type + * - AlertingAction * @member {array} [source.authorizedResources] List of Resource referred * 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'. Possible * values include: 'ResultCount' - * @member {object} schedule Schedule (Frequnecy, Time Window) for rule. + * @member {object} [schedule] Schedule (Frequnecy, Time Window) for rule. + * Required for action type - AlertingAction * @member {number} [schedule.frequencyInMinutes] frequency (in minutes) at * which rule condition should be evaluated. * @member {number} [schedule.timeWindowInMinutes] Time window for which data @@ -148,7 +150,7 @@ class LogSearchRuleResource extends models['Resource'] { } }, schedule: { - required: true, + required: false, serializedName: 'properties.schedule', type: { name: 'Composite', diff --git a/lib/services/monitorManagement/lib/models/logToMetricAction.js b/lib/services/monitorManagement/lib/models/logToMetricAction.js new file mode 100644 index 0000000000..78a9d15d4d --- /dev/null +++ b/lib/services/monitorManagement/lib/models/logToMetricAction.js @@ -0,0 +1,73 @@ +/* + * 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'; + +const models = require('./index'); + +/** + * Specifiy action need to be taken when rule type is converting log to metric + * + * @extends models['Action'] + */ +class LogToMetricAction extends models['Action'] { + /** + * Create a LogToMetricAction. + * @member {object} criteria Severity of the alert + * @member {string} [criteria.metricName] Name of the metric + * @member {array} [criteria.dimensions] List of Dimensions for creating + * metric + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LogToMetricAction + * + * @returns {object} metadata of LogToMetricAction + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'Action', + className: 'LogToMetricAction', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + criteria: { + required: true, + serializedName: 'criteria', + type: { + name: 'Composite', + className: 'Criteria' + } + } + } + } + }; + } +} + +module.exports = LogToMetricAction; diff --git a/lib/services/monitorManagement/lib/models/source.js b/lib/services/monitorManagement/lib/models/source.js index d576129d8a..016c655ca5 100644 --- a/lib/services/monitorManagement/lib/models/source.js +++ b/lib/services/monitorManagement/lib/models/source.js @@ -17,7 +17,8 @@ class Source { /** * Create a Source. - * @member {string} query Log search query. + * @member {string} [query] Log search query. Required for action type - + * AlertingAction * @member {array} [authorizedResources] List of Resource referred into * query * @member {string} dataSourceId The resource uri over which log search query @@ -43,7 +44,7 @@ class Source { className: 'Source', modelProperties: { query: { - required: true, + required: false, serializedName: 'query', type: { name: 'String' diff --git a/lib/services/monitorManagement/lib/operations/index.d.ts b/lib/services/monitorManagement/lib/operations/index.d.ts index 9e1034411e..b3a34249ba 100644 --- a/lib/services/monitorManagement/lib/operations/index.d.ts +++ b/lib/services/monitorManagement/lib/operations/index.d.ts @@ -4493,7 +4493,8 @@ export interface ScheduledQueryRules { * @param {object} parameters.source Data Source against which rule will Query * Data * - * @param {string} parameters.source.query Log search query. + * @param {string} [parameters.source.query] Log search query. Required for + * action type - AlertingAction * * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query @@ -4504,8 +4505,8 @@ export interface ScheduledQueryRules { * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. * Possible values include: 'ResultCount' * - * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for - * rule. + * @param {object} [parameters.schedule] Schedule (Frequnecy, Time Window) for + * rule. Required for action type - AlertingAction * * @param {number} parameters.schedule.frequencyInMinutes frequency (in * minutes) at which rule condition should be evaluated. @@ -4555,7 +4556,8 @@ export interface ScheduledQueryRules { * @param {object} parameters.source Data Source against which rule will Query * Data * - * @param {string} parameters.source.query Log search query. + * @param {string} [parameters.source.query] Log search query. Required for + * action type - AlertingAction * * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query @@ -4566,8 +4568,8 @@ export interface ScheduledQueryRules { * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. * Possible values include: 'ResultCount' * - * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for - * rule. + * @param {object} [parameters.schedule] Schedule (Frequnecy, Time Window) for + * rule. Required for action type - AlertingAction * * @param {number} parameters.schedule.frequencyInMinutes frequency (in * minutes) at which rule condition should be evaluated. diff --git a/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js index 40352ff697..316fa33aa8 100644 --- a/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js +++ b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js @@ -33,7 +33,8 @@ const WebResource = msRest.WebResource; * @param {object} parameters.source Data Source against which rule will Query * Data * - * @param {string} parameters.source.query Log search query. + * @param {string} [parameters.source.query] Log search query. Required for + * action type - AlertingAction * * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query @@ -44,8 +45,8 @@ const WebResource = msRest.WebResource; * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. * Possible values include: 'ResultCount' * - * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for - * rule. + * @param {object} [parameters.schedule] Schedule (Frequnecy, Time Window) for + * rule. Required for action type - AlertingAction * * @param {number} parameters.schedule.frequencyInMinutes frequency (in * minutes) at which rule condition should be evaluated. @@ -1002,7 +1003,8 @@ class ScheduledQueryRules { * @param {object} parameters.source Data Source against which rule will Query * Data * - * @param {string} parameters.source.query Log search query. + * @param {string} [parameters.source.query] Log search query. Required for + * action type - AlertingAction * * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query @@ -1013,8 +1015,8 @@ class ScheduledQueryRules { * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. * Possible values include: 'ResultCount' * - * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for - * rule. + * @param {object} [parameters.schedule] Schedule (Frequnecy, Time Window) for + * rule. Required for action type - AlertingAction * * @param {number} parameters.schedule.frequencyInMinutes frequency (in * minutes) at which rule condition should be evaluated. @@ -1076,7 +1078,8 @@ class ScheduledQueryRules { * @param {object} parameters.source Data Source against which rule will Query * Data * - * @param {string} parameters.source.query Log search query. + * @param {string} [parameters.source.query] Log search query. Required for + * action type - AlertingAction * * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query @@ -1087,8 +1090,8 @@ class ScheduledQueryRules { * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. * Possible values include: 'ResultCount' * - * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for - * rule. + * @param {object} [parameters.schedule] Schedule (Frequnecy, Time Window) for + * rule. Required for action type - AlertingAction * * @param {number} parameters.schedule.frequencyInMinutes frequency (in * minutes) at which rule condition should be evaluated. diff --git a/lib/services/monitorManagement/package.json b/lib/services/monitorManagement/package.json index bcbf89ca5d..260524230d 100644 --- a/lib/services/monitorManagement/package.json +++ b/lib/services/monitorManagement/package.json @@ -2,7 +2,7 @@ "name": "azure-arm-monitor", "author": "Microsoft Corporation", "description": "MonitorManagementClient Library with typescript type definitions for node", - "version": "4.1.1", + "version": "4.2.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5"