diff --git a/lib/services/monitorManagement/LICENSE.txt b/lib/services/monitorManagement/LICENSE.txt index a70e8cf660..5431ba98b9 100644 --- a/lib/services/monitorManagement/LICENSE.txt +++ b/lib/services/monitorManagement/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/monitorManagement/README.md b/lib/services/monitorManagement/README.md index 33267a13b5..fbfc3c01f5 100644 --- a/lib/services/monitorManagement/README.md +++ b/lib/services/monitorManagement/README.md @@ -1,36 +1,41 @@ -# Microsoft Azure SDK for Node.js - MonitorManagementClient -This project provides a Node.js package for accessing Azure. Right now it supports: -- **Node.js version 6.x.x or higher** - -## Features - - -## How to Install - -```bash -npm install azure-arm-monitor -``` - -## How to use - -### Authentication, client creation and listByResourceGroup autoscaleSettings as an example. - -```javascript -const msRestAzure = require("ms-rest-azure"); -const MonitorManagementClient = require("azure-arm-monitor"); -msRestAzure.interactiveLogin().then((creds) => { - const subscriptionId = ""; - const client = new MonitorManagementClient(creds, subscriptionId); - const resourceGroupName = "testresourceGroupName"; - return client.autoscaleSettings.listByResourceGroup(resourceGroupName).then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.log('An error ocurred:'); - console.dir(err, {depth: null, colors: true}); -}); - -## Related projects - -- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) +--- +uid: azure-arm-monitor +summary: *content + +--- +# Microsoft Azure SDK for Node.js - MonitorManagementClient +This project provides a Node.js package for accessing Azure. Right now it supports: +- **Node.js version 6.x.x or higher** + +## Features + + +## How to Install + +```bash +npm install azure-arm-monitor +``` + +## How to use + +### Authentication, client creation and listByResourceGroup autoscaleSettings as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const MonitorManagementClient = require("azure-arm-monitor"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new MonitorManagementClient(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + return client.autoscaleSettings.listByResourceGroup(resourceGroupName).then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error occurred:'); + console.dir(err, {depth: null, colors: true}); +}); + +## Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/monitorManagement/lib/models/action.js b/lib/services/monitorManagement/lib/models/action.js index 91eaf1b94d..60cf981165 100644 --- a/lib/services/monitorManagement/lib/models/action.js +++ b/lib/services/monitorManagement/lib/models/action.js @@ -11,14 +11,13 @@ 'use strict'; /** - * An alert action. + * Action descriptor. * */ class Action { /** * Create a Action. - * @member {string} [actionGroupId] the id of the action group to use. - * @member {object} [webhookProperties] + * @member {string} odatatype Polymorphic Discriminator */ constructor() { } @@ -35,28 +34,20 @@ class Action { serializedName: 'Action', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'Action', className: 'Action', modelProperties: { - actionGroupId: { - required: false, - serializedName: 'actionGroupId', + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, type: { name: 'String' } - }, - webhookProperties: { - required: false, - serializedName: 'webhookProperties', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } } } } diff --git a/lib/services/monitorManagement/lib/models/actionGroupResource.js b/lib/services/monitorManagement/lib/models/actionGroupResource.js index 125c43c8e7..f69df88ef8 100644 --- a/lib/services/monitorManagement/lib/models/actionGroupResource.js +++ b/lib/services/monitorManagement/lib/models/actionGroupResource.js @@ -37,6 +37,12 @@ class ActionGroupResource extends models['Resource'] { * that are part of this action group. * @member {array} [automationRunbookReceivers] The list of AutomationRunbook * receivers that are part of this action group. + * @member {array} [voiceReceivers] The list of voice receivers that are part + * of this action group. + * @member {array} [logicAppReceivers] The list of logic app receivers that + * are part of this action group. + * @member {array} [azureFunctionReceivers] The list of azure function + * receivers that are part of this action group. */ constructor() { super(); @@ -105,7 +111,7 @@ class ActionGroupResource extends models['Resource'] { required: true, serializedName: 'properties.groupShortName', constraints: { - MaxLength: 15 + MaxLength: 12 }, type: { name: 'String' @@ -208,6 +214,51 @@ class ActionGroupResource extends models['Resource'] { } } } + }, + voiceReceivers: { + required: false, + serializedName: 'properties.voiceReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VoiceReceiverElementType', + type: { + name: 'Composite', + className: 'VoiceReceiver' + } + } + } + }, + logicAppReceivers: { + required: false, + serializedName: 'properties.logicAppReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LogicAppReceiverElementType', + type: { + name: 'Composite', + className: 'LogicAppReceiver' + } + } + } + }, + azureFunctionReceivers: { + required: false, + serializedName: 'properties.azureFunctionReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AzureFunctionReceiverElementType', + type: { + name: 'Composite', + className: 'AzureFunctionReceiver' + } + } + } } } } diff --git a/lib/services/monitorManagement/lib/models/alertingAction.js b/lib/services/monitorManagement/lib/models/alertingAction.js new file mode 100644 index 0000000000..03ee8274af --- /dev/null +++ b/lib/services/monitorManagement/lib/models/alertingAction.js @@ -0,0 +1,120 @@ +/* + * 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 Alert + * + * @extends models['Action'] + */ +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 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 or suppressed. + * @member {object} trigger The trigger condition that results in the alert + * rule being. + * @member {string} [trigger.thresholdOperator] Evaluation operation for rule + * - 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', + * 'LessThan', 'Equal' + * @member {number} [trigger.threshold] Result or count threshold based on + * which rule should be triggered. + * @member {object} [trigger.metricTrigger] Trigger condition for metric + * query rule + * @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] The threshold of the + * metric trigger. + * @member {string} [trigger.metricTrigger.metricTriggerType] Metric Trigger + * Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive', + * 'Total' + * @member {string} [trigger.metricTrigger.metricColumn] Evaluation of metric + * on a particular column + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AlertingAction + * + * @returns {object} metadata of AlertingAction + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'Action', + className: 'AlertingAction', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + severity: { + required: true, + serializedName: 'severity', + type: { + name: 'String' + } + }, + aznsAction: { + required: true, + serializedName: 'aznsAction', + type: { + name: 'Composite', + className: 'AzNsActionGroup' + } + }, + throttlingInMin: { + required: false, + serializedName: 'throttlingInMin', + type: { + name: 'Number' + } + }, + trigger: { + required: true, + serializedName: 'trigger', + type: { + name: 'Composite', + className: 'TriggerCondition' + } + } + } + } + }; + } +} + +module.exports = AlertingAction; diff --git a/lib/services/monitorManagement/lib/models/autoscaleProfile.js b/lib/services/monitorManagement/lib/models/autoscaleProfile.js index a26c7a898f..1246fb6922 100644 --- a/lib/services/monitorManagement/lib/models/autoscaleProfile.js +++ b/lib/services/monitorManagement/lib/models/autoscaleProfile.js @@ -79,11 +79,6 @@ class AutoscaleProfile { * format. * @member {object} [recurrence] the repeating times at which this profile * begins. This element is not used if the FixedDate element is used. - * @member {string} [recurrence.frequency] 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' * @member {object} [recurrence.schedule] the scheduling constraints for when * the profile begins. * @member {string} [recurrence.schedule.timeZone] the timezone for the hours diff --git a/lib/services/monitorManagement/lib/models/azNsActionGroup.js b/lib/services/monitorManagement/lib/models/azNsActionGroup.js new file mode 100644 index 0000000000..c3d0dea8ee --- /dev/null +++ b/lib/services/monitorManagement/lib/models/azNsActionGroup.js @@ -0,0 +1,77 @@ +/* + * 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'; + +/** + * Azure action group + * + */ +class AzNsActionGroup { + /** + * Create a AzNsActionGroup. + * @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() { + } + + /** + * Defines the metadata of AzNsActionGroup + * + * @returns {object} metadata of AzNsActionGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'AzNsActionGroup', + type: { + name: 'Composite', + className: 'AzNsActionGroup', + modelProperties: { + actionGroup: { + required: false, + serializedName: 'actionGroup', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + emailSubject: { + required: false, + serializedName: 'emailSubject', + type: { + name: 'String' + } + }, + customWebhookPayload: { + required: false, + serializedName: 'customWebhookPayload', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AzNsActionGroup; diff --git a/lib/services/monitorManagement/lib/models/azureFunctionReceiver.js b/lib/services/monitorManagement/lib/models/azureFunctionReceiver.js new file mode 100644 index 0000000000..1252eef8a7 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/azureFunctionReceiver.js @@ -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'; + +/** + * An azure function receiver. + * + */ +class AzureFunctionReceiver { + /** + * Create a AzureFunctionReceiver. + * @member {string} name The name of the azure function receiver. Names must + * be unique across all receivers within an action group. + * @member {string} functionAppResourceId The azure resource id of the + * function app. + * @member {string} functionName The function name in the function app. + * @member {string} httpTriggerUrl The http trigger url where http request + * sent to. + */ + constructor() { + } + + /** + * Defines the metadata of AzureFunctionReceiver + * + * @returns {object} metadata of AzureFunctionReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureFunctionReceiver', + type: { + name: 'Composite', + className: 'AzureFunctionReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + functionAppResourceId: { + required: true, + serializedName: 'functionAppResourceId', + type: { + name: 'String' + } + }, + functionName: { + required: true, + serializedName: 'functionName', + type: { + name: 'String' + } + }, + httpTriggerUrl: { + required: true, + serializedName: 'httpTriggerUrl', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AzureFunctionReceiver; diff --git a/lib/services/monitorManagement/lib/models/diagnosticSettingsCategoryResource.js b/lib/services/monitorManagement/lib/models/diagnosticSettingsCategoryResource.js index 00e2c23663..6d79f2a7f3 100644 --- a/lib/services/monitorManagement/lib/models/diagnosticSettingsCategoryResource.js +++ b/lib/services/monitorManagement/lib/models/diagnosticSettingsCategoryResource.js @@ -67,6 +67,7 @@ class DiagnosticSettingsCategoryResource extends models['ProxyOnlyResource'] { }, categoryType: { required: false, + nullable: false, serializedName: 'properties.categoryType', type: { name: 'Enum', diff --git a/lib/services/monitorManagement/lib/models/diagnosticSettingsResource.js b/lib/services/monitorManagement/lib/models/diagnosticSettingsResource.js index b255747c24..e4b3da0650 100644 --- a/lib/services/monitorManagement/lib/models/diagnosticSettingsResource.js +++ b/lib/services/monitorManagement/lib/models/diagnosticSettingsResource.js @@ -22,6 +22,8 @@ class DiagnosticSettingsResource extends models['ProxyOnlyResource'] { * Create a DiagnosticSettingsResource. * @member {string} [storageAccountId] The resource ID of the storage account * to which you would like to send Diagnostic Logs. + * @member {string} [serviceBusRuleId] The service bus rule Id of the + * diagnostic setting. This is here to maintain backwards compatibility. * @member {string} [eventHubAuthorizationRuleId] The resource Id for the * event hub authorization rule. * @member {string} [eventHubName] The name of the event hub. If none is @@ -82,6 +84,13 @@ class DiagnosticSettingsResource extends models['ProxyOnlyResource'] { name: 'String' } }, + serviceBusRuleId: { + required: false, + serializedName: 'properties.serviceBusRuleId', + type: { + name: 'String' + } + }, eventHubAuthorizationRuleId: { required: false, serializedName: 'properties.eventHubAuthorizationRuleId', diff --git a/lib/services/monitorManagement/lib/models/eventData.js b/lib/services/monitorManagement/lib/models/eventData.js index 4e8b1c3046..7a0c296d1c 100644 --- a/lib/services/monitorManagement/lib/models/eventData.js +++ b/lib/services/monitorManagement/lib/models/eventData.js @@ -19,7 +19,7 @@ const models = require('./index'); class EventData { /** * Create a EventData. - * @member {object} [authorization] + * @member {object} [authorization] The sender authorization information. * @member {string} [authorization.action] the permissible actions. For * instance: microsoft.support/supporttickets/write * @member {string} [authorization.role] the role of the user. For instance: diff --git a/lib/services/monitorManagement/lib/models/index.d.ts b/lib/services/monitorManagement/lib/models/index.d.ts index 8a6ad1d65e..d75f226e03 100644 --- a/lib/services/monitorManagement/lib/models/index.d.ts +++ b/lib/services/monitorManagement/lib/models/index.d.ts @@ -290,10 +290,6 @@ export interface RecurrentSchedule { * The repeating times at which this profile begins. This element is not used * if the FixedDate element is used. * - * @member {string} frequency 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' * @member {object} schedule the scheduling constraints for when the profile * begins. * @member {string} [schedule.timeZone] the timezone for the hours of the @@ -342,7 +338,6 @@ export interface RecurrentSchedule { * profile takes effect at. */ export interface Recurrence { - frequency: string; schedule: RecurrentSchedule; } @@ -411,10 +406,6 @@ export interface Recurrence { * format. * @member {object} [recurrence] the repeating times at which this profile * begins. This element is not used if the FixedDate element is used. - * @member {string} [recurrence.frequency] 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' * @member {object} [recurrence.schedule] the scheduling constraints for when * the profile begins. * @member {string} [recurrence.schedule.timeZone] the timezone for the hours @@ -1126,6 +1117,8 @@ export interface LogSettings { * * @member {string} [storageAccountId] The resource ID of the storage account * to which you would like to send Diagnostic Logs. + * @member {string} [serviceBusRuleId] The service bus rule Id of the + * diagnostic setting. This is here to maintain backwards compatibility. * @member {string} [eventHubAuthorizationRuleId] The resource Id for the event * hub authorization rule. * @member {string} [eventHubName] The name of the event hub. If none is @@ -1139,6 +1132,7 @@ export interface LogSettings { */ export interface DiagnosticSettingsResource extends ProxyOnlyResource { storageAccountId?: string; + serviceBusRuleId?: string; eventHubAuthorizationRuleId?: string; eventHubName?: string; metrics?: MetricSettings[]; @@ -1303,6 +1297,61 @@ export interface AutomationRunbookReceiver { serviceUri?: string; } +/** + * @class + * Initializes a new instance of the VoiceReceiver class. + * @constructor + * A voice receiver. + * + * @member {string} name The name of the voice receiver. Names must be unique + * across all receivers within an action group. + * @member {string} countryCode The country code of the voice receiver. + * @member {string} phoneNumber The phone number of the voice receiver. + */ +export interface VoiceReceiver { + name: string; + countryCode: string; + phoneNumber: string; +} + +/** + * @class + * Initializes a new instance of the LogicAppReceiver class. + * @constructor + * A logic app receiver. + * + * @member {string} name The name of the logic app receiver. Names must be + * unique across all receivers within an action group. + * @member {string} resourceId The azure resource id of the logic app receiver. + * @member {string} callbackUrl The callback url where http request sent to. + */ +export interface LogicAppReceiver { + name: string; + resourceId: string; + callbackUrl: string; +} + +/** + * @class + * Initializes a new instance of the AzureFunctionReceiver class. + * @constructor + * An azure function receiver. + * + * @member {string} name The name of the azure function receiver. Names must be + * unique across all receivers within an action group. + * @member {string} functionAppResourceId The azure resource id of the function + * app. + * @member {string} functionName The function name in the function app. + * @member {string} httpTriggerUrl The http trigger url where http request sent + * to. + */ +export interface AzureFunctionReceiver { + name: string; + functionAppResourceId: string; + functionName: string; + httpTriggerUrl: string; +} + /** * @class * Initializes a new instance of the ActionGroupResource class. @@ -1326,6 +1375,12 @@ export interface AutomationRunbookReceiver { * that are part of this action group. * @member {array} [automationRunbookReceivers] The list of AutomationRunbook * receivers that are part of this action group. + * @member {array} [voiceReceivers] The list of voice receivers that are part + * of this action group. + * @member {array} [logicAppReceivers] The list of logic app receivers that are + * part of this action group. + * @member {array} [azureFunctionReceivers] The list of azure function + * receivers that are part of this action group. */ export interface ActionGroupResource extends Resource { groupShortName: string; @@ -1336,6 +1391,9 @@ export interface ActionGroupResource extends Resource { itsmReceivers?: ItsmReceiver[]; azureAppPushReceivers?: AzureAppPushReceiver[]; automationRunbookReceivers?: AutomationRunbookReceiver[]; + voiceReceivers?: VoiceReceiver[]; + logicAppReceivers?: LogicAppReceiver[]; + azureFunctionReceivers?: AzureFunctionReceiver[]; } /** @@ -1530,7 +1588,7 @@ export interface HttpRequestInfo { * @constructor * The Azure event log entries are of type EventData * - * @member {object} [authorization] + * @member {object} [authorization] The sender authorization information. * @member {string} [authorization.action] the permissible actions. For * instance: microsoft.support/supporttickets/write * @member {string} [authorization.role] the role of the user. For instance: @@ -1914,14 +1972,14 @@ export interface CalculateBaselineResponse { /** * @class - * Initializes a new instance of the Action class. + * Initializes a new instance of the MetricAlertAction class. * @constructor * An alert action. * * @member {string} [actionGroupId] the id of the action group to use. - * @member {object} [webhookProperties] + * @member {object} [webhookProperties] The properties of a webhook object. */ -export interface Action { +export interface MetricAlertAction { actionGroupId?: string; webhookProperties?: { [propertyName: string]: string }; } @@ -1963,6 +2021,8 @@ export interface MetricAlertCriteria { * threshold. * @member {object} criteria defines the specific alert criteria information. * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @member {boolean} [autoMitigate] the flag that indicates whether the alert + * should be auto resolved or not. * @member {array} [actions] the array of actions that are performed when the * alert rule becomes active, and when an alert condition is resolved. * @member {date} [lastUpdatedTime] Last time the rule was updated in ISO8601 @@ -1976,7 +2036,8 @@ export interface MetricAlertResource extends Resource { evaluationFrequency: moment.Duration; windowSize: moment.Duration; criteria: MetricAlertCriteria; - actions?: Action[]; + autoMitigate?: boolean; + actions?: MetricAlertAction[]; readonly lastUpdatedTime?: Date; } @@ -2001,6 +2062,8 @@ export interface MetricAlertResource extends Resource { * threshold. * @member {object} criteria defines the specific alert criteria information. * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @member {boolean} [autoMitigate] the flag that indicates whether the alert + * should be auto resolved or not. * @member {array} [actions] the array of actions that are performed when the * alert rule becomes active, and when an alert condition is resolved. * @member {date} [lastUpdatedTime] Last time the rule was updated in ISO8601 @@ -2015,7 +2078,8 @@ export interface MetricAlertResourcePatch { evaluationFrequency: moment.Duration; windowSize: moment.Duration; criteria: MetricAlertCriteria; - actions?: Action[]; + autoMitigate?: boolean; + actions?: MetricAlertAction[]; readonly lastUpdatedTime?: Date; } @@ -2025,7 +2089,8 @@ export interface MetricAlertResourcePatch { * @constructor * An alert status properties. * - * @member {object} [dimensions] + * @member {object} [dimensions] An object describing the type of the + * dimensions. * @member {string} [status] status value * @member {date} [timestamp] UTC time when the status was checked. */ @@ -2046,7 +2111,8 @@ export interface MetricAlertStatusProperties { * @member {string} [type] The extended resource type name. * @member {object} [properties] The alert status properties of the metric * alert status. - * @member {object} [properties.dimensions] + * @member {object} [properties.dimensions] An object describing the type of + * the dimensions. * @member {string} [properties.status] status value * @member {date} [properties.timestamp] UTC time when the status was checked. */ @@ -2073,6 +2139,8 @@ export interface MetricAlertStatusCollection { * @class * Initializes a new instance of the MetricDimension class. * @constructor + * Specifies a metric dimension. + * * @member {string} name Name of the dimension. * @member {string} operator the dimension operator. * @member {array} values list of dimension values. @@ -2087,6 +2155,8 @@ export interface MetricDimension { * @class * Initializes a new instance of the MetricCriteria class. * @constructor + * Criterion to filter metrics. + * * @member {string} name Name of the criteria. * @member {string} metricName Name of the metric. * @member {string} [metricNamespace] Namespace of the metric. @@ -2120,6 +2190,222 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA allOf?: MetricCriteria[]; } +/** + * @class + * Initializes a new instance of the Source class. + * @constructor + * Specifies the log search query. + * + * @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 + * is to be run. + * @member {string} [queryType] Set value to 'ResultCount'. Possible values + * include: 'ResultCount' + */ +export interface Source { + query: string; + authorizedResources?: string[]; + dataSourceId: string; + queryType?: string; +} + +/** + * @class + * Initializes a new instance of the Schedule class. + * @constructor + * Defines how often to run the search and the time interval. + * + * @member {number} frequencyInMinutes frequency (in minutes) at which rule + * condition should be evaluated. + * @member {number} timeWindowInMinutes Time window for which data needs to be + * fetched for query (should be greater than or equal to frequencyInMinutes). + */ +export interface Schedule { + frequencyInMinutes: number; + timeWindowInMinutes: number; +} + +/** + * @class + * Initializes a new instance of the Action class. + * @constructor + * Action descriptor. + * + * @member {string} odatatype Polymorphic Discriminator + */ +export interface Action { + odatatype: string; +} + +/** + * @class + * Initializes a new instance of the LogSearchRuleResource class. + * @constructor + * The Log Search Rule resource. + * + * @member {string} [description] The description of the Log Search rule. + * @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' + * @member {date} [lastUpdatedTime] Last time the rule was updated in IS08601 + * format. + * @member {string} [provisioningState] Provisioning state of the + * 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 {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 {number} [schedule.frequencyInMinutes] frequency (in minutes) at + * which rule condition should be evaluated. + * @member {number} [schedule.timeWindowInMinutes] Time window for which data + * needs to be fetched for query (should be greater than or equal to + * frequencyInMinutes). + * @member {object} action Action needs to be taken on rule execution. + * @member {string} [action.odatatype] Polymorphic Discriminator + */ +export interface LogSearchRuleResource extends Resource { + description?: string; + enabled?: string; + readonly lastUpdatedTime?: Date; + readonly provisioningState?: string; + source: Source; + schedule: Schedule; + 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 + * A log metrics trigger descriptor. + * + * @member {string} [thresholdOperator] Evaluation operation for Metric + * -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: + * 'GreaterThan', 'LessThan', 'Equal' + * @member {number} [threshold] The threshold of the metric trigger. + * @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. + * @constructor + * The condition that results in the Log Search rule. + * + * @member {string} thresholdOperator Evaluation operation for rule - + * 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', + * 'LessThan', 'Equal' + * @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.thresholdOperator] Evaluation operation for + * Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: + * 'GreaterThan', 'LessThan', 'Equal' + * @member {number} [metricTrigger.threshold] The threshold of the metric + * trigger. + * @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 + */ +export interface TriggerCondition { + thresholdOperator: string; + threshold: number; + metricTrigger?: LogMetricTrigger; +} + +/** + * @class + * Initializes a new instance of the AzNsActionGroup class. + * @constructor + * Azure 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[]; + emailSubject?: string; + customWebhookPayload?: string; +} + +/** + * @class + * Initializes a new instance of the AlertingAction class. + * @constructor + * Specifiy action need to be taken when rule type is Alert + * + * @member {string} severity Severity of the alert. Possible values include: + * '0', '1', '2', '3', '4' + * @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 or suppressed. + * @member {object} trigger The trigger condition that results in the alert + * rule being. + * @member {string} [trigger.thresholdOperator] Evaluation operation for rule - + * 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', + * 'LessThan', 'Equal' + * @member {number} [trigger.threshold] Result or count threshold based on + * which rule should be triggered. + * @member {object} [trigger.metricTrigger] Trigger condition for metric query + * rule + * @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] The threshold of the + * metric trigger. + * @member {string} [trigger.metricTrigger.metricTriggerType] Metric Trigger + * Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive', + * 'Total' + * @member {string} [trigger.metricTrigger.metricColumn] Evaluation of metric + * on a particular column + */ +export interface AlertingAction extends Action { + severity: string; + aznsAction: AzNsActionGroup; + throttlingInMin?: number; + trigger: TriggerCondition; +} + /** * @class @@ -2232,3 +2518,13 @@ export interface MetricDefinitionCollection extends Array { */ export interface MetricAlertResourceCollection extends Array { } + +/** + * @class + * Initializes a new instance of the LogSearchRuleResourceCollection class. + * @constructor + * Represents a collection of Log Search rule resources. + * + */ +export interface LogSearchRuleResourceCollection extends Array { +} diff --git a/lib/services/monitorManagement/lib/models/index.js b/lib/services/monitorManagement/lib/models/index.js index ebcc3e656b..52f190460c 100644 --- a/lib/services/monitorManagement/lib/models/index.js +++ b/lib/services/monitorManagement/lib/models/index.js @@ -67,6 +67,9 @@ exports.WebhookReceiver = require('./webhookReceiver'); exports.ItsmReceiver = require('./itsmReceiver'); exports.AzureAppPushReceiver = require('./azureAppPushReceiver'); exports.AutomationRunbookReceiver = require('./automationRunbookReceiver'); +exports.VoiceReceiver = require('./voiceReceiver'); +exports.LogicAppReceiver = require('./logicAppReceiver'); +exports.AzureFunctionReceiver = require('./azureFunctionReceiver'); exports.ActionGroupResource = require('./actionGroupResource'); exports.EnableRequest = require('./enableRequest'); exports.ActionGroupPatchBody = require('./actionGroupPatchBody'); @@ -92,7 +95,7 @@ exports.Baseline = require('./baseline'); exports.BaselineResponse = require('./baselineResponse'); exports.TimeSeriesInformation = require('./timeSeriesInformation'); exports.CalculateBaselineResponse = require('./calculateBaselineResponse'); -exports.Action = require('./action'); +exports.MetricAlertAction = require('./metricAlertAction'); exports.MetricAlertCriteria = require('./metricAlertCriteria'); exports.MetricAlertResource = require('./metricAlertResource'); exports.MetricAlertResourcePatch = require('./metricAlertResourcePatch'); @@ -102,6 +105,15 @@ exports.MetricAlertStatusCollection = require('./metricAlertStatusCollection'); exports.MetricDimension = require('./metricDimension'); exports.MetricCriteria = require('./metricCriteria'); exports.MetricAlertSingleResourceMultipleMetricCriteria = require('./metricAlertSingleResourceMultipleMetricCriteria'); +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'); exports.AutoscaleSettingResourceCollection = require('./autoscaleSettingResourceCollection'); exports.IncidentListResult = require('./incidentListResult'); exports.AlertRuleResourceCollection = require('./alertRuleResourceCollection'); @@ -112,6 +124,7 @@ exports.EventDataCollection = require('./eventDataCollection'); exports.EventCategoryCollection = require('./eventCategoryCollection'); exports.MetricDefinitionCollection = require('./metricDefinitionCollection'); exports.MetricAlertResourceCollection = require('./metricAlertResourceCollection'); +exports.LogSearchRuleResourceCollection = require('./logSearchRuleResourceCollection'); exports.discriminators = { 'RuleDataSource' : exports.RuleDataSource, 'RuleCondition' : exports.RuleCondition, @@ -124,5 +137,7 @@ exports.discriminators = { 'RuleAction.Microsoft.Azure.Management.Insights.Models.RuleEmailAction' : exports.RuleEmailAction, 'RuleAction.Microsoft.Azure.Management.Insights.Models.RuleWebhookAction' : exports.RuleWebhookAction, 'MetricAlertCriteria' : exports.MetricAlertCriteria, - 'MetricAlertCriteria.Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria' : exports.MetricAlertSingleResourceMultipleMetricCriteria + '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 }; diff --git a/lib/services/monitorManagement/lib/models/logMetricTrigger.js b/lib/services/monitorManagement/lib/models/logMetricTrigger.js new file mode 100644 index 0000000000..9f50a4aaf4 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/logMetricTrigger.js @@ -0,0 +1,80 @@ +/* + * 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'; + +/** + * A log metrics trigger descriptor. + * + */ +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] The threshold of the metric trigger. + * @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; diff --git a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js new file mode 100644 index 0000000000..138f18b726 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js @@ -0,0 +1,177 @@ +/* + * 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'); + +/** + * The Log Search Rule resource. + * + * @extends models['Resource'] + */ +class LogSearchRuleResource extends models['Resource'] { + /** + * Create a LogSearchRuleResource. + * @member {string} [description] The description of the Log Search rule. + * @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' + * @member {date} [lastUpdatedTime] Last time the rule was updated in IS08601 + * format. + * @member {string} [provisioningState] Provisioning state of the + * 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 {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 {number} [schedule.frequencyInMinutes] frequency (in minutes) at + * which rule condition should be evaluated. + * @member {number} [schedule.timeWindowInMinutes] Time window for which data + * needs to be fetched for query (should be greater than or equal to + * frequencyInMinutes). + * @member {object} action Action needs to be taken on rule execution. + * @member {string} [action.odatatype] Polymorphic Discriminator + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LogSearchRuleResource + * + * @returns {object} metadata of LogSearchRuleResource + * + */ + mapper() { + return { + required: false, + serializedName: 'LogSearchRuleResource', + type: { + name: 'Composite', + className: 'LogSearchRuleResource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + type: { + name: 'String' + } + }, + lastUpdatedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastUpdatedTime', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + source: { + required: true, + serializedName: 'properties.source', + type: { + name: 'Composite', + className: 'Source' + } + }, + schedule: { + required: true, + serializedName: 'properties.schedule', + type: { + name: 'Composite', + className: 'Schedule' + } + }, + action: { + required: true, + serializedName: 'properties.action', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'Action', + className: 'Action' + } + } + } + } + }; + } +} + +module.exports = LogSearchRuleResource; diff --git a/lib/services/monitorManagement/lib/models/logSearchRuleResourceCollection.js b/lib/services/monitorManagement/lib/models/logSearchRuleResourceCollection.js new file mode 100644 index 0000000000..ed1c688271 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/logSearchRuleResourceCollection.js @@ -0,0 +1,59 @@ +/* + * 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'; + +/** + * Represents a collection of Log Search rule resources. + */ +class LogSearchRuleResourceCollection extends Array { + /** + * Create a LogSearchRuleResourceCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LogSearchRuleResourceCollection + * + * @returns {object} metadata of LogSearchRuleResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'LogSearchRuleResourceCollection', + type: { + name: 'Composite', + className: 'LogSearchRuleResourceCollection', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LogSearchRuleResourceElementType', + type: { + name: 'Composite', + className: 'LogSearchRuleResource' + } + } + } + } + } + } + }; + } +} + +module.exports = LogSearchRuleResourceCollection; diff --git a/lib/services/monitorManagement/lib/models/logSearchRuleResourcePatch.js b/lib/services/monitorManagement/lib/models/logSearchRuleResourcePatch.js new file mode 100644 index 0000000000..f06f7b4f95 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/logSearchRuleResourcePatch.js @@ -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; diff --git a/lib/services/monitorManagement/lib/models/logicAppReceiver.js b/lib/services/monitorManagement/lib/models/logicAppReceiver.js new file mode 100644 index 0000000000..9e7a9f1a52 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/logicAppReceiver.js @@ -0,0 +1,70 @@ +/* + * 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'; + +/** + * A logic app receiver. + * + */ +class LogicAppReceiver { + /** + * Create a LogicAppReceiver. + * @member {string} name The name of the logic app receiver. Names must be + * unique across all receivers within an action group. + * @member {string} resourceId The azure resource id of the logic app + * receiver. + * @member {string} callbackUrl The callback url where http request sent to. + */ + constructor() { + } + + /** + * Defines the metadata of LogicAppReceiver + * + * @returns {object} metadata of LogicAppReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'LogicAppReceiver', + type: { + name: 'Composite', + className: 'LogicAppReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + resourceId: { + required: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + callbackUrl: { + required: true, + serializedName: 'callbackUrl', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LogicAppReceiver; diff --git a/lib/services/monitorManagement/lib/models/metricAlertAction.js b/lib/services/monitorManagement/lib/models/metricAlertAction.js new file mode 100644 index 0000000000..2b70ef2515 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/metricAlertAction.js @@ -0,0 +1,67 @@ +/* + * 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'; + +/** + * An alert action. + * + */ +class MetricAlertAction { + /** + * Create a MetricAlertAction. + * @member {string} [actionGroupId] the id of the action group to use. + * @member {object} [webhookProperties] The properties of a webhook object. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertAction + * + * @returns {object} metadata of MetricAlertAction + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertAction', + type: { + name: 'Composite', + className: 'MetricAlertAction', + modelProperties: { + actionGroupId: { + required: false, + serializedName: 'actionGroupId', + type: { + name: 'String' + } + }, + webhookProperties: { + required: false, + serializedName: 'webhookProperties', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricAlertAction; diff --git a/lib/services/monitorManagement/lib/models/metricAlertResource.js b/lib/services/monitorManagement/lib/models/metricAlertResource.js index c21174220c..867cdcff89 100644 --- a/lib/services/monitorManagement/lib/models/metricAlertResource.js +++ b/lib/services/monitorManagement/lib/models/metricAlertResource.js @@ -34,6 +34,8 @@ class MetricAlertResource extends models['Resource'] { * threshold. * @member {object} criteria defines the specific alert criteria information. * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @member {boolean} [autoMitigate] the flag that indicates whether the alert + * should be auto resolved or not. * @member {array} [actions] the array of actions that are performed when the * alert rule becomes active, and when an alert condition is resolved. * @member {date} [lastUpdatedTime] Last time the rule was updated in ISO8601 @@ -176,6 +178,13 @@ class MetricAlertResource extends models['Resource'] { className: 'MetricAlertCriteria' } }, + autoMitigate: { + required: false, + serializedName: 'properties.autoMitigate', + type: { + name: 'Boolean' + } + }, actions: { required: false, serializedName: 'properties.actions', @@ -183,10 +192,10 @@ class MetricAlertResource extends models['Resource'] { name: 'Sequence', element: { required: false, - serializedName: 'ActionElementType', + serializedName: 'MetricAlertActionElementType', type: { name: 'Composite', - className: 'Action' + className: 'MetricAlertAction' } } } diff --git a/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js b/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js index 1832373f2d..2211860368 100644 --- a/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js +++ b/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js @@ -34,6 +34,8 @@ class MetricAlertResourcePatch { * threshold. * @member {object} criteria defines the specific alert criteria information. * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @member {boolean} [autoMitigate] the flag that indicates whether the alert + * should be auto resolved or not. * @member {array} [actions] the array of actions that are performed when the * alert rule becomes active, and when an alert condition is resolved. * @member {date} [lastUpdatedTime] Last time the rule was updated in ISO8601 @@ -144,6 +146,13 @@ class MetricAlertResourcePatch { className: 'MetricAlertCriteria' } }, + autoMitigate: { + required: false, + serializedName: 'properties.autoMitigate', + type: { + name: 'Boolean' + } + }, actions: { required: false, serializedName: 'properties.actions', @@ -151,10 +160,10 @@ class MetricAlertResourcePatch { name: 'Sequence', element: { required: false, - serializedName: 'ActionElementType', + serializedName: 'MetricAlertActionElementType', type: { name: 'Composite', - className: 'Action' + className: 'MetricAlertAction' } } } diff --git a/lib/services/monitorManagement/lib/models/metricAlertStatus.js b/lib/services/monitorManagement/lib/models/metricAlertStatus.js index 6df29691be..388183af45 100644 --- a/lib/services/monitorManagement/lib/models/metricAlertStatus.js +++ b/lib/services/monitorManagement/lib/models/metricAlertStatus.js @@ -24,7 +24,8 @@ class MetricAlertStatus { * @member {string} [type] The extended resource type name. * @member {object} [properties] The alert status properties of the metric * alert status. - * @member {object} [properties.dimensions] + * @member {object} [properties.dimensions] An object describing the type of + * the dimensions. * @member {string} [properties.status] status value * @member {date} [properties.timestamp] UTC time when the status was * checked. diff --git a/lib/services/monitorManagement/lib/models/metricAlertStatusProperties.js b/lib/services/monitorManagement/lib/models/metricAlertStatusProperties.js index b9581c6cda..73ef0ae1bd 100644 --- a/lib/services/monitorManagement/lib/models/metricAlertStatusProperties.js +++ b/lib/services/monitorManagement/lib/models/metricAlertStatusProperties.js @@ -17,7 +17,8 @@ class MetricAlertStatusProperties { /** * Create a MetricAlertStatusProperties. - * @member {object} [dimensions] + * @member {object} [dimensions] An object describing the type of the + * dimensions. * @member {string} [status] status value * @member {date} [timestamp] UTC time when the status was checked. */ diff --git a/lib/services/monitorManagement/lib/models/metricCriteria.js b/lib/services/monitorManagement/lib/models/metricCriteria.js index 19192dc18a..8be5418acb 100644 --- a/lib/services/monitorManagement/lib/models/metricCriteria.js +++ b/lib/services/monitorManagement/lib/models/metricCriteria.js @@ -13,7 +13,8 @@ const models = require('./index'); /** - * Class representing a MetricCriteria. + * Criterion to filter metrics. + * */ class MetricCriteria { /** diff --git a/lib/services/monitorManagement/lib/models/metricDimension.js b/lib/services/monitorManagement/lib/models/metricDimension.js index 4805da9870..70b761f9e4 100644 --- a/lib/services/monitorManagement/lib/models/metricDimension.js +++ b/lib/services/monitorManagement/lib/models/metricDimension.js @@ -11,7 +11,8 @@ 'use strict'; /** - * Class representing a MetricDimension. + * Specifies a metric dimension. + * */ class MetricDimension { /** diff --git a/lib/services/monitorManagement/lib/models/recurrence.js b/lib/services/monitorManagement/lib/models/recurrence.js index cb2dddd1d5..b4878ebe15 100644 --- a/lib/services/monitorManagement/lib/models/recurrence.js +++ b/lib/services/monitorManagement/lib/models/recurrence.js @@ -20,10 +20,6 @@ const models = require('./index'); class Recurrence { /** * Create a Recurrence. - * @member {string} frequency 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' * @member {object} schedule the scheduling constraints for when the profile * begins. * @member {string} [schedule.timeZone] the timezone for the hours of the @@ -91,10 +87,11 @@ class Recurrence { modelProperties: { frequency: { required: true, + isConstant: true, serializedName: 'frequency', + defaultValue: 'Week', type: { - name: 'Enum', - allowedValues: [ 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' ] + name: 'String' } }, schedule: { diff --git a/lib/services/monitorManagement/lib/models/schedule.js b/lib/services/monitorManagement/lib/models/schedule.js new file mode 100644 index 0000000000..bc53afa278 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/schedule.js @@ -0,0 +1,63 @@ +/* + * 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'; + +/** + * Defines how often to run the search and the time interval. + * + */ +class Schedule { + /** + * Create a Schedule. + * @member {number} frequencyInMinutes frequency (in minutes) at which rule + * condition should be evaluated. + * @member {number} timeWindowInMinutes Time window for which data needs to + * be fetched for query (should be greater than or equal to + * frequencyInMinutes). + */ + constructor() { + } + + /** + * Defines the metadata of Schedule + * + * @returns {object} metadata of Schedule + * + */ + mapper() { + return { + required: false, + serializedName: 'Schedule', + type: { + name: 'Composite', + className: 'Schedule', + modelProperties: { + frequencyInMinutes: { + required: true, + serializedName: 'frequencyInMinutes', + type: { + name: 'Number' + } + }, + timeWindowInMinutes: { + required: true, + serializedName: 'timeWindowInMinutes', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = Schedule; diff --git a/lib/services/monitorManagement/lib/models/sku1.js b/lib/services/monitorManagement/lib/models/sku1.js new file mode 100644 index 0000000000..24be749815 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/sku1.js @@ -0,0 +1,53 @@ +/* + * 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'; + +/** + * SKU of rule + * + */ +class Sku1 { + /** + * Create a Sku1. + * @member {string} [name] The name of the SKU (L1, L2, L3). Possible values + * include: 'L1', 'L2', 'L3' + */ + constructor() { + } + + /** + * Defines the metadata of Sku1 + * + * @returns {object} metadata of Sku1 + * + */ + mapper() { + return { + required: false, + serializedName: 'Sku', + type: { + name: 'Composite', + className: 'Sku1', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Sku1; diff --git a/lib/services/monitorManagement/lib/models/source.js b/lib/services/monitorManagement/lib/models/source.js new file mode 100644 index 0000000000..d576129d8a --- /dev/null +++ b/lib/services/monitorManagement/lib/models/source.js @@ -0,0 +1,86 @@ +/* + * 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 log search query. + * + */ +class Source { + /** + * Create a Source. + * @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 + * is to be run. + * @member {string} [queryType] Set value to 'ResultCount'. Possible values + * include: 'ResultCount' + */ + constructor() { + } + + /** + * Defines the metadata of Source + * + * @returns {object} metadata of Source + * + */ + mapper() { + return { + required: false, + serializedName: 'Source', + type: { + name: 'Composite', + className: 'Source', + modelProperties: { + query: { + required: true, + serializedName: 'query', + type: { + name: 'String' + } + }, + authorizedResources: { + required: false, + serializedName: 'authorizedResources', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + dataSourceId: { + required: true, + serializedName: 'dataSourceId', + type: { + name: 'String' + } + }, + queryType: { + required: false, + serializedName: 'queryType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Source; diff --git a/lib/services/monitorManagement/lib/models/triggerCondition.js b/lib/services/monitorManagement/lib/models/triggerCondition.js new file mode 100644 index 0000000000..b69f6b6a0a --- /dev/null +++ b/lib/services/monitorManagement/lib/models/triggerCondition.js @@ -0,0 +1,83 @@ +/* + * 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'); + +/** + * The condition that results in the Log Search rule. + * + */ +class TriggerCondition { + /** + * Create a TriggerCondition. + * @member {string} thresholdOperator Evaluation operation for rule - + * 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', + * 'LessThan', 'Equal' + * @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.thresholdOperator] Evaluation operation + * for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values + * include: 'GreaterThan', 'LessThan', 'Equal' + * @member {number} [metricTrigger.threshold] The threshold of the metric + * trigger. + * @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 + */ + constructor() { + } + + /** + * Defines the metadata of TriggerCondition + * + * @returns {object} metadata of TriggerCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'TriggerCondition', + type: { + name: 'Composite', + className: 'TriggerCondition', + modelProperties: { + thresholdOperator: { + required: true, + serializedName: 'thresholdOperator', + type: { + name: 'String' + } + }, + threshold: { + required: true, + serializedName: 'threshold', + type: { + name: 'Number' + } + }, + metricTrigger: { + required: false, + serializedName: 'metricTrigger', + type: { + name: 'Composite', + className: 'LogMetricTrigger' + } + } + } + } + }; + } +} + +module.exports = TriggerCondition; diff --git a/lib/services/monitorManagement/lib/models/voiceReceiver.js b/lib/services/monitorManagement/lib/models/voiceReceiver.js new file mode 100644 index 0000000000..ac1ac1025d --- /dev/null +++ b/lib/services/monitorManagement/lib/models/voiceReceiver.js @@ -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'; + +/** + * A voice receiver. + * + */ +class VoiceReceiver { + /** + * Create a VoiceReceiver. + * @member {string} name The name of the voice receiver. Names must be unique + * across all receivers within an action group. + * @member {string} countryCode The country code of the voice receiver. + * @member {string} phoneNumber The phone number of the voice receiver. + */ + constructor() { + } + + /** + * Defines the metadata of VoiceReceiver + * + * @returns {object} metadata of VoiceReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'VoiceReceiver', + type: { + name: 'Composite', + className: 'VoiceReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + countryCode: { + required: true, + serializedName: 'countryCode', + type: { + name: 'String' + } + }, + phoneNumber: { + required: true, + serializedName: 'phoneNumber', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VoiceReceiver; diff --git a/lib/services/monitorManagement/lib/monitorManagementClient.d.ts b/lib/services/monitorManagement/lib/monitorManagementClient.d.ts index 9c64e133dc..abfb3a46d3 100644 --- a/lib/services/monitorManagement/lib/monitorManagementClient.d.ts +++ b/lib/services/monitorManagement/lib/monitorManagementClient.d.ts @@ -34,11 +34,11 @@ export default class MonitorManagementClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); @@ -71,6 +71,7 @@ export default class MonitorManagementClient extends AzureServiceClient { metricBaseline: operations.MetricBaseline; metricAlerts: operations.MetricAlerts; metricAlertsStatus: operations.MetricAlertsStatus; + scheduledQueryRules: operations.ScheduledQueryRules; } export { MonitorManagementClient, models as MonitorManagementModels }; diff --git a/lib/services/monitorManagement/lib/monitorManagementClient.js b/lib/services/monitorManagement/lib/monitorManagementClient.js index 356cd3c461..5391569009 100644 --- a/lib/services/monitorManagement/lib/monitorManagementClient.js +++ b/lib/services/monitorManagement/lib/monitorManagementClient.js @@ -34,9 +34,9 @@ class MonitorManagementClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ constructor(credentials, subscriptionId, baseUri, options) { if (credentials === null || credentials === undefined) { @@ -88,6 +88,7 @@ class MonitorManagementClient extends ServiceClient { this.metricBaseline = new operations.MetricBaseline(this); this.metricAlerts = new operations.MetricAlerts(this); this.metricAlertsStatus = new operations.MetricAlertsStatus(this); + this.scheduledQueryRules = new operations.ScheduledQueryRules(this); this.models = models; msRest.addSerializationMixin(this); } diff --git a/lib/services/monitorManagement/lib/operations/actionGroups.js b/lib/services/monitorManagement/lib/operations/actionGroups.js index ec5e0913c4..eb71ef49e3 100644 --- a/lib/services/monitorManagement/lib/operations/actionGroups.js +++ b/lib/services/monitorManagement/lib/operations/actionGroups.js @@ -49,6 +49,15 @@ const WebResource = msRest.WebResource; * @param {array} [actionGroup.automationRunbookReceivers] The list of * AutomationRunbook receivers that are part of this action group. * + * @param {array} [actionGroup.voiceReceivers] The list of voice receivers that + * are part of this action group. + * + * @param {array} [actionGroup.logicAppReceivers] The list of logic app + * receivers that are part of this action group. + * + * @param {array} [actionGroup.azureFunctionReceivers] The list of azure + * function receivers that are part of this action group. + * * @param {string} actionGroup.location Resource location * * @param {object} [actionGroup.tags] Resource tags @@ -81,7 +90,7 @@ function _createOrUpdate(resourceGroupName, actionGroupName, actionGroup, option if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-04-01'; + let apiVersion = '2018-03-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -259,7 +268,7 @@ function _get(resourceGroupName, actionGroupName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-04-01'; + let apiVersion = '2018-03-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -402,7 +411,7 @@ function _deleteMethod(resourceGroupName, actionGroupName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-04-01'; + let apiVersion = '2018-03-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -538,7 +547,7 @@ function _update(resourceGroupName, actionGroupName, actionGroupPatch, options, if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-04-01'; + let apiVersion = '2018-03-01'; // Validate try { if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { @@ -695,7 +704,7 @@ function _listBySubscriptionId(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-04-01'; + let apiVersion = '2018-03-01'; // Validate try { if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { @@ -829,7 +838,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-04-01'; + let apiVersion = '2018-03-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -936,7 +945,8 @@ function _listByResourceGroup(resourceGroupName, options, callback) { /** * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. + * from Disabled to Enabled. This operation is only supported for Email or SMS + * receivers. * * @param {string} resourceGroupName The name of the resource group. * @@ -971,7 +981,7 @@ function _enableReceiver(resourceGroupName, actionGroupName, receiverName, optio if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-04-01'; + let apiVersion = '2018-03-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -1137,6 +1147,15 @@ class ActionGroups { * @param {array} [actionGroup.automationRunbookReceivers] The list of * AutomationRunbook receivers that are part of this action group. * + * @param {array} [actionGroup.voiceReceivers] The list of voice receivers that + * are part of this action group. + * + * @param {array} [actionGroup.logicAppReceivers] The list of logic app + * receivers that are part of this action group. + * + * @param {array} [actionGroup.azureFunctionReceivers] The list of azure + * function receivers that are part of this action group. + * * @param {string} actionGroup.location Resource location * * @param {object} [actionGroup.tags] Resource tags @@ -1201,6 +1220,15 @@ class ActionGroups { * @param {array} [actionGroup.automationRunbookReceivers] The list of * AutomationRunbook receivers that are part of this action group. * + * @param {array} [actionGroup.voiceReceivers] The list of voice receivers that + * are part of this action group. + * + * @param {array} [actionGroup.logicAppReceivers] The list of logic app + * receivers that are part of this action group. + * + * @param {array} [actionGroup.azureFunctionReceivers] The list of azure + * function receivers that are part of this action group. + * * @param {string} actionGroup.location Resource location * * @param {object} [actionGroup.tags] Resource tags @@ -1689,7 +1717,8 @@ class ActionGroups { /** * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. + * from Disabled to Enabled. This operation is only supported for Email or SMS + * receivers. * * @param {string} resourceGroupName The name of the resource group. * @@ -1724,7 +1753,8 @@ class ActionGroups { /** * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. + * from Disabled to Enabled. This operation is only supported for Email or SMS + * receivers. * * @param {string} resourceGroupName The name of the resource group. * diff --git a/lib/services/monitorManagement/lib/operations/alertRules.js b/lib/services/monitorManagement/lib/operations/alertRules.js index 3676f74c97..a8ecdb6a79 100644 --- a/lib/services/monitorManagement/lib/operations/alertRules.js +++ b/lib/services/monitorManagement/lib/operations/alertRules.js @@ -843,6 +843,138 @@ function _listByResourceGroup(resourceGroupName, options, callback) { }); } +/** + * List the alert rules within a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AlertRuleResourceCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscription(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2016-03-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AlertRuleResourceCollection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** Class representing a AlertRules. */ class AlertRules { /** @@ -856,6 +988,7 @@ class AlertRules { this._get = _get; this._update = _update; this._listByResourceGroup = _listByResourceGroup; + this._listBySubscription = _listBySubscription; } /** @@ -1418,6 +1551,85 @@ class AlertRules { } } + /** + * List the alert rules within a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List the alert rules within a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {AlertRuleResourceCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AlertRuleResourceCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + } module.exports = AlertRules; diff --git a/lib/services/monitorManagement/lib/operations/autoscaleSettings.js b/lib/services/monitorManagement/lib/operations/autoscaleSettings.js index a65507da16..d5a5fdd181 100644 --- a/lib/services/monitorManagement/lib/operations/autoscaleSettings.js +++ b/lib/services/monitorManagement/lib/operations/autoscaleSettings.js @@ -809,6 +809,139 @@ function _update(resourceGroupName, autoscaleSettingName, autoscaleSettingResour }); } +/** + * Lists the autoscale settings for a subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResourceCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscription(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-04-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AutoscaleSettingResourceCollection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** * Lists the autoscale settings for a resource group * @@ -938,6 +1071,135 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { }); } +/** + * Lists the autoscale settings for a subscription + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResourceCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscriptionNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AutoscaleSettingResourceCollection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** Class representing a AutoscaleSettings. */ class AutoscaleSettings { /** @@ -951,7 +1213,9 @@ class AutoscaleSettings { this._deleteMethod = _deleteMethod; this._get = _get; this._update = _update; + this._listBySubscription = _listBySubscription; this._listByResourceGroupNext = _listByResourceGroupNext; + this._listBySubscriptionNext = _listBySubscriptionNext; } /** @@ -1471,6 +1735,85 @@ class AutoscaleSettings { } } + /** + * Lists the autoscale settings for a subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the autoscale settings for a subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {AutoscaleSettingResourceCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResourceCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + /** * Lists the autoscale settings for a resource group * @@ -1556,6 +1899,91 @@ class AutoscaleSettings { } } + /** + * Lists the autoscale settings for a subscription + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the autoscale settings for a subscription + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {AutoscaleSettingResourceCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResourceCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscriptionNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = AutoscaleSettings; diff --git a/lib/services/monitorManagement/lib/operations/diagnosticSettingsOperations.js b/lib/services/monitorManagement/lib/operations/diagnosticSettingsOperations.js index be6f0864d9..78f0d6d643 100644 --- a/lib/services/monitorManagement/lib/operations/diagnosticSettingsOperations.js +++ b/lib/services/monitorManagement/lib/operations/diagnosticSettingsOperations.js @@ -165,6 +165,9 @@ function _get(resourceUri, name, options, callback) { * @param {string} [parameters.storageAccountId] The resource ID of the storage * account to which you would like to send Diagnostic Logs. * + * @param {string} [parameters.serviceBusRuleId] The service bus rule Id of the + * diagnostic setting. This is here to maintain backwards compatibility. + * * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for * the event hub authorization rule. * @@ -701,6 +704,9 @@ class DiagnosticSettingsOperations { * @param {string} [parameters.storageAccountId] The resource ID of the storage * account to which you would like to send Diagnostic Logs. * + * @param {string} [parameters.serviceBusRuleId] The service bus rule Id of the + * diagnostic setting. This is here to maintain backwards compatibility. + * * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for * the event hub authorization rule. * @@ -753,6 +759,9 @@ class DiagnosticSettingsOperations { * @param {string} [parameters.storageAccountId] The resource ID of the storage * account to which you would like to send Diagnostic Logs. * + * @param {string} [parameters.serviceBusRuleId] The service bus rule Id of the + * diagnostic setting. This is here to maintain backwards compatibility. + * * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for * the event hub authorization rule. * diff --git a/lib/services/monitorManagement/lib/operations/index.d.ts b/lib/services/monitorManagement/lib/operations/index.d.ts index e3c9bb1680..77e4ab7c1e 100644 --- a/lib/services/monitorManagement/lib/operations/index.d.ts +++ b/lib/services/monitorManagement/lib/operations/index.d.ts @@ -404,6 +404,58 @@ export interface AutoscaleSettings { update(resourceGroupName: string, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Lists the autoscale settings for a subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the autoscale settings for a subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {AutoscaleSettingResourceCollection} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {AutoscaleSettingResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResourceCollection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Lists the autoscale settings for a resource group * @@ -460,6 +512,64 @@ export interface AutoscaleSettings { listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the autoscale settings for a subscription + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the autoscale settings for a subscription + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {AutoscaleSettingResourceCollection} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {AutoscaleSettingResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResourceCollection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscriptionNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionNext(nextPageLink: string, callback: ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** @@ -1085,6 +1195,58 @@ export interface AlertRules { listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List the alert rules within a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List the alert rules within a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {AlertRuleResourceCollection} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {AlertRuleResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link AlertRuleResourceCollection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** @@ -1567,6 +1729,9 @@ export interface DiagnosticSettingsOperations { * @param {string} [parameters.storageAccountId] The resource ID of the storage * account to which you would like to send Diagnostic Logs. * + * @param {string} [parameters.serviceBusRuleId] The service bus rule Id of the + * diagnostic setting. This is here to maintain backwards compatibility. + * * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for * the event hub authorization rule. * @@ -1607,6 +1772,9 @@ export interface DiagnosticSettingsOperations { * @param {string} [parameters.storageAccountId] The resource ID of the storage * account to which you would like to send Diagnostic Logs. * + * @param {string} [parameters.serviceBusRuleId] The service bus rule Id of the + * diagnostic setting. This is here to maintain backwards compatibility. + * * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for * the event hub authorization rule. * @@ -1941,6 +2109,15 @@ export interface ActionGroups { * @param {array} [actionGroup.automationRunbookReceivers] The list of * AutomationRunbook receivers that are part of this action group. * + * @param {array} [actionGroup.voiceReceivers] The list of voice receivers that + * are part of this action group. + * + * @param {array} [actionGroup.logicAppReceivers] The list of logic app + * receivers that are part of this action group. + * + * @param {array} [actionGroup.azureFunctionReceivers] The list of azure + * function receivers that are part of this action group. + * * @param {string} actionGroup.location Resource location * * @param {object} [actionGroup.tags] Resource tags @@ -1993,6 +2170,15 @@ export interface ActionGroups { * @param {array} [actionGroup.automationRunbookReceivers] The list of * AutomationRunbook receivers that are part of this action group. * + * @param {array} [actionGroup.voiceReceivers] The list of voice receivers that + * are part of this action group. + * + * @param {array} [actionGroup.logicAppReceivers] The list of logic app + * receivers that are part of this action group. + * + * @param {array} [actionGroup.azureFunctionReceivers] The list of azure + * function receivers that are part of this action group. + * * @param {string} actionGroup.location Resource location * * @param {object} [actionGroup.tags] Resource tags @@ -2331,7 +2517,8 @@ export interface ActionGroups { /** * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. + * from Disabled to Enabled. This operation is only supported for Email or SMS + * receivers. * * @param {string} resourceGroupName The name of the resource group. * @@ -2354,7 +2541,8 @@ export interface ActionGroups { /** * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. + * from Disabled to Enabled. This operation is only supported for Email or SMS + * receivers. * * @param {string} resourceGroupName The name of the resource group. * @@ -3864,6 +4052,9 @@ export interface MetricAlerts { * * @param {string} parameters.criteria.odatatype Polymorphic Discriminator * + * @param {boolean} [parameters.autoMitigate] the flag that indicates whether + * the alert should be auto resolved or not. + * * @param {array} [parameters.actions] the array of actions that are performed * when the alert rule becomes active, and when an alert condition is resolved. * @@ -3916,6 +4107,9 @@ export interface MetricAlerts { * * @param {string} parameters.criteria.odatatype Polymorphic Discriminator * + * @param {boolean} [parameters.autoMitigate] the flag that indicates whether + * the alert should be auto resolved or not. + * * @param {array} [parameters.actions] the array of actions that are performed * when the alert rule becomes active, and when an alert condition is resolved. * @@ -3989,6 +4183,9 @@ export interface MetricAlerts { * * @param {string} parameters.criteria.odatatype Polymorphic Discriminator * + * @param {boolean} [parameters.autoMitigate] the flag that indicates whether + * the alert should be auto resolved or not. + * * @param {array} [parameters.actions] the array of actions that are performed * when the alert rule becomes active, and when an alert condition is resolved. * @@ -4039,6 +4236,9 @@ export interface MetricAlerts { * * @param {string} parameters.criteria.odatatype Polymorphic Discriminator * + * @param {boolean} [parameters.autoMitigate] the flag that indicates whether + * the alert should be auto resolved or not. + * * @param {array} [parameters.actions] the array of actions that are performed * when the alert rule becomes active, and when an alert condition is resolved. * @@ -4264,3 +4464,471 @@ export interface MetricAlertsStatus { listByName(resourceGroupName: string, ruleName: string, statusName: string, callback: ServiceCallback): void; listByName(resourceGroupName: string, ruleName: string, statusName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } + +/** + * @class + * ScheduledQueryRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface ScheduledQueryRules { + + + /** + * Creates or updates an log search rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} parameters The parameters of the rule to create or update. + * + * @param {string} [parameters.description] The description of the Log Search + * rule. + * + * @param {string} [parameters.enabled] The flag which indicates whether the + * Log Search rule is enabled. Value should be true or false. Possible values + * include: 'true', 'false' + * + * @param {object} parameters.source Data Source against which rule will Query + * Data + * + * @param {string} parameters.source.query Log search query. + * + * @param {array} [parameters.source.authorizedResources] List of Resource + * referred into query + * + * @param {string} parameters.source.dataSourceId The resource uri over which + * log search query is to be run. + * + * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. + * Possible values include: 'ResultCount' + * + * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for + * rule. + * + * @param {number} parameters.schedule.frequencyInMinutes frequency (in + * minutes) at which rule condition should be evaluated. + * + * @param {number} parameters.schedule.timeWindowInMinutes Time window for + * which data needs to be fetched for query (should be greater than or equal to + * frequencyInMinutes). + * + * @param {object} parameters.action Action needs to be taken on rule + * execution. + * + * @param {string} parameters.action.odatatype Polymorphic Discriminator + * + * @param {string} parameters.location Resource location + * + * @param {object} [parameters.tags] Resource tags + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, ruleName: string, parameters: models.LogSearchRuleResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an log search rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} parameters The parameters of the rule to create or update. + * + * @param {string} [parameters.description] The description of the Log Search + * rule. + * + * @param {string} [parameters.enabled] The flag which indicates whether the + * Log Search rule is enabled. Value should be true or false. Possible values + * include: 'true', 'false' + * + * @param {object} parameters.source Data Source against which rule will Query + * Data + * + * @param {string} parameters.source.query Log search query. + * + * @param {array} [parameters.source.authorizedResources] List of Resource + * referred into query + * + * @param {string} parameters.source.dataSourceId The resource uri over which + * log search query is to be run. + * + * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. + * Possible values include: 'ResultCount' + * + * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for + * rule. + * + * @param {number} parameters.schedule.frequencyInMinutes frequency (in + * minutes) at which rule condition should be evaluated. + * + * @param {number} parameters.schedule.timeWindowInMinutes Time window for + * which data needs to be fetched for query (should be greater than or equal to + * frequencyInMinutes). + * + * @param {object} parameters.action Action needs to be taken on rule + * execution. + * + * @param {string} parameters.action.odatatype Polymorphic Discriminator + * + * @param {string} parameters.location Resource location + * + * @param {object} [parameters.tags] Resource tags + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LogSearchRuleResource} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LogSearchRuleResource} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.LogSearchRuleResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.LogSearchRuleResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.LogSearchRuleResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets an Log Search rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets an Log Search rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LogSearchRuleResource} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LogSearchRuleResource} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, ruleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update log search Rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} parameters The parameters of the rule to update. + * + * @param {object} [parameters.tags] Resource tags + * + * @param {string} [parameters.enabled] The flag which indicates whether the + * Log Search rule is enabled. Value should be true or false. Possible values + * include: 'true', 'false' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, ruleName: string, parameters: models.LogSearchRuleResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update log search Rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} parameters The parameters of the rule to update. + * + * @param {object} [parameters.tags] Resource tags + * + * @param {string} [parameters.enabled] The flag which indicates whether the + * Log Search rule is enabled. Value should be true or false. Possible values + * include: 'true', 'false' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LogSearchRuleResource} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LogSearchRuleResource} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResource} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, ruleName: string, parameters: models.LogSearchRuleResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, ruleName: string, parameters: models.LogSearchRuleResourcePatch, callback: ServiceCallback): void; + update(resourceGroupName: string, ruleName: string, parameters: models.LogSearchRuleResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a Log Search rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a Log Search rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, ruleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List the Log Search rules within a subscription group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List the Log Search rules within a subscription group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LogSearchRuleResourceCollection} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LogSearchRuleResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResourceCollection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List the Log Search rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List the Log Search rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LogSearchRuleResourceCollection} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LogSearchRuleResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResourceCollection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/monitorManagement/lib/operations/index.js b/lib/services/monitorManagement/lib/operations/index.js index 56d8f5aa1b..450357ebfb 100644 --- a/lib/services/monitorManagement/lib/operations/index.js +++ b/lib/services/monitorManagement/lib/operations/index.js @@ -31,3 +31,4 @@ exports.Metrics = require('./metrics'); exports.MetricBaseline = require('./metricBaseline'); exports.MetricAlerts = require('./metricAlerts'); exports.MetricAlertsStatus = require('./metricAlertsStatus'); +exports.ScheduledQueryRules = require('./scheduledQueryRules'); diff --git a/lib/services/monitorManagement/lib/operations/metricAlerts.js b/lib/services/monitorManagement/lib/operations/metricAlerts.js index d8cdf644dc..ed52e2172a 100644 --- a/lib/services/monitorManagement/lib/operations/metricAlerts.js +++ b/lib/services/monitorManagement/lib/operations/metricAlerts.js @@ -62,7 +62,7 @@ function _listBySubscription(options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Insight/metricAlerts'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); @@ -200,7 +200,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); let queryParameters = []; @@ -343,7 +343,7 @@ function _get(resourceGroupName, ruleName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); @@ -463,6 +463,9 @@ function _get(resourceGroupName, ruleName, options, callback) { * * @param {string} parameters.criteria.odatatype Polymorphic Discriminator * + * @param {boolean} [parameters.autoMitigate] the flag that indicates whether + * the alert should be auto resolved or not. + * * @param {array} [parameters.actions] the array of actions that are performed * when the alert rule becomes active, and when an alert condition is resolved. * @@ -522,7 +525,7 @@ function _createOrUpdate(resourceGroupName, ruleName, parameters, options, callb // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); @@ -658,6 +661,9 @@ function _createOrUpdate(resourceGroupName, ruleName, parameters, options, callb * * @param {string} parameters.criteria.odatatype Polymorphic Discriminator * + * @param {boolean} [parameters.autoMitigate] the flag that indicates whether + * the alert should be auto resolved or not. + * * @param {array} [parameters.actions] the array of actions that are performed * when the alert rule becomes active, and when an alert condition is resolved. * @@ -713,7 +719,7 @@ function _update(resourceGroupName, ruleName, parameters, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); @@ -870,7 +876,7 @@ function _deleteMethod(resourceGroupName, ruleName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); @@ -1236,6 +1242,9 @@ class MetricAlerts { * * @param {string} parameters.criteria.odatatype Polymorphic Discriminator * + * @param {boolean} [parameters.autoMitigate] the flag that indicates whether + * the alert should be auto resolved or not. + * * @param {array} [parameters.actions] the array of actions that are performed * when the alert rule becomes active, and when an alert condition is resolved. * @@ -1300,6 +1309,9 @@ class MetricAlerts { * * @param {string} parameters.criteria.odatatype Polymorphic Discriminator * + * @param {boolean} [parameters.autoMitigate] the flag that indicates whether + * the alert should be auto resolved or not. + * * @param {array} [parameters.actions] the array of actions that are performed * when the alert rule becomes active, and when an alert condition is resolved. * @@ -1388,6 +1400,9 @@ class MetricAlerts { * * @param {string} parameters.criteria.odatatype Polymorphic Discriminator * + * @param {boolean} [parameters.autoMitigate] the flag that indicates whether + * the alert should be auto resolved or not. + * * @param {array} [parameters.actions] the array of actions that are performed * when the alert rule becomes active, and when an alert condition is resolved. * @@ -1450,6 +1465,9 @@ class MetricAlerts { * * @param {string} parameters.criteria.odatatype Polymorphic Discriminator * + * @param {boolean} [parameters.autoMitigate] the flag that indicates whether + * the alert should be auto resolved or not. + * * @param {array} [parameters.actions] the array of actions that are performed * when the alert rule becomes active, and when an alert condition is resolved. * diff --git a/lib/services/monitorManagement/lib/operations/metricAlertsStatus.js b/lib/services/monitorManagement/lib/operations/metricAlertsStatus.js index 7bd81a8494..29b4afc056 100644 --- a/lib/services/monitorManagement/lib/operations/metricAlertsStatus.js +++ b/lib/services/monitorManagement/lib/operations/metricAlertsStatus.js @@ -71,7 +71,7 @@ function _list(resourceGroupName, ruleName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}/status'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); @@ -221,7 +221,7 @@ function _listByName(resourceGroupName, ruleName, statusName, options, callback) // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}/status/{statusName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); diff --git a/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js new file mode 100644 index 0000000000..40352ff697 --- /dev/null +++ b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js @@ -0,0 +1,1609 @@ +/* + * 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 msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Creates or updates an log search rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} parameters The parameters of the rule to create or update. + * + * @param {string} [parameters.description] The description of the Log Search + * rule. + * + * @param {string} [parameters.enabled] The flag which indicates whether the + * Log Search rule is enabled. Value should be true or false. Possible values + * include: 'true', 'false' + * + * @param {object} parameters.source Data Source against which rule will Query + * Data + * + * @param {string} parameters.source.query Log search query. + * + * @param {array} [parameters.source.authorizedResources] List of Resource + * referred into query + * + * @param {string} parameters.source.dataSourceId The resource uri over which + * log search query is to be run. + * + * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. + * Possible values include: 'ResultCount' + * + * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for + * rule. + * + * @param {number} parameters.schedule.frequencyInMinutes frequency (in + * minutes) at which rule condition should be evaluated. + * + * @param {number} parameters.schedule.timeWindowInMinutes Time window for + * which data needs to be fetched for query (should be greater than or equal to + * frequencyInMinutes). + * + * @param {object} parameters.action Action needs to be taken on rule + * execution. + * + * @param {string} parameters.action.odatatype Polymorphic Discriminator + * + * @param {string} parameters.location Resource location + * + * @param {object} [parameters.tags] Resource tags + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, ruleName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-04-16'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (ruleName === null || ruleName === undefined || typeof ruleName.valueOf() !== 'string') { + throw new Error('ruleName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['LogSearchRuleResource']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LogSearchRuleResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LogSearchRuleResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets an Log Search rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, ruleName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-04-16'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (ruleName === null || ruleName === undefined || typeof ruleName.valueOf() !== 'string') { + throw new Error('ruleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LogSearchRuleResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Update log search Rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} parameters The parameters of the rule to update. + * + * @param {object} [parameters.tags] Resource tags + * + * @param {string} [parameters.enabled] The flag which indicates whether the + * Log Search rule is enabled. Value should be true or false. Possible values + * include: 'true', 'false' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, ruleName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-04-16'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (ruleName === null || ruleName === undefined || typeof ruleName.valueOf() !== 'string') { + throw new Error('ruleName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['LogSearchRuleResourcePatch']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LogSearchRuleResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a Log Search rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, ruleName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-04-16'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (ruleName === null || ruleName === undefined || typeof ruleName.valueOf() !== 'string') { + throw new Error('ruleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List the Log Search rules within a subscription group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResourceCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscription(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-04-16'; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LogSearchRuleResourceCollection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List the Log Search rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResourceCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-04-16'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LogSearchRuleResourceCollection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ScheduledQueryRules. */ +class ScheduledQueryRules { + /** + * Create a ScheduledQueryRules. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._listBySubscription = _listBySubscription; + this._listByResourceGroup = _listByResourceGroup; + } + + /** + * Creates or updates an log search rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} parameters The parameters of the rule to create or update. + * + * @param {string} [parameters.description] The description of the Log Search + * rule. + * + * @param {string} [parameters.enabled] The flag which indicates whether the + * Log Search rule is enabled. Value should be true or false. Possible values + * include: 'true', 'false' + * + * @param {object} parameters.source Data Source against which rule will Query + * Data + * + * @param {string} parameters.source.query Log search query. + * + * @param {array} [parameters.source.authorizedResources] List of Resource + * referred into query + * + * @param {string} parameters.source.dataSourceId The resource uri over which + * log search query is to be run. + * + * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. + * Possible values include: 'ResultCount' + * + * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for + * rule. + * + * @param {number} parameters.schedule.frequencyInMinutes frequency (in + * minutes) at which rule condition should be evaluated. + * + * @param {number} parameters.schedule.timeWindowInMinutes Time window for + * which data needs to be fetched for query (should be greater than or equal to + * frequencyInMinutes). + * + * @param {object} parameters.action Action needs to be taken on rule + * execution. + * + * @param {string} parameters.action.odatatype Polymorphic Discriminator + * + * @param {string} parameters.location Resource location + * + * @param {object} [parameters.tags] Resource tags + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, ruleName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, ruleName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates an log search rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} parameters The parameters of the rule to create or update. + * + * @param {string} [parameters.description] The description of the Log Search + * rule. + * + * @param {string} [parameters.enabled] The flag which indicates whether the + * Log Search rule is enabled. Value should be true or false. Possible values + * include: 'true', 'false' + * + * @param {object} parameters.source Data Source against which rule will Query + * Data + * + * @param {string} parameters.source.query Log search query. + * + * @param {array} [parameters.source.authorizedResources] List of Resource + * referred into query + * + * @param {string} parameters.source.dataSourceId The resource uri over which + * log search query is to be run. + * + * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. + * Possible values include: 'ResultCount' + * + * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for + * rule. + * + * @param {number} parameters.schedule.frequencyInMinutes frequency (in + * minutes) at which rule condition should be evaluated. + * + * @param {number} parameters.schedule.timeWindowInMinutes Time window for + * which data needs to be fetched for query (should be greater than or equal to + * frequencyInMinutes). + * + * @param {object} parameters.action Action needs to be taken on rule + * execution. + * + * @param {string} parameters.action.odatatype Polymorphic Discriminator + * + * @param {string} parameters.location Resource location + * + * @param {object} [parameters.tags] Resource tags + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LogSearchRuleResource} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, ruleName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, ruleName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, ruleName, parameters, options, optionalCallback); + } + } + + /** + * Gets an Log Search rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, ruleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, ruleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets an Log Search rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LogSearchRuleResource} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, ruleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, ruleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, ruleName, options, optionalCallback); + } + } + + /** + * Update log search Rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} parameters The parameters of the rule to update. + * + * @param {object} [parameters.tags] Resource tags + * + * @param {string} [parameters.enabled] The flag which indicates whether the + * Log Search rule is enabled. Value should be true or false. Possible values + * include: 'true', 'false' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, ruleName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, ruleName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update log search Rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} parameters The parameters of the rule to update. + * + * @param {object} [parameters.tags] Resource tags + * + * @param {string} [parameters.enabled] The flag which indicates whether the + * Log Search rule is enabled. Value should be true or false. Possible values + * include: 'true', 'false' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LogSearchRuleResource} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, ruleName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, ruleName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, ruleName, parameters, options, optionalCallback); + } + } + + /** + * Deletes a Log Search rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, ruleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, ruleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a Log Search rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, ruleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, ruleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, ruleName, options, optionalCallback); + } + } + + /** + * List the Log Search rules within a subscription group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LogSearchRuleResourceCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResourceCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + + /** + * List the Log Search rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List the Log Search rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. For + * more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LogSearchRuleResourceCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LogSearchRuleResourceCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + +} + +module.exports = ScheduledQueryRules; diff --git a/lib/services/monitorManagement/package-lock.json b/lib/services/monitorManagement/package-lock.json new file mode 100644 index 0000000000..18b07e59ae --- /dev/null +++ b/lib/services/monitorManagement/package-lock.json @@ -0,0 +1,578 @@ +{ + "name": "azure-arm-monitor", + "version": "3.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.2.tgz", + "integrity": "sha512-A6Uv1anbsCvrRDtaUXS2xZ5tlzD+Kg7yMRlSLFDy3z0r7KlGXDzL14vELXIAgpk2aJbU3XeZZQRcEkLkowT92g==" + }, + "@types/uuid": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.3.tgz", + "integrity": "sha512-5fRLCYhLtDb3hMWqQyH10qtF+Ud2JnNCXTCZ+9ktNdCcgslcuXkDTkFcJNk++MT29yDntDnlF1+jD+uVGumsbw==", + "requires": { + "@types/node": "*" + } + }, + "adal-node": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/adal-node/-/adal-node-0.1.28.tgz", + "integrity": "sha1-RoxLs+u9lrEnBmn0ucuk4AZepIU=", + "requires": { + "@types/node": "^8.0.47", + "async": ">=0.6.0", + "date-utils": "*", + "jws": "3.x.x", + "request": ">= 2.52.0", + "underscore": ">= 1.3.1", + "uuid": "^3.1.0", + "xmldom": ">= 0.1.x", + "xpath.js": "~1.1.0" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "^4.14.0" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" + }, + "base64url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-2.0.0.tgz", + "integrity": "sha1-6sFuA+oUOO/5Qj1puqNiYu0fcLs=" + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "requires": { + "hoek": "4.x.x" + } + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "requires": { + "boom": "5.x.x" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "requires": { + "hoek": "4.x.x" + } + } + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "date-utils": { + "version": "1.2.21", + "resolved": "https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz", + "integrity": "sha1-YfsWzcEnSzyayq/+n8ad+HIKK2Q=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "ecdsa-sig-formatter": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.9.tgz", + "integrity": "sha1-S8kmJ07Dtau1AW5+HWCSGsJisqE=", + "requires": { + "base64url": "^2.0.0", + "safe-buffer": "^5.0.1" + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "^5.1.0", + "har-schema": "^2.0.0" + } + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "requires": { + "boom": "4.x.x", + "cryptiles": "3.x.x", + "hoek": "4.x.x", + "sntp": "2.x.x" + } + }, + "hoek": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", + "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jwa": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.5.tgz", + "integrity": "sha1-oFUs4CIHQs1S4VN3SjKQXDDnVuU=", + "requires": { + "base64url": "2.0.0", + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.9", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.4.tgz", + "integrity": "sha1-+ei5M46KhHJ31kRLFGT2GIDgUKI=", + "requires": { + "base64url": "^2.0.0", + "jwa": "^1.1.4", + "safe-buffer": "^5.0.1" + } + }, + "lodash": { + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" + }, + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "requires": { + "mime-db": "~1.33.0" + } + }, + "moment": { + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.0.tgz", + "integrity": "sha512-1muXCh8jb1N/gHRbn9VDUBr0GYb8A/aVcHlII9QSB68a50spqEVLIGN6KVmCOnSvJrUhC0edGgKU5ofnGXdYdg==" + }, + "ms-rest": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/ms-rest/-/ms-rest-2.3.6.tgz", + "integrity": "sha512-M+Lx9P7Wy4TeAk7jqPLwGS1QS1gvxF6Xo+OHv5j1g3Kcb44T/GTUuSjxTKarF6aKyeacZH1ZD++Nt7pcql7dDA==", + "requires": { + "duplexer": "^0.1.1", + "is-buffer": "^1.1.6", + "is-stream": "^1.1.0", + "moment": "^2.21.0", + "request": "^2.87.0", + "through": "^2.3.8", + "tunnel": "0.0.5", + "uuid": "^3.2.1" + }, + "dependencies": { + "request": { + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", + "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" + } + } + } + }, + "ms-rest-azure": { + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/ms-rest-azure/-/ms-rest-azure-2.5.5.tgz", + "integrity": "sha512-LnP5YlgqvNAOi1x2b4Ru+1ubz/PtYQgNeH74aiolP+Sb5lpOw5ewzbncXae1pR5OWu9NGwxjX59adzSWosqnzw==", + "requires": { + "@types/node": "^9.4.6", + "@types/uuid": "^3.4.3", + "adal-node": "^0.1.27", + "async": "2.6.0", + "moment": "^2.20.1", + "ms-rest": "^2.3.2", + "uuid": "^3.2.1" + }, + "dependencies": { + "@types/node": { + "version": "9.6.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.2.tgz", + "integrity": "sha512-UWkRY9X7RQHp5OhhRIIka58/gVVycL1zHZu0OTsT5LI86ABaMOSbUjAl+b0FeDhQcxclrkyft3kW5QWdMRs8wQ==" + } + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "request": { + "version": "2.85.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", + "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "hawk": "~6.0.2", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "stringstream": "~0.0.5", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "requires": { + "hoek": "4.x.x" + } + }, + "sshpk": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", + "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.0" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "requires": { + "punycode": "^1.4.1" + } + }, + "tunnel": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz", + "integrity": "sha512-gj5sdqherx4VZKMcBA4vewER7zdK25Td+z1npBqpbDys4eJrLx+SlYjJvq1bDXs2irkuJM5pf8ktaEQVipkrbA==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "uuid": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "xmldom": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", + "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=" + }, + "xpath.js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz", + "integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ==" + } + } +} diff --git a/lib/services/monitorManagement/package.json b/lib/services/monitorManagement/package.json index e43790e469..5d54214012 100644 --- a/lib/services/monitorManagement/package.json +++ b/lib/services/monitorManagement/package.json @@ -2,21 +2,24 @@ "name": "azure-arm-monitor", "author": "Microsoft Corporation", "description": "MonitorManagementClient Library with typescript type definitions for node", - "version": "2.0.0-preview", + "version": "3.0.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" }, - "keywords": [ "node", "azure" ], + "keywords": [ + "node", + "azure" + ], "license": "MIT", "main": "./lib/monitorManagementClient.js", "types": "./lib/monitorManagementClient.d.ts", - "homepage": "http://github.com/azure/azure-sdk-for-node", + "homepage": "https://github.com/azure/azure-sdk-for-node/lib/services/monitorManagement", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" + "url": "https://github.com/azure/azure-sdk-for-node/issues" } }